黄贺彬 3 달 전
부모
커밋
2aeef329e5

+ 3 - 3
TEAMModelOS.SDK/Models/Service/EvaluationSyncInfoService.cs

@@ -426,7 +426,7 @@ namespace TEAMModelOS.SDK.Models.Service
                 evaluationSyncInfo.blobSize = blobSize;
                 evaluationSyncInfo.blobCount = blobCount;
                 evaluationSyncInfo.blobLastHash = evaluationSyncInfo.blobHash;
-                evaluationSyncInfo.blobHash = ShaHashHelper.GetSHA1(string.Join("-", evaluationSyncInfo.subjects.SelectMany(x => x.papers).Select(x => x.paperHash)));
+                evaluationSyncInfo.blobHash = ShaHashHelper.GetSHA1(string.Join("-", evaluationSyncInfo.subjects.SelectMany(x => x.papers).Select(x => x.paperHash).OrderBy(x=>x)));
                 evaluationSyncInfo.dataTime = dataTime.Value;
                 evaluationSource.updateTime = dataTime.Value;
                 var groupList = new { members = listInfo.rmembers, groupList = listInfo.groups };
@@ -460,10 +460,10 @@ namespace TEAMModelOS.SDK.Models.Service
                     dataStr.Append(evaluationSyncInfo.shortCode);
                     dataStr.Append(evaluationSyncInfo.openCode);
                     dataStr.Append($"{stime}{etime}");
-                    dataStr.Append(string.Join("", order.Select(x=>x.subjectId)));
+                    dataStr.Append(string.Join("", order.Select(x=>x.subjectId).OrderBy(x=>x)));
                     if (evaluationSyncInfo.music!=null)
                     {
-                        dataStr.Append($"{evaluationSyncInfo.music.questionId}{string.Join("", evaluationSyncInfo.music.mustSong?.Select(x=>x.songId))}{string.Join("",evaluationSyncInfo.music.optionSong?.Select(x=>x.songId))}");
+                        dataStr.Append($"{evaluationSyncInfo.music.questionId}{string.Join("", evaluationSyncInfo.music.mustSong?.Select(x=>x.songId).OrderBy(x=>x))}{string.Join("",evaluationSyncInfo.music.optionSong?.Select(x=>x.songId).OrderBy(x=>x))}");
                     }
                     //计算dataHash
                     evaluationSyncInfo.dataHash = ShaHashHelper.GetSHA1(dataStr.ToString());

+ 21 - 10
TEAMModelOS/Controllers/Client/AClassONEController.cs

@@ -166,14 +166,14 @@ namespace TEAMModelOS.Controllers
                 //phoneInfo.code=200;
                 if (phoneInfo.code==200)
                 {
-                     string _mobile = phoneInfo.phone.phoneNumber;
-                    //string _mobile = "18281911681";
+                   // string _mobile = phoneInfo.phone.phoneNumber;
+                    string _mobile = "13880505117";
                     var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{_mobile}" } }, _option.Location, _configuration);
                     if (coreUser != null && coreUser.id != null)
                     {
                         (string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
                         Teacher teacher = null;
-                        TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}",timezone);
+                        TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}", timezone);
                         return Ok(new
                         {
                             teacherInfo.auth_token,
@@ -185,8 +185,13 @@ namespace TEAMModelOS.Controllers
                     }
                     else return Ok(new { state = 404, msg = "未找到关联账号" });
                 }
-            } catch (Exception ex) { }
-            return Ok();
+                else {
+                  return Ok(new { state = phoneInfo.code, msg = phoneInfo.msg });
+                }
+            } catch (Exception ex) {
+                return Ok(new { state = 500, msg = ex.Message });
+            }
+            
         }
         /// <summary>
         /// 获取学校信息
@@ -925,7 +930,7 @@ namespace TEAMModelOS.Controllers
                 }
                 else
                 {
-                    return BadRequest("手机授权码过期!");
+                    return BadRequest($"手机授权码过期!{phoneInfo.code},{phoneInfo.msg}");
                 }
             }
             catch (Exception ex)
@@ -1334,7 +1339,7 @@ namespace TEAMModelOS.Controllers
             yield return (code, value);
         }
 
