فهرست منبع

调整结构。

CrazyIter_Bin 3 سال پیش
والد
کامیت
cc188b221e
2فایلهای تغییر یافته به همراه39 افزوده شده و 4 حذف شده
  1. 29 2
      TEAMModelOS.FunctionV4/HttpTrigger/WebhookHttpTrigger.cs
  2. 10 2
      TEAMModelOS.SDK/Models/Table/BusinessConfig.cs

+ 29 - 2
TEAMModelOS.FunctionV4/HttpTrigger/WebhookHttpTrigger.cs

@@ -39,10 +39,37 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
         }
         [Function("group-change")]
         [ApiToken(Auth = "1302", Name = "课程详细信息", RWN = "N")]
-        public async Task<HttpResponseData> NoticeGroupChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "webhook/group-change")] HttpRequestData req) {
-            var response = req.CreateResponse(HttpStatusCode.OK);
+        public async Task<HttpResponseData> NoticeGroupChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "webhook/group-change")] HttpRequestData request) {
+            var response = request.CreateResponse(HttpStatusCode.OK);
+            (string school, GroupChange data) = await  GetRequestData<GroupChange>(request);
+            if (string.IsNullOrWhiteSpace(school)) { 
+            
 
+            }
             return response;
         }
+        public async Task<(string school, T data)> GetRequestData<T>(HttpRequestData request)
+        {
+            var response = request.CreateResponse(HttpStatusCode.OK);
+            string data = await new StreamReader(request.Body).ReadToEndAsync();
+            var json = JsonDocument.Parse(data).RootElement;
+            string school = null;
+            if (json.TryGetProperty("school", out JsonElement _school))
+            {
+                school = _school.GetString();
+            }
+            if (json.TryGetProperty("data", out JsonElement _data))
+            {
+                return (school, _data.ToObject<T>());
+            }
+            else { return (school,default(T)); }
+        }
     }
+   
+
+    public class WebhookSchoolData { 
+        public string school { get; set; }
+        public string data { get; set; }
+    }
+
 }

+ 10 - 2
TEAMModelOS.SDK/Models/Table/BusinessConfig.cs

@@ -10,10 +10,18 @@ namespace TEAMModelOS.SDK.Models.Table
 {
     [TableName(Name = "IESOpenApi")]
     public class BusinessSchool : TableEntity {
-        // RowKey  schoolId ,
-        // PartitionKey :BusinessSchool-企业id
+        // RowKey  雪花id  ,
+        // PartitionKey :BusinessSchool
         public string name { get; set; }
         public string picture { get; set; }
+        /// <summary>
+        /// 学校id
+        /// </summary>
+        public string school { get; set; }
+        /// <summary>
+        /// 企业id
+        /// </summary>
+        public string bizid { get; set; }
 
     }