1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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.Repostory;
- using DW5S.WebApi;
- using Microsoft.AspNetCore.Mvc;
- using Serilog;
- namespace DW5S.Controllers
- {
- /// <summary>
- /// 服务状态上报接口
- /// </summary>
- public class SvrReportController : BaseController
- {
- ILogger logger { get; set; }
- IUnitOfWork unitOfWork { get; set; }
- /// <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.Error(ex, msg);
- return Error(msg);
- }
- }
- }
- }
|