using HH.TOOLS.LOG;
|
using HH.WMS.BLL;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Common;
|
using HH.WMS.Utils;
|
using HH.WMS.WebApi.Areas.Common.Controllers;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace HH.WMS.WebApi.Areas.Basic
|
{
|
public class LogController : BaseController
|
{
|
[HttpPost]
|
public string GetList(SearchDto searchModel)
|
{
|
try
|
{
|
return ValidateToken(searchModel.TokenId, t =>
|
{
|
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
|
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
List<string> states = new List<string>();
|
////状态初始化多个 逗号隔开
|
OperateResult result = new OperateResult();
|
|
int total = 0;
|
|
LogHelper.CleanUp(0, 7);
|
|
var data = LogHelper.Get(searchModel, out total);
|
data.ForEach(e =>
|
{
|
//e.CN_S_LOG_CONTENT = e.CN_S_LOG_CONTENT.Replace("\"", "'");
|
e.CN_T_CREATE = e.CN_T_CREATE.AddHours(8);
|
});
|
OperateResult pagingList = OperateResult.Succeed("", new
|
{
|
rows = data,
|
total = total
|
});
|
return JsonConvert.SerializeObject(pagingList, timeFormat);
|
});
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error(ex.Message));
|
}
|
}
|
|
[HttpGet]
|
public OperateResult GetDtls(string mstGuid)
|
{
|
return ValidateToken(t =>
|
{
|
var dtls = LogHelper.GetDtls(mstGuid);
|
dtls.ForEach(e =>
|
{
|
e.CN_S_LOG_CONTENT = e.CN_S_LOG_CONTENT.Replace("\"", "'");
|
e.CN_T_CREATE = e.CN_T_CREATE.AddHours(8);
|
});
|
return OperateResult.Succeed(null, dtls);
|
});
|
}
|
|
[HttpGet]
|
public IHttpActionResult Add()
|
{
|
var logPara = new LogPara("日志测试");
|
logPara.PushAndAdd(DateTime.Now.ToString() + "新增测试日志记录!");
|
return Json("添加成功!");
|
}
|
}
|
}
|