|
@@ -41,28 +41,40 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
|
|
|
[ApiToken(Auth = "1302", Name = "课程详细信息", RWN = "N")]
|
|
|
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)) {
|
|
|
-
|
|
|
-
|
|
|
+ (string school, List < BusinessConfig > businessConfigs ,GroupChange data) = await GetRequestData<GroupChange>(request);
|
|
|
+ if (string.IsNullOrWhiteSpace(school)) {
|
|
|
+
|
|
|
}
|
|
|
return response;
|
|
|
}
|
|
|
- public async Task<(string school, T data)> GetRequestData<T>(HttpRequestData request)
|
|
|
+ public async Task<(string school, List<BusinessConfig> businessConfigs, 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;
|
|
|
+ List<BusinessConfig> businessConfigs = null ;
|
|
|
if (json.TryGetProperty("school", out JsonElement _school))
|
|
|
{
|
|
|
school = _school.GetString();
|
|
|
+ var table = _azureStorage.GetCloudTableClient().GetTableReference("IESOpenApi");
|
|
|
+ List<BusinessSchool> schools = table.FindListByDictSync<BusinessSchool>(new Dictionary<string, object> { { "PartitionKey", $"BusinessSchool" }, { "school", school } });
|
|
|
+ var bizid = schools.Select(x => x.bizid).ToList();
|
|
|
+ List<string> Codes = new List<string>();
|
|
|
+ bizid.ForEach(x => {
|
|
|
+ Codes.Add($" RowKey {QueryComparisons.Equal} '{x}' ");
|
|
|
+ });
|
|
|
+ string tbqurey = $"PartitionKey {QueryComparisons.Equal} 'BusinessConfig' and ( {string.Join(" or ", Codes)} ) ";
|
|
|
+ var result = await table.ExecuteQuerySegmentedAsync(new TableQuery<BusinessConfig>().Where(tbqurey), null);
|
|
|
+ if (result != null) {
|
|
|
+ businessConfigs= result.Results;
|
|
|
+ }
|
|
|
}
|
|
|
if (json.TryGetProperty("data", out JsonElement _data))
|
|
|
{
|
|
|
- return (school, _data.ToObject<T>());
|
|
|
+ return (school, businessConfigs, _data.ToObject<T>());
|
|
|
}
|
|
|
- else { return (school,default(T)); }
|
|
|
+ else { return (school, businessConfigs, default(T)); }
|
|
|
}
|
|
|
}
|
|
|
|