123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Data.Entity;
- using System.Data.Entity.Migrations;
- using System.Data.SqlClient;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Web.Http;
- using DevExpress.XtraBars;
- using XdCxRhDW.App.Model;
- using XdCxRhDW.App.Service;
- using XdCxRhDW.Dto;
- using XdCxRhDW.WebApi;
- namespace XdCxRhDW.App.Controllers
- {
- /// <summary>
- /// 服务状态上报接口
- /// </summary>
- public class SvrReportController : BaseController
- {
- FileWriterService _service;
- public SvrReportController(FileWriterService service)
- {
- _service = service;
- }
- /// <summary>
- /// 服务状态上报
- /// </summary>
- /// <param name="dto">服务状态信息</param>
- /// <returns></returns>
- [HttpPost]
- public async Task<AjaxResult> Report(SvrStateReportDto dto)
- {
- try
- {
- if (!string.IsNullOrWhiteSpace(dto.BaseHttpAddr))
- {
- if (dto.BaseHttpAddr.EndsWith("/"))
- dto.BaseHttpAddr = dto.BaseHttpAddr + "api/";
- else
- dto.BaseHttpAddr = dto.BaseHttpAddr + "/api/";
- }
- if (dto.ModuleType == EnumModuleType.Soft)
- {
- Messenger.Defalut.Pub("服务状态改变", dto);
- }
- if (dto.ID == 0)
- _service.WriteStateRes(dto);
- return Success();
- }
- catch (Exception ex)
- {
- await XdCxRhDW.UI.Lib.LogHelper.Error("服务状态上报处理出错!", ex);
- return Error("服务状态上报处理出错");
- }
- }
- }
- }
|