123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Data.SqlClient;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using DW5S.DTO;
- using DW5S.WebApi;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- namespace DW5S.App.Controllers
- {
- /// <summary>
- /// 服务状态上报接口
- /// </summary>
- public class SvrReportController : BaseController
- {
- [Autowired]
- private readonly ILogger logger;
- /// <summary>
- /// 服务状态上报
- /// </summary>
- /// <param name="dto">服务状态信息</param>
- /// <returns></returns>
- [HttpPost]
- public 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/";
- }
- Messenger.Defalut.Pub("服务状态改变", dto);
- return Success();
- }
- catch (Exception ex)
- {
- string msg = "服务状态处理出错";
- logger.LogError(ex, msg);
- return Error(msg);
- }
- }
- }
- }
|