|
@@ -102,5 +102,73 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 处理传过来的信息加入到统计信息中
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="req"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Function("set-scstats-type")]
|
|
|
+ public async Task<HttpResponseData> SetSchoolStatsType([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestData req)
|
|
|
+ {
|
|
|
+ var response = req.CreateResponse(HttpStatusCode.OK);
|
|
|
+ dynamic jsondata = new ExpandoObject();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ string scId = null,type = null;
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+ var tableClient = _azureStorage.GetCloudTableClient();
|
|
|
+ var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
|
+ string data = await new StreamReader(req.Body).ReadToEndAsync();
|
|
|
+ var json = JsonDocument.Parse(data).RootElement;
|
|
|
+ jsondata = json;
|
|
|
+ if (json.TryGetProperty("schoolId", out JsonElement _schoolId))
|
|
|
+ {
|
|
|
+ scId = $"{_schoolId}";
|
|
|
+ }
|
|
|
+ if (json.TryGetProperty("type", out JsonElement _type))
|
|
|
+ {
|
|
|
+ type = $"{_type}";
|
|
|
+ }
|
|
|
+ if (string.IsNullOrEmpty(scId) && string.IsNullOrEmpty(scId))
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"set-scstats-type, {req.Body};转换后:{json}", GroupNames.成都开发測試群組);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch ($"{type}")
|
|
|
+ {
|
|
|
+ case "Exam":
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "Survey":
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "Vote":
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "Homework":
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "Less":
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"stats-sc-info,{ex.Message}\n{ex.StackTrace}\n{jsondata.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
+ }
|
|
|
+
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|