TANG JIANG 1 year ago
parent
commit
a71cfa6d17

+ 13 - 3
src/Sharing.Api/Controllers/HotlineMessageReceiveController.cs

@@ -869,9 +869,19 @@ namespace Sharing.Api.Controllers
             //将上报信息写入本地库
             data.Id = await _getKnowledgeInfoSendRepository.AddAsync(data);
 
-            //保存原始数据
-            var dataRaw = _mapper.Map<KnowledgeRawData>(data);
-            await _knowledgeRawDataRepository.AddAsync(dataRaw);
+            ////保存原始数据
+            //var dataRaw = _mapper.Map<KnowledgeRawData>(data);
+            //await _knowledgeRawDataRepository.AddAsync(dataRaw);
+            //查询原有数据,如果有修改原始数据,没有直接新增
+            var dataRaw = await _knowledgeRawDataRepository.GetAsync(p => p.UID == data.UID);
+            var raw = _mapper.Map<KnowledgeRawData>(data);
+            if (dataRaw != null)
+            {
+                raw.Id = dataRaw.Id;
+                await _knowledgeRawDataRepository.UpdateAsync(raw);
+            }
+            else
+                await _knowledgeRawDataRepository.AddAsync(raw);
 
             //信息上报
             await _mediator.Publish(new GetKnowledgeInfoSendNotification(data));

+ 0 - 103
src/Sharing.DaoShu110/ApiResult.cs

@@ -1,103 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    public class ApiResult : IApiResult
-    {
-        /// <summary>
-        /// Represents an empty <see cref="IApiResult"/>.
-        /// </summary>
-        public static readonly IApiResult Empty = new ApiResult
-        {
-            code = 1,
-            msg = "请求成功",
-        };
-
-        /// <summary>
-        /// Gets or sets the status code.
-        /// </summary>
-        /// <value>The status code.</value>
-        public int code { get; set; }
-
-        /// <summary>
-        /// Gets or sets the message.
-        /// </summary>
-        /// <value>The message.</value>
-        public string msg { get; set; }
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified result.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="result">The result.</param>
-        /// <param name="message">The result.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult{TResult}"/> interface.</returns>
-        public static IApiResult<TResult> Succeed<TResult>(TResult result, string message = "请求成功") => new ApiResult<TResult>
-        {
-            code = 1,
-            data = result,
-            msg = message
-        };
-
-        public static IApiResult Succeed(string message = "请求成功") => new ApiResult
-        {
-            code = 1,
-            msg = message
-        };
-
-        /// <summary>
-        ///  Creates a new instance of <see cref="IApiResult"/> by the specified error message.
-        /// </summary>
-        /// <param name="message">The message.</param>
-        /// <param name="statusCode">The status code</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResult Failed(string message = "请求失败", int? statusCode = null) => new ApiResult
-        {
-            code = statusCode ?? 0,
-            msg = message
-        };
-
-        /// <summary>
-        ///  Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified error message.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="errorResult">The error result.</param>
-        /// <param name="message">The message.</param>
-        /// <param name="statusCode">The status code.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResult<TResult> Failed<TResult>(TResult errorResult, string message, int? statusCode = null) => new ApiResult<TResult>
-        {
-            code = statusCode ?? 0,
-            msg = message,
-            data = errorResult
-        };
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult"/> by the specified status code and message.
-        /// </summary>
-        /// <param name="statusCode">The status code.</param>
-        /// <param name="message">The message.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResult From(int statusCode, string message = null) => new ApiResult
-        {
-            code = statusCode,
-            msg = message
-        };
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified result.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="result">The result.</param>
-        /// <param name="statusCode">The status code.</param>
-        /// <param name="message">The message.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult{TResult}"/> interface.</returns>
-        public static IApiResult<TResult> From<TResult>(TResult result, int statusCode, string message) => new ApiResult<TResult>
-        {
-            code = statusCode,
-            msg = message,
-            data = result
-        };
-    }
-}

+ 0 - 32
src/Sharing.DaoShu110/ApiResultOfT.cs

@@ -1,32 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    /// <typeparam name="TResult"></typeparam>
-    public class ApiResult<TResult> : ApiResult, IApiResult<TResult>
-    {
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ApiResult{TResult}"/> class.
-        /// </summary>
-        public ApiResult() { }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ApiResult{TResult}" /> class.
-        /// </summary>
-        /// <param name="result">The result.</param>
-        /// <param name="statusCode">The status code.</param>
-        public ApiResult(TResult result, int? statusCode, string message = "")
-        {
-            code = statusCode ?? 1;
-            data = result;
-            msg = string.IsNullOrEmpty(message) ? "请求成功" : message;
-        }
-
-        /// <summary>
-        /// Gets or sets the result.
-        /// </summary>
-        /// <value>The result.</value>
-        public TResult data { get; set; }
-    }
-}

