SvrReportController.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Data.Entity;
  5. using System.Data.Entity.Migrations;
  6. using System.Data.SqlClient;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Web.Http;
  12. using DevExpress.XtraBars;
  13. using XdCxRhDW.App.Model;
  14. using XdCxRhDW.Dto;
  15. using XdCxRhDW.WebApi;
  16. namespace XdCxRhDW.App.Controllers
  17. {
  18. /// <summary>
  19. /// 服务状态上报接口
  20. /// </summary>
  21. public class SvrReportController : BaseController
  22. {
  23. /// <summary>
  24. /// 服务状态上报
  25. /// </summary>
  26. /// <param name="dto">服务状态信息</param>
  27. /// <returns></returns>
  28. [HttpPost]
  29. public AjaxResult Report(SvrStateReportDto dto)
  30. {
  31. try
  32. {
  33. if (!string.IsNullOrWhiteSpace(dto.BaseHttpAddr))
  34. {
  35. if (dto.BaseHttpAddr.EndsWith("/"))
  36. dto.BaseHttpAddr = dto.BaseHttpAddr + "api/";
  37. else
  38. dto.BaseHttpAddr = dto.BaseHttpAddr + "/api/";
  39. }
  40. Messenger.Defalut.Pub("服务状态改变", dto);
  41. return Success();
  42. }
  43. catch (Exception ex)
  44. {
  45. XdCxRhDW.Framework.LogHelper.Error("服务状态上报处理出错!", ex);
  46. return Error("服务状态上报处理出错");
  47. }
  48. }
  49. }
  50. //public class ItemSvrEventArgs
  51. //{
  52. // /// <summary>
  53. // /// 错误码
  54. // /// </summary>
  55. // public int code { get; set; }
  56. // /// <summary>
  57. // /// 消息
  58. // /// </summary>
  59. // public string msg { get; set; }
  60. // /// <summary>
  61. // /// 服务
  62. // /// </summary>
  63. // public ModelSvr modelSvrs { get; set; }
  64. //}
  65. }