using AutoMapper;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseRepository;
|
using WIDESEAWCS_Core.BaseServices;
|
using WIDESEAWCS_ISystemServices;
|
using WIDESEAWCS_Model.Models;
|
|
namespace WIDESEAWCS_SystemServices
|
{
|
public class dt_errormsginfoService : ServiceBase<dt_errormsgInfo, IRepository<dt_errormsgInfo>>, Idt_ErrormsginfoService
|
{
|
private readonly IMapper _mapper;
|
/// <summary>
|
/// 仓储层(数据库访问)
|
/// </summary>
|
public IRepository<dt_errormsgInfo> Repository => BaseDal;
|
public dt_errormsginfoService(IRepository<dt_errormsgInfo> BaseDal, IMapper mapper) : base(BaseDal)
|
{
|
_mapper = mapper;
|
}
|
|
/// <summary>
|
/// 更新响应的错误信息到数据库,前端界面显示
|
/// </summary>
|
/// <param name="message"></param>
|
/// <returns></returns>
|
public WebResponseContent UpdateErrorMsg(string message,int id)
|
{
|
WebResponseContent webResponse = new WebResponseContent();
|
var error = BaseDal.QueryFirst(v=>v.Id==id);
|
DateTime dTime = (DateTime)error.ModifyDate;
|
if (!error.mesg.Equals(message) && (DateTime.Now - dTime).TotalSeconds > 10)
|
{
|
error.errormsg = message;
|
error.ModifyDate = DateTime.Now;
|
BaseDal.UpdateData(error);
|
}
|
return webResponse.OK();
|
}
|
}
|
}
|