+ 0 - 32
src/Sharing.DaoShu110/ApiResultOfTR.cs

@@ -1,32 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    /// <typeparam name="TResult"></typeparam>
-    public class ApiResultR<TResult> : ApiResultR, IApiResultR<TResult>
-    {
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ApiResultR{TResult}"/> class.
-        /// </summary>
-        public ApiResultR() { }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="ApiResultR{TResult}" /> class.
-        /// </summary>
-        /// <param name="result">The result.</param>
-        /// <param name="statusCode">The status code.</param>
-        public ApiResultR(TResult result, int? statusCode, string message = "")
-        {
-            rcode = statusCode ?? 0;
-            rdata = result;
-            rmsg = string.IsNullOrEmpty(message) ? "调用成功" : message;
-        }
-
-        /// <summary>
-        /// Gets or sets the result.
-        /// </summary>
-        /// <value>The result.</value>
-        public TResult rdata { get; set; }
-    }
-}

+ 0 - 105
src/Sharing.DaoShu110/ApiResultR.cs

@@ -1,105 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    public class ApiResultR : IApiResultR
-    {
-        /// <summary>
-        /// Represents an empty <see cref="IApiResult"/>.
-        /// </summary>
-        public static readonly IApiResultR Empty = new ApiResultR
-        {
-            rcode = 0,
-            rmsg = "调用成功",
-            rdata = null
-        };
-
-        /// <summary>
-        /// Gets or sets the status code.
-        /// </summary>
-        /// <value>The status code.</value>
-        public int rcode { get; set; }
-
-        /// <summary>
-        /// Gets or sets the message.
-        /// </summary>
-        /// <value>The message.</value>
-        public string rmsg { get; set; }
-        public string rdata { get; set; }
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified result.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="result">The result.</param>
-        /// <param name="message">The result.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult{TResult}"/> interface.</returns>
-        public static IApiResultR<TResult> Succeed<TResult>(TResult result, string message = "调用成功") => new ApiResultR<TResult>
-        {
-            rcode = 0,
-            rdata = result,
-            rmsg = message
-        };
-
-        public static IApiResultR Succeed(string message = "调用成功") => new ApiResultR
-        {
-            rcode = 0,
-            rmsg = message
-        };
-
-        /// <summary>
-        ///  Creates a new instance of <see cref="IApiResult"/> by the specified error message.
-        /// </summary>
-        /// <param name="message">The message.</param>
-        /// <param name="statusCode">The status code</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResultR Failed(string message = "调用失败", int? statusCode = null) => new ApiResultR
-        {
-            rcode = statusCode ?? -1,
-            rmsg = message
-        };
-
-        /// <summary>
-        ///  Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified error message.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="errorResult">The error result.</param>
-        /// <param name="message">The message.</param>
-        /// <param name="statusCode">The status code.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResultR<TResult> Failed<TResult>(TResult errorResult, string message, int? statusCode = null) => new ApiResultR<TResult>
-        {
-            rcode = statusCode ?? -1,
-            rmsg = message,
-            rdata = errorResult
-        };
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult"/> by the specified status code and message.
-        /// </summary>
-        /// <param name="statusCode">The status code.</param>
-        /// <param name="message">The message.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult"/> interface.</returns>
-        public static IApiResultR From(int statusCode, string message = null) => new ApiResultR
-        {
-            rcode = statusCode,
-            rmsg = message
-        };
-
-        /// <summary>
-        /// Creates a new instance of <see cref="IApiResult{TResult}"/> by the specified result.
-        /// </summary>
-        /// <typeparam name="TResult">The type of the result.</typeparam>
-        /// <param name="result">The result.</param>
-        /// <param name="statusCode">The status code.</param>
-        /// <param name="message">The message.</param>
-        /// <returns>An instance inherited from <see cref="IApiResult{TResult}"/> interface.</returns>
-        public static IApiResultR<TResult> From<TResult>(TResult result, int statusCode, string message) => new ApiResultR<TResult>
-        {
-            rcode = statusCode,
-            rmsg = message,
-            rdata = result
-        };
-    }
-}

+ 47 - 74
src/Sharing.DaoShu110/Controllers/PoliceDSController.cs

