Пример #1
0
 private bool SaveErrorRecord(string url, string message, string ipAddress)
 {
     try
     {
         return(ErrorRecordService.SaveErrorRecord(new Log_ErrorRecord()
         {
             SystemID = BaseSystemConfig.SystemID,
             Url = url,
             Message = message,
             IpAddress = ipAddress,
             State = true
         }));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #2
0
        public IActionResult Save(string uuid, [FromBody] JObject fromValue)
        {
            long logId = 0;

            try
            {
                logId = BaseApiManager.SaveLogs(uuid, fromValue);
                if (!IsUuid(uuid))
                {
                    return(Error(logId, "verify uuid fail!"));
                }
                bool   isParams = IsSaveParams(fromValue);
                var    entityInterfaceAccount = GetInterfaceAccountByUuid(uuid);
                string companyId = entityInterfaceAccount.CompanyID;

                string clientId  = GetJObjectValue(fromValue, "client_id");
                string url       = GetJObjectValue(fromValue, "url");
                string message   = GetJObjectValue(fromValue, "message");
                string ipAddress = Net.Ip;
                var    entity    = new Log_ErrorRecord()
                {
                    SystemID  = SystemID,
                    ClientID  = clientId.ToInt().ToByte(),
                    Url       = url,
                    Message   = message,
                    IpAddress = ipAddress,
                    State     = true
                };
                var result = ErrorRecordService.SaveErrorRecord(entity);
                if (result)
                {
                    return(Success(logId, "ok"));
                }
                else
                {
                    return(Error(logId, "fail"));
                }
            }
            catch (Exception ex)
            {
                return(Error(logId, ex.Message));
            }
        }