qinchulong
2025-03-08 31b07882a70110829c0742407e8288f217327ce9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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();
        }
    }
}