-        private async Task<(int code, WeChatPhone phone)> GetWeChatPhoneNumber(string phoneCode) 
+        private async Task<(int code, WeChatPhone phone,string msg )> GetWeChatPhoneNumber(string phoneCode) 
         {
             var wxappid = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:appid");
             var wxsecret = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:secret");
@@ -1350,7 +1355,8 @@ namespace TEAMModelOS.Controllers
             HttpContent contentPhone = new StringContent(dict.ToJsonString(), Encoding.UTF8, "application/json");
             var httpResponse = await _httpClient.CreateClient().PostAsync(url, contentPhone);
             WeChatPhone phone = null;
-            int code = 200; 
+            int code = 200;
+            string msg = "";
             if (httpResponse.StatusCode == HttpStatusCode.OK)
             {
                 string responseContent = await httpResponse.Content.ReadAsStringAsync();
@@ -1359,16 +1365,21 @@ namespace TEAMModelOS.Controllers
                 if (phone==null)
                 {
                     code = 404;
+                    msg=$"{responseContent}";
+                }
+                else {
+                    code = 200;msg=$"{responseContent}"; 
                 }
-                else { code = 200; }
             }
             else
             {
                 //微信找到。
                 code = 404;
+                msg=  await httpResponse.Content.ReadAsStringAsync();
+
             }
 
-            return (code, phone);
+            return (code, phone, msg);
         }
 
 

+ 113 - 0
TEAMModelOS/Properties/ServiceDependencies/teammodelos-test - Web Deploy/profile.arm.json

@@ -0,0 +1,113 @@
+{
+  "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
+  "contentVersion": "1.0.0.0",
+  "metadata": {
+    "_dependencyType": "compute.appService.windows"
+  },
+  "parameters": {
+    "resourceGroupName": {
+      "type": "string",
+      "defaultValue": "TEAMModelChengdu",
+      "metadata": {
+        "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
+      }
+    },
+    "resourceGroupLocation": {
+      "type": "string",
+      "defaultValue": "",
+      "metadata": {
+        "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
+      }
+    },
+    "resourceName": {
+      "type": "string",
+      "defaultValue": "test",
+      "metadata": {
+        "description": "Name of the main resource to be created by this template."
+      }
+    },
+    "resourceLocation": {
+      "type": "string",
+      "defaultValue": "[parameters('resourceGroupLocation')]",
+      "metadata": {
+        "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
+      }
+    }
+  },
+  "variables": {
+    "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+    "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
+  },
+  "resources": [
+    {
+      "type": "Microsoft.Resources/resourceGroups",
+      "name": "[parameters('resourceGroupName')]",
+      "location": "[parameters('resourceGroupLocation')]",
+      "apiVersion": "2019-10-01"
+    },
+    {
+      "type": "Microsoft.Resources/deployments",
+      "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+      "resourceGroup": "[parameters('resourceGroupName')]",
+      "apiVersion": "2019-10-01",
+      "dependsOn": [
+        "[parameters('resourceGroupName')]"
+      ],
+      "properties": {
+        "mode": "Incremental",
+        "template": {
+          "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+          "contentVersion": "1.0.0.0",
+          "resources": [
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[parameters('resourceName')]",
+              "type": "Microsoft.Web/sites",
+              "apiVersion": "2015-08-01",
+              "tags": {
+                "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
+              },
+              "dependsOn": [
+                "[variables('appServicePlan_ResourceId')]"
+              ],
+              "kind": "app",
+              "properties": {
+                "name": "[parameters('resourceName')]",
+                "kind": "app",
+                "httpsOnly": true,
+                "reserved": false,
+                "serverFarmId": "[variables('appServicePlan_ResourceId')]",
+                "siteConfig": {
+                  "metadata": [
+                    {
+                      "name": "CURRENT_STACK",
+                      "value": "dotnetcore"
+                    }
+                  ]
+                }
+              },
+              "identity": {
+                "type": "SystemAssigned"
+              }
+            },
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[variables('appServicePlan_name')]",
+              "type": "Microsoft.Web/serverFarms",
+              "apiVersion": "2015-08-01",
+              "sku": {
+                "name": "S1",
+                "tier": "Standard",
+                "family": "S",
+                "size": "S1"
+              },
+              "properties": {
+                "name": "[variables('appServicePlan_name')]"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ]
+}