@@ -21,6 +21,7 @@ namespace Sharing.DaoShu110.Controllers
     /// </summary>
     public class PoliceDSController : BaseController
     {
+        #region 注入
         private readonly IMapper _mapper;
         private readonly ICapPublisher _capPublisher;
         private readonly IRepository<PoliceReceiveChainAlarmDs> _policeReceiveChainAlarmDsRepository;
@@ -57,6 +58,7 @@ namespace Sharing.DaoShu110.Controllers
             _hotlineClient = hotlineClient;
             _channelConfigurationManager = channelConfigurationManager;
         }
+        #endregion
 
         #region receive-工单受理-已完成
 
@@ -75,14 +77,14 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             var sm4 = configurationPoliceDS.token1_sm4_mw;
 
-            IApiResultR apiR;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token1_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
                 {
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 }
                 else
                 {
@@ -107,7 +109,6 @@ namespace Sharing.DaoShu110.Controllers
 
                     #endregion
 
-                    ResultR result = new();
                     if (string.IsNullOrEmpty(strResult))
                     {
                         #region 写入本地数据库
@@ -135,39 +136,22 @@ namespace Sharing.DaoShu110.Controllers
                                 data.Id = id;
                                 data.OrderId = resultOrder.Result.Id;
                                 await _policeReceiveChainAlarmDsRepository.UpdateAsync(data, HttpContext.RequestAborted);
-                                result.rcode = 0;
-                                result.rmsg = "调用成功";
+                                apiR = DeReponse<string>.Succeed(null);
                             }
                             else
-                            {
-                                result.rcode = 0;
-                                result.rmsg = "调用成功";
-                            }
+                                apiR = DeReponse<string>.Failed(resultOrder.Error);
                         }
                         else
-                        {
-                            result.rcode = -1;
-                            result.rmsg = "调用失败";
-                        }
+                            apiR = DeReponse<string>.Failed(null);
                         #endregion
                     }
                     else
-                        result.rmsg = strResult;
-
-                    #region 返回状态
-                    if (result.rcode == -1 && false == string.IsNullOrEmpty(result.rmsg))
-                        apiR = ApiResultR.Failed(result.rmsg);
-                    else if (result.rcode == 0)
-                        apiR = ApiResultR.Succeed(result.rdata);
-                    else
-                        apiR = ApiResultR.Failed();
-
-                    #endregion
+                        apiR = DeReponse<string>.Failed(strResult);
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             #region 处理返回数据
@@ -205,14 +189,14 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             string sm4 = configurationPoliceDS.token4_sm4_mw;
 
