From ab4e9db779c452049b48ecdaad24e288f2e512b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Wed, 29 Oct 2025 17:50:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E6=9F=A5=E8=AF=A2=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Learn.Archives.API/Controllers/StudentController.cs | 4 ++-- Learn.Archives.API/Expand/HttpFilter.cs | 4 +--- Learn.Archives.API/appsettings.json | 6 +++++- Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Learn.Archives.API/Controllers/StudentController.cs b/Learn.Archives.API/Controllers/StudentController.cs index 86292cc..ed55d2f 100644 --- a/Learn.Archives.API/Controllers/StudentController.cs +++ b/Learn.Archives.API/Controllers/StudentController.cs @@ -117,11 +117,11 @@ namespace Learn.Archives.API.Controllers return e.Id; } /// - /// 设置角色菜单 + /// 获取学生列表 /// /// [HttpPost] - public new async Task> PageList() + public new async Task> PageList(object data) { var apiRes =await _userCenterService.CallAPI_GetPageUserList(_httpContextAccessor.HttpContext); var res= new PageResult() { Data = new List() }; diff --git a/Learn.Archives.API/Expand/HttpFilter.cs b/Learn.Archives.API/Expand/HttpFilter.cs index 415aede..b0f2395 100644 --- a/Learn.Archives.API/Expand/HttpFilter.cs +++ b/Learn.Archives.API/Expand/HttpFilter.cs @@ -153,7 +153,7 @@ namespace Learn.Archives.API.Expand //特殊处理:ResultIgnore,不进行返回结果包装,原样输出 var endpoint = context.GetEndpoint(); // 直接返回原始结果,不封装 - if (endpoint?.Metadata.GetMetadata() == null) return; + if (endpoint?.Metadata.GetMetadata() == null&& e is null) return; string request = null; var logId = Yitter.IdGenerator.YitIdHelper.NextId(); @@ -233,8 +233,6 @@ namespace Learn.Archives.API.Expand /// public override async void OnActionExecuted(ActionExecutedContext context) { - - try { BaseReturn? res = ApiResultFormatting(context); diff --git a/Learn.Archives.API/appsettings.json b/Learn.Archives.API/appsettings.json index ecd2374..304f3df 100644 --- a/Learn.Archives.API/appsettings.json +++ b/Learn.Archives.API/appsettings.json @@ -13,6 +13,8 @@ }, "DB": { "ConnectionString": "AllowLoadLocalInfile=true;Server=58.17.132.2;User ID=marking;Password=qwe123!@#;Database=learn.archives;CharSet=utf8mb4;Port=43306;pooling=true;SslMode=None;", + //正式库 + //"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.archives;CharSet=utf8mb4;pooling=true;SslMode=None", "SqlType": "MySql", "UpdateTable": false }, @@ -24,12 +26,14 @@ }, "UserCenterService": { "API": "https://dca.w.23544.com:8843/api" + //"API": "https://dcb.23544.com/api" }, "OtherDBArr": [ { "ConfigId": 1001, //用户中心 - //"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=usercenter;CharSet=utf8mb4;pooling=true;SslMode=None;", "ConnectionString": "AllowLoadLocalInfile=true;Server=58.17.132.2;User ID=marking;Password=qwe123!@#;Port=3306;Database=usercenter_v1;CharSet=utf8mb4;Port=43306;pooling=true;SslMode=None;", + //"ConnectionString": "AllowLoadLocalInfile=true;Server=usercenter-mysql.23544.com;User ID=usercenter;Password=MPsSSNuvFO7wBqADXC9zweh9tdOPNwm6;Port=3306;Database=usercenter_v1;CharSet=utf8mb4;pooling=true;SslMode=None", + "SqlType": "MySql" } ] diff --git a/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs b/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs index 19ca055..2aa8bd9 100644 --- a/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs +++ b/Learn.Archives.Core/Model/Dto/UserCenterServiceDto.cs @@ -578,6 +578,6 @@ namespace Learn.Archives.Core.Model.Dto /// /// 职位状态 /// - public bool Status { get; set; } + public object Status { get; set; } } } From 87caff02993651dfe47b6231f89c8101cd2e32ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 11 Nov 2025 18:33:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=AF=B7=E6=B1=82=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83API=E7=9A=84=E6=8D=95?= =?UTF-8?q?=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Learn.Archives.Core/Common/OhException.cs | 10 ++++++++++ Learn.Archives.Core/Common/UserCenterService.cs | 15 +++++++++++++-- Learn.Archives.Core/Learn.Archives.Core.csproj | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Learn.Archives.Core/Common/OhException.cs b/Learn.Archives.Core/Common/OhException.cs index 72eca5c..fb36166 100644 --- a/Learn.Archives.Core/Common/OhException.cs +++ b/Learn.Archives.Core/Common/OhException.cs @@ -22,6 +22,16 @@ namespace Learn.Archives.Core.Common throw new OhException(message, code); } /// + /// 抛出 异常 + /// + /// + /// + /// + public static T Error(string message, int code = 500) + { + throw new OhException(message, code); + } + /// /// 抛出 模型校验异常 /// /// diff --git a/Learn.Archives.Core/Common/UserCenterService.cs b/Learn.Archives.Core/Common/UserCenterService.cs index b4f32b1..530c17b 100644 --- a/Learn.Archives.Core/Common/UserCenterService.cs +++ b/Learn.Archives.Core/Common/UserCenterService.cs @@ -71,8 +71,19 @@ namespace Learn.Archives.Core.Common requestMessage.Content = new StringContent(data.ToJson(), Encoding.UTF8, "application/json"); var responseMessage = await httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead); - var resStr = await responseMessage.Content?.ReadAsStringAsync(); - var res = JsonSerializer.Deserialize>(resStr); + var resStr = string.Empty; + try + { + resStr= await responseMessage?.Content?.ReadAsStringAsync(); + + } + catch (Exception ex) + { + return Oh.Error($"请求用户中心出现异常 {resStr} {ex.Message}"); + } + if(string.IsNullOrEmpty(resStr)) + return Oh.Error($"请求用户中心出现异常 返回了空数据"); + var res = JsonSerializer.Deserialize>(resStr); if (res == null || res.Code != 200) Oh.Error(res.Message, res.Code); return res.Data; diff --git a/Learn.Archives.Core/Learn.Archives.Core.csproj b/Learn.Archives.Core/Learn.Archives.Core.csproj index d41fa79..91ba3a1 100644 --- a/Learn.Archives.Core/Learn.Archives.Core.csproj +++ b/Learn.Archives.Core/Learn.Archives.Core.csproj @@ -28,6 +28,6 @@ - +