Procházet zdrojové kódy

json字段映射问题

lichunlei před 8 měsíci
rodič
revize
35e33295a1

+ 1 - 0
Controllers/Admin/ApiInfoController.cs

@@ -7,6 +7,7 @@ using Vo.Admin;
 using Mapster;
 using Infrastructure;
 using Dto.Admin;
+using Common;
 
 
 namespace Controllers.Admin

+ 1 - 1
Model/Database/ApiInfo.cs

@@ -125,7 +125,7 @@ namespace Model
         /// <summary>
         /// 接口参数
         /// </summary>
-        [SugarColumn(ColumnDescription = "接口参数", ColumnName = "api_param")]
+        [SugarColumn(ColumnDescription = "接口参数", ColumnName = "api_param", IsJson = true, ColumnDataType = "json")]
         public List<ApiParamObject> apiParam { get; set; }
 
 

+ 1 - 1
Model/Dto/Admin/AddApiInfoDto.cs

@@ -74,7 +74,7 @@ namespace Dto.Admin
         /// <summary>
         /// 接口参数
         /// </summary>
-        public List<ApiParamObject> apiParam { get; set; }
+        public List<object> apiParam { get; set; }
 
 
 

+ 7 - 0
Model/Vo/Admin/GetApiInfoQueryVo.cs

@@ -1,3 +1,4 @@
+using Model;
 using Newtonsoft.Json;
 
 namespace Vo.Admin
@@ -67,6 +68,12 @@ namespace Vo.Admin
         public string apiDetail { get; set; }
 
 
+        /// <summary>
+        /// 接口参数
+        /// </summary>
+        public List<ApiParamObject> apiParam { get; set; }
+
+
 
     }
 }

+ 7 - 1
Util/ModelVoAdapt.cs

@@ -1,4 +1,5 @@
-using Mapster;
+using Dto.Admin;
+using Mapster;
 using Model;
 using Vo.Admin;
 
@@ -12,6 +13,11 @@ namespace Util
                 .Map(dest => dest.systemSupport, src => string.IsNullOrEmpty(src.systemSupport)
                     ? Array.Empty<string>()
                     : src.systemSupport.Split(',', StringSplitOptions.RemoveEmptyEntries));
+
+            TypeAdapterConfig<AddApiInfoDto, ApiInfo>.NewConfig()
+                .Map(dest => dest.apiParam, src => src.apiParam == null
+                    ? new List<ApiParamObject>()
+                    : src.apiParam.Cast<ApiParamObject>().ToList());
         }
 
     }

+ 10 - 12
appsettings.Development.json

@@ -1,8 +1,8 @@
 {
   "Logging": {
     "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
+      "Yarp.ReverseProxy": "Trace",
+      "Microsoft.AspNetCore.Routing": "Trace"
     }
   },
   "AllowedHosts": "*",
@@ -11,20 +11,18 @@
       {
         "Optional": false,
         "DataId": "omega",
-        "Group": "DEFAULT_GROUP"
+        "Group": "DEFAULT"
       }
     ],
-    "Namespace": "7e41669f-6054-45f5-b038-f7bb07410807",
-    "ServerAddresses": [ "https://nacos-test.kexiaoshuang.com/" ],
+    "Namespace": "3844cb7b-89e8-40d8-b9b0-082da19c0806",
+    "ServerAddresses": [ "http://nacos-csharp.kexiaoshuang.com/" ],
     "ServiceName": "omega_source",
-    "GroupName": "DEFAULT_GROUP",
-    "UserName": "nacos",
-    "Password": "Kxs#2025",
-    "EndPoint": "",
-    "Ip": "localhost",
+    "GroupName": "DEFAULT",
+    "Ip": "",
     "Port": "8005",
-    "ConfigUseRpc": false,
-    "NamingUseRpc": false,
+    "EndPoint": "",
+    "ConfigUseRpc": true,
+    "NamingUseRpc": true,
     "RegisterEnabled": true,
     "InstanceEnabled": true,
     "DefaultTimeOut": 30000,

+ 15 - 12
appsettings.json

@@ -1,8 +1,8 @@
 {
   "Logging": {
     "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
+      "Yarp.ReverseProxy": "Trace",
+      "Microsoft.AspNetCore.Routing": "Trace"
     }
   },
   "AllowedHosts": "*",
@@ -10,22 +10,25 @@
     "Listeners": [
       {
         "Optional": false,
-        "DataId": "",
+        "DataId": "omega",
         "Group": "DEFAULT_GROUP"
       }
     ],
-    "Namespace": "",
-    "ServerAddresses": [ "http://nut.yunmuit.com/" ],
+    "Namespace": "7e41669f-6054-45f5-b038-f7bb07410807",
+    "ServerAddresses": [ "https://nacos-test.kexiaoshuang.com/" ],
     "ServiceName": "omega_source",
     "GroupName": "DEFAULT_GROUP",
-    "UserName": "nacos",
-    "Password": "nacos",
-    "EndPoint": "",
-    "Ip": "localhost",
+    "Ip": "",
     "Port": "8005",
-    "ConfigUseRpc": false,
-    "NamingUseRpc": false,
+    "EndPoint": "",
+    "ConfigUseRpc": true,
+    "NamingUseRpc": true,
     "RegisterEnabled": true,
-    "InstanceEnabled": true
+    "InstanceEnabled": true,
+    "DefaultTimeOut": 30000,
+    "Metadata": {
+      "preserved.heart.beat.interval": 30000,
+      "preserved.heart.beat.timeout": 60000
+    }
   }
 }