浏览代码

json字段映射问题

lichunlei 8 月之前
父节点
当前提交
b1d4717b18
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 1 0
      Model/Database/ApiInfo.cs
  2. 3 1
      Model/Dto/Admin/AddApiInfoDto.cs
  3. 1 1
      Util/ModelVoAdapt.cs

+ 1 - 0
Model/Database/ApiInfo.cs

@@ -1,4 +1,5 @@
 using Mapster;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 
 namespace Model

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

@@ -1,7 +1,9 @@
 using System;
 using System.ComponentModel.DataAnnotations;
+using LitJson;
 using Model;
 using Model.Base;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace Dto.Admin
 {
@@ -74,7 +76,7 @@ namespace Dto.Admin
         /// <summary>
         /// 接口参数
         /// </summary>
-        public List<object> apiParam { get; set; }
+        public string apiParam { get; set; }
 
 
 

+ 1 - 1
Util/ModelVoAdapt.cs

@@ -18,7 +18,7 @@ namespace Util
             TypeAdapterConfig<AddApiInfoDto, ApiInfo>.NewConfig()
                 .Map(dest => dest.apiParam, src => src.apiParam == null
                     ? new List<ApiParamObject>()
-                    : src.apiParam.Select(obj => obj.Deserialize<Address>()).ToList());
+                    : Newtonsoft.Json.JsonConvert.DeserializeObject<List<ApiParamObject>>(src.apiParam));
         }
 
     }