-            IApiResultR apiR;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token4_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
                 {
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 }
                 else
                 {
@@ -238,7 +222,6 @@ namespace Sharing.DaoShu110.Controllers
                         chainDeal.RevisitTime = null;
                     #endregion
 
-                    ResultR result = new();
                     if (string.IsNullOrEmpty(strResult))
                     {
                         #region 写入本地数据库
@@ -247,33 +230,21 @@ namespace Sharing.DaoShu110.Controllers
                         {
                             //这里组装数据推送到业务系统
                             await InitChainDeal(data);
-
-                            result.rcode = 0;
-                            result.rmsg = "调用成功";
+                            apiR = DeReponse<string>.Succeed(null);
                         }
                         else
-                        {
-                            result.rcode = -1;
-                            result.rmsg = "调用失败";
-                        }
+                            apiR = DeReponse<string>.Failed(null);
+
                         #endregion
                     }
                     else
-                        result.rmsg = strResult;
-
-
-                    if (result.rcode == -1 && false == string.IsNullOrEmpty(result.rmsg))
-                        apiR = ApiResultR.Failed(result.rmsg);
-                    else if (result.rcode == 0)
-                        apiR = ApiResultR.Succeed(result.rdata);
-                    else
-                        apiR = ApiResultR.Failed();
+                        apiR = DeReponse<string>.Failed(null);
 
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             // 返回数据转Json
@@ -303,14 +274,14 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             string sm4 = configurationPoliceDS.token3_sm4_mw;
 
-            IApiResultR apiR = null;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token3_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
                 {
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 }
                 else
                 {
@@ -328,12 +299,12 @@ namespace Sharing.DaoShu110.Controllers
                     if (string.IsNullOrEmpty(openData.StartDate) || !CComm.IsDate(openData.StartDate))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
                     if (string.IsNullOrEmpty(openData.EndDate) || !CComm.IsDate(openData.EndDate))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
                     if (bRun)
                     {
@@ -345,19 +316,19 @@ namespace Sharing.DaoShu110.Controllers
                              .ToListAsync();
 
                         if (null == listData)
-                            apiR = ApiResultR.Failed();
+                            apiR = DeReponse<string>.Failed(null);
                         else
                         {
                             var dto = _mapper.Map<IReadOnlyList<ChainAlarm_DS>>(listData);
                             // 返回数据
-                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                            apiR = DeReponse<string>.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
                         }
                     }
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             // 返回数据转Json
@@ -390,14 +361,14 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             string sm4 = configurationPoliceDS.token2_sm4_mw;
 
-            IApiResultR apiR = null;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token2_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
                 {
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 }
                 else
                 {
@@ -416,12 +387,12 @@ namespace Sharing.DaoShu110.Controllers
                     if (!string.IsNullOrEmpty(openData.StartDate) && !CComm.IsDate(openData.StartDate))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
                     if (!string.IsNullOrEmpty(openData.EndDate) && !CComm.IsDate(openData.EndDate))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
 
                     if (bRun)
@@ -436,19 +407,19 @@ namespace Sharing.DaoShu110.Controllers
                                  .ToListAsync();
 
                         if (null == listData)
-                            apiR = ApiResultR.Failed();
+                            apiR = DeReponse<string>.Failed(null);
                         else
                         {
                             var dto = _mapper.Map<IReadOnlyList<ChainDeal_DS>>(listData);
                             // 返回数据
-                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                            apiR = DeReponse<string>.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
                         }
                     }
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             // 返回数据转Json
@@ -474,8 +445,8 @@ namespace Sharing.DaoShu110.Controllers
         public async Task<HttpResponseMessage> Get_Knowledge_Info()
         {
             // 测试Json
-            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-08-07 10:59:21","keyWord":"222"}
-            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-08-07 10:59:21","keyWord":""}
+            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-12-07 10:59:21","keyWord":"市民"}
+            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-12-07 10:59:21","keyWord":""}
 
             // 测试Base64
             // sVGPN7BDsKnDLrd6NzrGx+2IH6vVAo6bjGSenIgCJATssZduYxBOLdQi7TVdsBCy7AGk15xjKRVe4AdovL6r49fxDvWjyDlxS8K4qkukEOtYs/VyP6WIdiKQL6PC3i/T
@@ -483,14 +454,14 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             string sm4 = configurationPoliceDS.token5_sm4_mw;
 
-            IApiResultR apiR = null;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token5_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
                 {
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 }
                 else
                 {
@@ -510,12 +481,12 @@ namespace Sharing.DaoShu110.Controllers
                     if (string.IsNullOrEmpty(get_Knowledge.createTimeBegin) || !CComm.IsDate(get_Knowledge.createTimeBegin))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
                     if (string.IsNullOrEmpty(get_Knowledge.createTimeEnd) || !CComm.IsDate(get_Knowledge.createTimeEnd))
                     {
                         bRun = false;
-                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                        apiR = DeReponse<string>.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
                     if (bRun)
                     {
@@ -528,19 +499,19 @@ namespace Sharing.DaoShu110.Controllers
                           .ToListAsync();
 
                         if (null == listData)
-                            apiR = ApiResultR.Failed();
+                            apiR = DeReponse<string>.Failed(null);
                         else
                         {
                             var dto = _mapper.Map<IReadOnlyList<KnowledgeDto>>(listData);
                             // 返回数据
-                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                            apiR = DeReponse<string>.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
                         }
                     }
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             // 返回数据转Json
@@ -568,13 +539,13 @@ namespace Sharing.DaoShu110.Controllers
             var configurationPoliceDS = _channelConfigurationManager.GetConfigurationPoliceDS();
             string sm4 = configurationPoliceDS.token6_sm4_mw;
 
-            IApiResultR apiR;
+            var apiR = new DeReponse<string>();
             try
             {
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), configurationPoliceDS.token6_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
-                    apiR = ApiResultR.Failed(dcsmMsg);
+                    apiR = DeReponse<string>.Failed(dcsmMsg);
                 else
                 {
                     string base64String = await CComm.getStreamBase64(HttpContext.Request);
@@ -591,25 +562,25 @@ namespace Sharing.DaoShu110.Controllers
 
                     if (string.IsNullOrEmpty(get_Knowledge.id))
                     {
-                        apiR = ApiResultR.Failed("【知识库ID】不能为空");
+                        apiR = DeReponse<string>.Failed("【知识库ID】不能为空");
                     }
                     else
                     {
                         var data = await _knowledgeRawDataRepository.GetAsync(p => p.Id == get_Knowledge.id);
                         if (null == data)
-                            apiR = ApiResultR.Failed();
+                            apiR = DeReponse<string>.Failed(null);
                         else
                         {
                             var dto = _mapper.Map<KnowledgeContent>(data);
                             // 返回数据
-                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                            apiR = DeReponse<string>.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
                         }
                     }
                 }
             }
             catch (System.Exception)
             {
-                apiR = ApiResultR.Failed("接口异常");
+                apiR = DeReponse<string>.Failed("接口异常");
             }
 
             // 返回数据转Json
@@ -624,6 +595,7 @@ namespace Sharing.DaoShu110.Controllers
 
         #endregion
 
+        #region 私有方法
         /// <summary>
         /// 工单办结
         /// </summary>
@@ -677,5 +649,6 @@ namespace Sharing.DaoShu110.Controllers
             }
 
         }
+        #endregion
     }
 }

