Browse Source

修复克隆接口

lichunlei 3 months ago
parent
commit
05426c3720

+ 1 - 1
Controllers/Admin/ApiInfoController.cs

@@ -164,7 +164,7 @@ namespace Controllers.Admin
         [Route("/v1/omega_source/ApiInfo/copyApiInfo")]
         [Route("/v1/omega_source/ApiInfo/copyApiInfo")]
         public IActionResult copyApiInfo([FromBody] CopyApiInfoDto param)
         public IActionResult copyApiInfo([FromBody] CopyApiInfoDto param)
         {
         {
-            var group = _ApiGroupService.GetFirst(m => m.id == param.targetGroupId) ?? new ApiGroup();
+            var group = _ApiGroupService.GetFirst(m => m.id == param.targetApiGroupId) ?? new ApiGroup();
             _ApiInfoService.copyApiInfo(param, group);
             _ApiInfoService.copyApiInfo(param, group);
             return SUCCESS("ok");
             return SUCCESS("ok");
         }
         }

+ 2 - 2
Model/Dto/Admin/CopyApiInfoDto.cs

@@ -12,13 +12,13 @@ namespace Dto.Admin
         /// <summary>
         /// <summary>
         /// 来源字段ID
         /// 来源字段ID
         /// </summary>
         /// </summary>
-        public int[] sourceApiId { get; set; }
+        public string sourceApiId { get; set; }
 
 
 
 
         /// <summary>
         /// <summary>
         /// 目标表ID
         /// 目标表ID
         /// </summary>
         /// </summary>
-        public int targetGroupId { get; set; }
+        public int targetApiGroupId { get; set; }
 
 
 
 
 
 

+ 4 - 2
Services/ApiInfoService.cs

@@ -7,6 +7,8 @@ using Microsoft.AspNetCore.Mvc;
 using Vo.Admin;
 using Vo.Admin;
 using Dto.Admin;
 using Dto.Admin;
 using Infrastructure;
 using Infrastructure;
+using Common;
+using System.Linq;
 
 
 
 
 namespace Services
 namespace Services
@@ -65,13 +67,13 @@ namespace Services
         public void copyApiInfo([FromBody] CopyApiInfoDto param, ApiGroup group)
         public void copyApiInfo([FromBody] CopyApiInfoDto param, ApiGroup group)
         {
         {
             // var group = _ApiGroupService.GetFirst(m => m.id == param.targetGroupId) ?? new ApiGroup();
             // var group = _ApiGroupService.GetFirst(m => m.id == param.targetGroupId) ?? new ApiGroup();
-            List<int> apiIdList = param.sourceApiId.ToList();
+            List<int> apiIdList = Tools.SpitIntArrary(param.sourceApiId).ToList();
             var sourceApis = GetList(m => apiIdList.Contains(m.id)).ToList();
             var sourceApis = GetList(m => apiIdList.Contains(m.id)).ToList();
             foreach(ApiInfo sourceApi in sourceApis)
             foreach(ApiInfo sourceApi in sourceApis)
             {
             {
                 ApiInfo newApi = new ApiInfo();
                 ApiInfo newApi = new ApiInfo();
                 newApi.serviceId = group.serviceId;
                 newApi.serviceId = group.serviceId;
-                newApi.groupId = param.targetGroupId;
+                newApi.groupId = param.targetApiGroupId;
                 newApi.tabName = sourceApi.tabName;
                 newApi.tabName = sourceApi.tabName;
                 newApi.apiName = sourceApi.apiName;
                 newApi.apiName = sourceApi.apiName;
                 newApi.controllerFilePath = sourceApi.controllerFilePath;
                 newApi.controllerFilePath = sourceApi.controllerFilePath;