Browse Source

update .完善监护人。

CrazyIter_Bin 2 năm trước cách đây
mục cha
commit
bc4a420079

+ 6 - 1
TEAMModelOS.SDK/Models/Cosmos/Student/Student.cs

@@ -64,7 +64,8 @@ namespace TEAMModelOS.SDK.Models
     }
     public class Guardian : CosmosEntity
     {
-        // id = tmdid
+        //存 Student表
+        // id = uuid
         // code = "Base-Guardian"
 
         //绑定信息的key(手机号,邮箱,醍摩豆id)
@@ -103,6 +104,10 @@ namespace TEAMModelOS.SDK.Models
         /// 学生所在的学校
         /// </summary>
         public string code { get; set; }
+        /// <summary>
+        /// 是否认证通过 0 默认,未通过,1 通过 。
+        /// </summary>
+        public int auth { get; set; } = 0;
     }
     public class StudentGuardian
     {

+ 14 - 0
TEAMModelOS.SDK/Models/Service/StudentService.cs

@@ -862,6 +862,20 @@ namespace TEAMModelOS.SDK
                             }
                             tmpStudInfo.picture = student.picture;
                             if (!string.IsNullOrWhiteSpace(stud.Value.gPhone)) {
+                                List<Guardian> guardians = new List<Guardian>();
+                                string sql = $"select distinct value (c) from c   where  c.mobile='{stud.Value.gPhone}' ";
+                                await foreach (var item in cosmosContainer.GetItemQueryIterator<Guardian>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base-Guardian") })) {
+                                    guardians.Add(item);
+                                }
+                                if (guardians.Any())
+                                {
+                                    guardians.ForEach(x => {
+                                        GuardianStudent guardianStudent =  x.students.Find(s => s.id.Equals("stud.Key")  && s.code.Equals("schoolId"));
+                                    });
+                                }
+                                else { 
+                                
+                                }
                                 var guardian = student.guardians.Find(x => !string.IsNullOrWhiteSpace(x.mobile) && x.mobile.Equals(stud.Value.gPhone));
                                 if (guardian != null)
                                 {

+ 15 - 0
TEAMModelOS/Controllers/Client/AClassONEController.cs

@@ -89,5 +89,20 @@ namespace TEAMModelOS.Controllers
                 return BadRequest(Content);
             }
         }
+
+
+        /// <summary>
+        /// js_code获取小程序用户信息
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("get-students-phone")]
+        //[Authorize(Roles = "AClassONE")]
+        public async Task<IActionResult> GetStudentsByPhone(JsonElement json)
+        {
+            string sql = "";
+            return Ok();
+        }
     }
 }

TEAMModelOS/Controllers/OpenApi/Business/OpenApiConfigController.cs → TEAMModelOS/Controllers/OpenApi/Init/OpenApiConfigController.cs


+ 10 - 10
TEAMModelOS/Controllers/OpenApi/OpenApiService.cs

@@ -97,11 +97,11 @@ namespace TEAMModelOS.Controllers
         public static async Task<ResponseData<dynamic>> GetLessonRecordCount(AzureCosmosFactory _azureCosmos, IConfiguration _configuration, AzureServiceBusFactory _serviceBus,
            Option _option, DingDing _dingDing, string id, string school, JsonElement json)
         {
-            json.TryGetProperty("roles", out JsonElement _roles);
-            List<string> roles = new List<string>();
-            if (_roles.ValueKind.Equals(JsonValueKind.Array))
+            json.TryGetProperty("identity", out JsonElement _identity);
+            string identity = "";
+            if (!string.IsNullOrWhiteSpace($"{_identity}"))
             {
-                roles = _roles.ToJsonString().ToObject<List<string>>();
+                identity = $"{_identity}";
             }
             json.TryGetProperty("managePage", out JsonElement _managePage);
             bool managePage = false;
@@ -147,7 +147,7 @@ namespace TEAMModelOS.Controllers
             int count = 0;
 
             string sqlShow = "";
-            if (roles.Count == 1 && roles.Contains("student"))
+            if (identity.Equals("student"))
             {
                 string autoSql = "";
                 if (autoTch.Any())
@@ -235,11 +235,11 @@ namespace TEAMModelOS.Controllers
            Option _option,  DingDing _dingDing, string id, string school, JsonElement json)
         {
 
-            json.TryGetProperty("roles", out JsonElement _roles);
-            List<string> roles = new List<string>();
-            if (_roles.ValueKind.Equals(JsonValueKind.Array))
+            json.TryGetProperty("identity", out JsonElement _identity);
+            string identity = "";
+            if (!string.IsNullOrWhiteSpace($"{_identity}"))
             {
-                roles = _roles.ToJsonString().ToObject<List<string>>();
+                identity =$"{_identity}";
             }
            
             json.TryGetProperty("managePage", out JsonElement _managePage);
@@ -313,7 +313,7 @@ namespace TEAMModelOS.Controllers
             try
             {
                 string sqlShow = "";
-                if (roles.Count == 1 && roles.Contains("student"))
+                if (identity.Equals("student"))
                 {
                     string autoSql = "";
                     if (autoTch.Any())