+ 52 - 0
src/Sharing.DaoShu110/Dtos/DeReponse.cs

@@ -0,0 +1,52 @@
+namespace Sharing.DaoShu110.Dtos
+{
+    public class DeReponse<TData>
+    {
+        /// <summary>
+        /// 状态
+        /// </summary>
+        public int rcode { get; set; }
+
+        /// <summary>
+        /// 描述
+        /// </summary>
+        public string rmsg { get; set; }
+
+        /// <summary>
+        /// 数据
+        /// </summary>
+        public TData rdata { get; set; }
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        /// <param name="data"></param>
+        /// <param name="description"></param>
+        /// <returns></returns>
+        public static DeReponse<TData> Succeed(TData data, string? description = "")
+        {
+            return new DeReponse<TData>
+            {
+                rcode = 0,
+                rdata = data,
+                rmsg = (description ?? "调用成功")
+            };
+        }
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        /// <param name="data"></param>
+        /// <param name="description"></param>
+        /// <returns></returns>
+        public static DeReponse<TData> Failed(TData data, string? description = "")
+        {
+            return  new DeReponse<TData>
+            {
+               rcode = 0,
+                rdata = data,
+                rmsg = (description ?? "调用失败")
+            };
+        }
+    }
+}

+ 0 - 21
src/Sharing.DaoShu110/Dtos/ResultR.cs

@@ -1,21 +0,0 @@
-namespace Sharing.DaoShu110.Dtos
-{
-    public class ResultR
-    {
-
-        /// <summary>
-        /// 状态
-        /// </summary>
-        public int rcode { get; set; } = -1;
-        /// <summary>
-        /// 消息
-        /// </summary>
-        public string rmsg { get; set; }
-
-        /// <summary>
-        /// 返回对象
-        /// </summary>
-        public object rdata { get; set; }
-
-    }
-}

+ 0 - 20
src/Sharing.DaoShu110/IApiResult.cs

@@ -1,20 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    public interface IApiResult
-    {
-        /// <summary>
-        /// Gets or sets the status code.
-        /// </summary>
-        /// <value>The status code.</value>
-        int code { get; set; }
-
-        /// <summary>
-        /// Gets or sets the message.
-        /// </summary>
-        /// <value>The message.</value>
-        string msg { get; set; }
-    }
-}

+ 0 - 11
src/Sharing.DaoShu110/IApiResultOfT.cs

@@ -1,11 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    public interface IApiResult<T> : IApiResult
-    {
-        /// <summary>
-        /// Gets or sets the result.
-        /// </summary>
-        /// <value>The result.</value>
-        T data { get; set; }
-    }
-}

+ 0 - 11
src/Sharing.DaoShu110/IApiResultOfTR.cs

@@ -1,11 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    public interface IApiResultR<T> : IApiResultR
-    {
-        /// <summary>
-        /// Gets or sets the result.
-        /// </summary>
-        /// <value>The result.</value>
-        T rdata { get; set; }
-    }
-}

+ 0 - 20
src/Sharing.DaoShu110/IApiResultR.cs

@@ -1,20 +0,0 @@
-namespace Sharing.DaoShu110
-{
-    /// <summary>
-    /// A unified format for processing data returns
-    /// </summary>
-    public interface IApiResultR
-    {
-        /// <summary>
-        /// Gets or sets the status code.
-        /// </summary>
-        /// <value>The status code.</value>
-        int rcode { get; set; }
-
-        /// <summary>
-        /// Gets or sets the message.
-        /// </summary>
-        /// <value>The message.</value>
-        string rmsg { get; set; }
-    }
-}