소스 검색

api 接口描述信息 自动生成。

CrazyIter_Bin 3 년 전
부모
커밋
74c5131669
2개의 변경된 파일8개의 추가작업 그리고 17개의 파일을 삭제
  1. 1 1
      TEAMModelAPI/Controllers/School/SchoolController.cs
  2. 7 16
      TEAMModelAPI/Startup.cs

+ 1 - 1
TEAMModelAPI/Controllers/School/SchoolController.cs

@@ -58,7 +58,7 @@ namespace TEAMModelAPI.Controllers
         /// <param name="request"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [HttpGet("get-school-info")]
+        [HttpPost("get-school-info")]
         [ApiToken(Auth = "1001",Name = "学校基础信息", RW = "R", Limit =false)]
         public async Task<IActionResult> GetSchoolInfo()
         {

+ 7 - 16
TEAMModelAPI/Startup.cs

@@ -120,20 +120,6 @@ namespace TEAMModelAPI
             //在开发模式时,自检 [ApiToken(Auth = "1")] 有重复的接口 https://teammodelos.table.core.chinacloudapi.cn/IESOpenApi
             List<ApiTokenAttribute> auths = new List<ApiTokenAttribute>();
             (List < OpenApi > openApis ,List<Attribute> attributes  ) = ReflectorExtensions.GetMethodCustomAttribute<ApiTokenAttribute, HttpPostAttribute>(new string[] { "TEAMModelAPI" });
-            attributes.ForEach(x => {
-                ApiTokenAttribute attribute = (ApiTokenAttribute)x;
-                openApis.Add(new OpenApi { 
-                    PartitionKey="IES5-API",
-                    RowKey= attribute.Auth,
-                    auth=int.Parse(attribute.Auth),
-                   // descr=attribute.Name,
-                   method="POST",
-                   name=attribute.Name,
-                    
-                });
-                auths.Add(attribute);
-            });
-          
             auths.GroupBy(x => x.Auth).ToList().ForEach(x => {
                 if (x.Count() > 1) 
                 { 
@@ -142,8 +128,13 @@ namespace TEAMModelAPI
             });
 
             var table =  azureStorage.GetCloudTableClient().GetTableReference("IESOpenApi");
-            foreach (var item in openApis) {
-                await table.SaveOrUpdate<OpenApi>(item);
+            try {
+                foreach (var item in openApis)
+                {
+                    await table.SaveOrUpdate<OpenApi>(item);
+                }
+            } catch (Exception ex) {
+                Console.WriteLine(ex.Message);
             }
 #endif
         }