lcl 10 сар өмнө
parent
commit
c7e38eb1b2

BIN
.DS_Store


+ 40 - 6
Controllers/ApiInfoController.cs

@@ -41,9 +41,9 @@ namespace Controllers
         /// <returns>api接口列表</returns>
         [HttpGet]
         [Route("/v1/api/ApiInfo/list")]
-        public IActionResult List([FromQuery] ApiInfoListDto parm)
+        public IActionResult List([FromQuery] PagerInfo page, [FromQuery] ApiInfoListDto parm)
         {
-            var response = _ApiInfoService.List(parm);
+            var response = _ApiInfoService.List(page, parm);
             return SUCCESS(response);
         }
 
@@ -86,13 +86,13 @@ namespace Controllers
 
 
         /// <summary>
-        /// api接口修改
+        /// api接口设置版本号
         /// </summary>
         /// <param name="parm">请求参数</param>
-        /// <returns>api接口修改</returns>
+        /// <returns>api接口设置版本号</returns>
         [HttpPut]
-        [Route("/v1/api/ApiInfo/update")]
-        public IActionResult Update([FromBody] ApiInfoUpdateDto parm)
+        [Route("/v1/api/ApiInfo/setVersion")]
+        public IActionResult SetVersion([FromBody] ApiInfoSetVersionDto parm)
         {
             var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
             var response = _ApiInfoService.Update(modal, true);
@@ -118,6 +118,40 @@ namespace Controllers
 
 
 
+        /// <summary>
+        /// api接口修改
+        /// </summary>
+        /// <param name="parm">请求参数</param>
+        /// <returns>api接口修改</returns>
+        [HttpPut]
+        [Route("/v1/api/ApiInfo/update")]
+        public IActionResult Update([FromBody] ApiInfoUpdateDto parm)
+        {
+            var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
+            var response = _ApiInfoService.Update(modal, true);
+            return SUCCESS(response);
+        }
+
+
+
+
+        /// <summary>
+        /// api接口设置请求地址
+        /// </summary>
+        /// <param name="parm">请求参数</param>
+        /// <returns>api接口设置请求地址</returns>
+        [HttpPut]
+        [Route("/v1/api/ApiInfo/setRouter")]
+        public IActionResult SetRouter([FromBody] ApiInfoSetRouterDto parm)
+        {
+            var modal = parm.Adapt<ApiInfo>().ToUpdate(HttpContext);
+            var response = _ApiInfoService.Update(modal, true);
+            return SUCCESS(response);
+        }
+
+
+
+
 
 
     }

+ 6 - 1
Filters/GlobalActionMonitor.cs

@@ -64,7 +64,7 @@ namespace Middleware
                 {                
                     if(content.Contains("{") && content.Contains("}") && content != "{}")
                     {
-                        Dictionary<string, string> dictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(content);
+                        Dictionary<string, object> dictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(content);
                         if(context.ActionDescriptor.Parameters.Count > 0)
                         {
                             var parameters = context.ActionDescriptor.Parameters;
@@ -91,6 +91,11 @@ namespace Middleware
                                                     if(value == null || value == "") value = "0";
                                                     value = Convert.ToInt32(value);
                                                 }
+                                                else if (ParameterType == "Int64")
+                                                {
+                                                    if(value == null || value == "") value = "0";
+                                                    value = Convert.ToInt64(value);
+                                                }
                                                 else if (ParameterType == "Int64[]")
                                                 {
                                                     value = Tools.SpitLongArrary(Newtonsoft.Json.JsonConvert.SerializeObject(value).Replace("[", "").Replace("]", "").Trim('"'), ',');

BIN
Model/.DS_Store


+ 41 - 0
Model/Dto/ApiInfoSetRouterDto.cs

@@ -0,0 +1,41 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Model.Base;
+
+namespace Dto
+{
+    /// <summary>
+    /// 设置请求地址
+    /// </summary>
+    public class ApiInfoSetRouterDto
+    {
+        /// <summary>
+        /// 接口主机头
+        /// </summary>
+        [Required(ErrorMessage = "接口主机头不能为空")]
+        public string? apiHost { get; set; }
+
+
+        /// <summary>
+        /// 接口端口号
+        /// </summary>
+        [Required(ErrorMessage = "接口端口号不能为空")]
+        public int apiPort { get; set; }
+
+
+        /// <summary>
+        /// 接口路由
+        /// </summary>
+        [Required(ErrorMessage = "接口路由不能为空")]
+        public string? apiRouter { get; set; }
+
+
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+
+    }
+}

+ 26 - 0
Model/Dto/ApiInfoSetVersionDto.cs

@@ -0,0 +1,26 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Model.Base;
+
+namespace Dto
+{
+    /// <summary>
+    /// 设置版本号
+    /// </summary>
+    public class ApiInfoSetVersionDto
+    {
+        /// <summary>
+        /// ID
+        /// </summary>
+        public int id { get; set; }
+
+
+        /// <summary>
+        /// 版本号
+        /// </summary>
+        public int version { get; set; }
+
+
+
+    }
+}

BIN
Services/.DS_Store


+ 6 - 2
Services/ApiInfoService.cs

@@ -21,7 +21,7 @@ namespace Services
         /// </summary>
         /// <param name="parm">请求参数</param>
         /// <returns>api接口列表</returns>
-        public PagedInfo<ApiInfoListVo> List([FromQuery] ApiInfoListDto parm)
+        public PagedInfo<ApiInfoListVo> List([FromQuery] PagerInfo page, [FromQuery] ApiInfoListDto parm)
         {
             //开始拼装查询条件
             var predicate = Expressionable.Create<ApiInfo>();
@@ -31,7 +31,7 @@ namespace Services
                 .Where(predicate.ToExpression())
                 .OrderByDescending(m => m.id)
                 .Includes(m => m.apiGroupJoin)
-                .ToPage<ApiInfo, ApiInfoListVo>(new PagerInfo());
+                .ToPage<ApiInfo, ApiInfoListVo>(page);
             return response;
         }
 
@@ -47,5 +47,9 @@ namespace Services
 
 
 
+
+
+
+
     }
 }

+ 5 - 1
Services/IService/IApiInfoService.cs

@@ -13,7 +13,11 @@ namespace Services
         /// </summary>
         /// <param name="parm">请求参数</param>
         /// <returns>api接口列表</returns>
-        PagedInfo<ApiInfoListVo> List([FromQuery] ApiInfoListDto parm);
+        PagedInfo<ApiInfoListVo> List([FromQuery] PagerInfo page, [FromQuery] ApiInfoListDto parm);
+
+
+
+