Преглед изворни кода

优化IES5登录人数信息记录

Li пре 3 година
родитељ
комит
ac89b6a54f

+ 1 - 1
TEAMModelBI/Controllers/BITest/Ies5TestController.cs

@@ -59,7 +59,7 @@ namespace TEAMModelBI.Controllers.BITest
            long now = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
             var cosmosClient = _azureCosmos.GetCosmosClient();
            List<LoginInfo> loginInfos = new() { new LoginInfo (){ time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),ip="172.54.81.101",expire = expire } };
-            var tets = await LoginService.DoLoginInfo(loginInfos: loginInfos, school: "hbcn", scope: "teacher", id: "1636016499", ip: "172.168.52.102", _azureRedis, _azureStorage, cosmosClient, expire: 1);
+            var tets = await LoginService.DoLoginInfo(loginInfos: loginInfos, school: "hbcn", scope: "teacher", id: "1636016499", ip: "172.168.52.102", _azureRedis, _azureStorage, expire: 1);
            return Ok(new { state = 200, dateHours, dateHours1, dateHours2, dateDay,dateDays, dateMonth, });
         }
 

+ 1 - 1
TEAMModelOS.SDK/Models/Service/Common/TeacherService.cs

@@ -278,7 +278,7 @@ namespace TEAMModelOS.Services
             var auth_token = JwtAuthExtension.CreateAuthToken(_option.HostName, id, name?.ToString(), picture?.ToString(), _option.JwtSecretKey, Website: "IES", scope: Constant.ScopeTeacher, standard: areaa != null ? areaa.standard : "", roles: roles.ToArray(), expire: 1);
 
             //用户在线记录
-            teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, "", Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+            teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, defaultschool, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
 
             await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
             //取得Teacher Blob 容器位置及SAS 

+ 127 - 116
TEAMModelOS.SDK/Models/Service/LoginService.cs

@@ -29,7 +29,7 @@ namespace TEAMModelOS.SDK.Models.Service
         /// <param name="expire">到期时间</param>
         /// <param name="region">上次登录地址</param>
         /// <returns></returns>
-        public static async Task<List<LoginInfo>> DoLoginInfo(List<LoginInfo> loginInfos, string school, string scope, string id, string ip, AzureRedisFactory _azureRedis, AzureStorageFactory _azureStorage, CosmosClient client ,int expire =1, string region = null)
+        public static async Task<List<LoginInfo>> DoLoginInfo(List<LoginInfo> loginInfos, string school, string scope, string id, string ip, AzureRedisFactory _azureRedis, AzureStorageFactory _azureStorage, int expire = 1, string region = null)
         {
             var table = _azureStorage.GetCloudTableClient().GetTableReference("IESLogin");
             DateTimeOffset dateTime = DateTimeOffset.UtcNow;
@@ -55,35 +55,130 @@ namespace TEAMModelOS.SDK.Models.Service
             }
             else
                 loginInfos = new List<LoginInfo> { new LoginInfo { expire = Expire, ip = ip, time = now } };
-            
+
+            await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateDay}", $"{currentHour}", 1);//一天24小时
+            await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateMonth}", $"{currentDay}", 1); //当天的累计
+
+            var resDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateDay}");
+            if (resDay == null)
+            {
+                await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateDay}", hour);  //设置到期时间
+            }
+
+            var rspMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateMonth}");
+            if (rspMonth == null)
+            {
+                await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateMonth}", month);  //设置到期时间
+            }
+
+            ////查询Redis是否有值
+            //var dayCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateDay}");
+            //List<dynamic> dayCounts = new();
+            //if (dayCnt != null && dayCnt.Length > 0)
+            //{
+            //    foreach (var hourCnt in dayCnt)
+            //    {
+            //        dayCounts.Add(new { code = hourCnt.Element.ToString(), count = (int)hourCnt.Score });
+            //    }
+            //}
+
+            //var monthCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateMonth}");
+            //List<dynamic> monthCounts = new();
+            //if (monthCnt != null && monthCnt.Length > 0)
+            //{
+            //    foreach (var mCnt in monthCnt)
+            //    {
+            //        monthCounts.Add(new { code = mCnt.Element.ToString(), count = (int)mCnt.Score });
+            //    }
+            //}
+
+            //保存当天没小时的峰值
+            HourLogin hourLogin = new() { PartitionKey = $"HourLogin", RowKey = now.ToString(), Hour = int.Parse(dateHour) };
+            if (scope.Equals("teacher"))
+            {
+                hourLogin.Teacher = int.Parse(id);
+                hourLogin.Student = 0;
+                hourLogin.TmdUser = 0;
+            }
+            else if (scope.Equals("student"))
+            {
+                hourLogin.Teacher = 0;
+                hourLogin.Student = int.Parse(id);
+                hourLogin.TmdUser = 0;
+            }
+            else
+            {
+                hourLogin.Teacher = 0;
+                hourLogin.Student = 0;
+                hourLogin.TmdUser = int.Parse(id);
+            }
+            try
+            {
+                await table.SaveOrUpdate<HourLogin>(hourLogin);//保存在线数据
+            }
+            catch
+            {
+            }
+
+            //保存当月每天的峰值
+            DayLogin dayLogin = new() { PartitionKey = $"DayLogin", RowKey = now.ToString(), Day = int.Parse(dateDay) };
+            if (scope.Equals("teacher"))
+            {
+                dayLogin.Teacher = int.Parse(id);
+                dayLogin.Student = 0;
+                dayLogin.TmdUser = 0;
+            }
+            else if (scope.Equals("student"))
+            {
+                dayLogin.Teacher = 0;
+                dayLogin.Student = int.Parse(id);
+                dayLogin.TmdUser = 0;
+            }
+            else
+            {
+                dayLogin.Teacher = 0;
+                dayLogin.Student = 0;
+                dayLogin.TmdUser = int.Parse(id);
+            }
+
+            await table.SaveOrUpdate<DayLogin>(dayLogin);//保存在线数据
+
             if (!string.IsNullOrWhiteSpace(school))
             {
                 await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:School:{school}:{scope}:{dateDay}", $"{currentHour}", 1);//当天当前小时在线人加1
                 await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:School:{school}:{scope}:{dateMonth}", $"{currentDay}", 1); //当天的在线加1
 
-                var resDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateDay}");
-                if (resDay == null)
+                var reScDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateDay}");
+                if (reScDay == null)
                 {
                     await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:School:{school}:{scope}:{dateDay}", hour);  //设置到期时间
-
                 }
 
-                var rspMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateMonth}");
-                if (rspMonth != null)
+                var reScMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateMonth}");
+                if (reScMonth != null)
                 {
                     await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:School:{school}:{scope}:{dateMonth}", month);  //设置到期时间
                 }
 
-
-                var scDay = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateDay}");
-                List<dynamic> scDayCount = new();
-                if (scDay != null && scDay.Length > 0)
-                {
-                    foreach (var count in scDay)
-                    {
-                        scDayCount.Add(new { code = count.Element.ToString(), count = (int)count.Score });
-                    }
-                }
+                ////查询Redis是否有值
+                //var scDayCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateDay}");
+                //List<dynamic> scDayCounts = new();
+                //if (scDayCnt != null && scDayCnt.Length > 0)
+                //{
+                //    foreach (var itemHour in scDayCnt)
+                //    {
+                //        scDayCounts.Add(new { code = itemHour.Element.ToString(), count = (int)itemHour.Score });
+                //    }
+                //}
+                //var ScMonth = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateMonth}");
+                //List<dynamic> scMonthCount = new();
+                //if (ScMonth != null && ScMonth.Length > 0)
+                //{
+                //    foreach (var count in ScMonth)
+                //    {
+                //        scMonthCount.Add(new { code = count.Element.ToString(), count = (int)count.Score });
+                //    }
+                //}
 
                 //学校小时峰值
                 HourLoginSchool hourLoginSc = new() { PartitionKey = $"HourLogin-{school}", RowKey = now.ToString(), Hour = int.Parse(dateHour), School = school };
@@ -91,11 +186,19 @@ namespace TEAMModelOS.SDK.Models.Service
                 {
                     hourLoginSc.Teacher = int.Parse(id);
                     hourLoginSc.Student = 0;
+                    hourLoginSc.TmdUser = 0;
                 }
                 else if (scope.Equals("student"))
                 {
                     hourLoginSc.Teacher = 0;
                     hourLoginSc.Student = int.Parse(id);
+                    hourLoginSc.TmdUser = 0;
+                }
+                else
+                {
+                    hourLoginSc.Teacher = 0;
+                    hourLoginSc.Student = 0;
+                    hourLoginSc.TmdUser = int.Parse(id);
                 }
 
                 try
@@ -106,126 +209,34 @@ namespace TEAMModelOS.SDK.Models.Service
                 {                    
                 }
 
-                var ScMonth = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateMonth}");
-                List<dynamic> scMonthCount = new();
-                if (ScMonth != null && ScMonth.Length > 0)
-                {
-                    foreach (var count in ScMonth)
-                    {
-                        scMonthCount.Add(new { code = count.Element.ToString(), count = (int)count.Score });
-                    }
-                }
-
                 //学校天峰值
                 DayLoginSchool dayLoginSc = new() { PartitionKey = $"DayLogin-{school}", RowKey = now.ToString(), Day = int.Parse(dateDay), School = school };
                 if (scope.Equals("teacher"))
                 {
                     dayLoginSc.Teacher = int.Parse(id);
                     dayLoginSc.Student = 0;
+                    dayLoginSc.TmdUser = 0;
                 }
                 else if (scope.Equals("student"))
                 {
                     dayLoginSc.Teacher = 0;
                     dayLoginSc.Student = int.Parse(id);
-                }
-
-                try
-                {
-                    await table.SaveOrUpdate<DayLoginSchool>(dayLoginSc);//保存在线数据
-                }
-                catch
-                {
-                }
-            }
-            else 
-            {
-                await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateDay}", $"{currentHour}", 1);//一天24小时
-                await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateMonth}", $"{currentDay}", 1); //当天的累计
-
-                var resDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateDay}");
-                if (resDay == null)
-                {
-                    await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateDay}", hour);  //设置到期时间
-                }
-
-                var rspMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateMonth}");
-                if (rspMonth == null)
-                {
-                    await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateMonth}", month);  //设置到期时间
-                }
-
-                var scDay = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateDay}");
-                List<dynamic> scDayCount = new();
-                if (scDay != null && scDay.Length > 0)
-                {
-                    foreach (var count in scDay)
-                    {
-                        scDayCount.Add(new { code = count.Element.ToString(), count = (int)count.Score });
-                    }
-                }
-
-                var ScMonth = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateMonth}");
-                List<dynamic> scMonthCount = new();
-                if (ScMonth != null && ScMonth.Length > 0)
-                {
-                    foreach (var count in ScMonth)
-                    {
-                        scMonthCount.Add(new { code = count.Element.ToString(), count = (int)count.Score });
-                    }
-                }
-
-                //个人或者TMDuser小时峰值
-                HourLogin hourLogin = new() { PartitionKey = $"HourLogin", RowKey = now.ToString(), Hour = int.Parse(dateHour) };
-                if (scope.Equals("teacher"))
-                {
-                    hourLogin.Teacher = int.Parse(id);
-                    hourLogin.Student = 0;
-                    hourLogin.TmdUser = 0;
-                }
-                else if (scope.Equals("student"))
-                {
-                    hourLogin.Teacher = 0;
-                    hourLogin.Student = int.Parse(id);
-                    hourLogin.TmdUser = 0;
+                    dayLoginSc.TmdUser = 0;
                 }
                 else
                 {
-                    hourLogin.Teacher = 0;
-                    hourLogin.Student = 0;
-                    hourLogin.TmdUser = int.Parse(id);
+                    dayLoginSc.Teacher = 0;
+                    dayLoginSc.Student = 0;
+                    dayLoginSc.TmdUser = int.Parse(id);
                 }
+
                 try
                 {
-                    await table.SaveOrUpdate<HourLogin>(hourLogin);//保存在线数据
-
+                    await table.SaveOrUpdate<DayLoginSchool>(dayLoginSc);//保存在线数据
                 }
                 catch
                 {
                 }
-
-                //个人或者TMDuser天峰值
-                DayLogin dayLogin = new() { PartitionKey = $"DayLogin", RowKey = now.ToString(), Day = int.Parse(dateDay) };
-                if (scope.Equals("teacher"))
-                {
-                    dayLogin.Teacher = int.Parse(id);
-                    dayLogin.Student = 0;
-                    dayLogin.TmdUser = 0;
-                }
-                else if (scope.Equals("student"))
-                {
-                    dayLogin.Teacher = 0;
-                    dayLogin.Student = int.Parse(id);
-                    dayLogin.TmdUser = 0;
-                }
-                else
-                {
-                    dayLogin.Teacher = 0;
-                    dayLogin.Student = 0;
-                    dayLogin.TmdUser = int.Parse(id);
-                }
-
-                    await table.SaveOrUpdate<DayLogin>(dayLogin);//保存在线数据
-
             }
 
             return loginInfos;

+ 3 - 1
TEAMModelOS.SDK/Models/Table/IESLogin.cs

@@ -109,6 +109,7 @@ namespace TEAMModelOS.SDK.Models.Table
         public int Day { get; set; }
         public int Teacher { get; set; }
         public int Student { get; set; }
+        public int TmdUser { get; set; }
         public string School { get; set; }
     }
 
@@ -131,7 +132,8 @@ namespace TEAMModelOS.SDK.Models.Table
         /// </summary>
         public int Hour { get; set; }
         public int Teacher { get; set; }
-        public int Student { get; set; }       
+        public int Student { get; set; }
+        public int TmdUser { get; set; }
         public string School { get; set; }
     }
 }

+ 1 - 1
TEAMModelOS/Controllers/Client/HiScanController.cs

@@ -120,7 +120,7 @@ namespace TEAMModelOS.Controllers.Core
                     }
                 }
                 
-                response.loginInfos = await LoginService.DoLoginInfo(response.loginInfos, "", Constant.ScopeTeacher, $"{id}", ip, _azureRedis, _azureStorage, client, expire: 1);
+                response.loginInfos = await LoginService.DoLoginInfo(response.loginInfos, response?.defaultSchool, Constant.ScopeTeacher, $"{id}", ip, _azureRedis, _azureStorage, expire: 1);
                 try
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(response, $"{id}", new PartitionKey("Base"));

+ 1 - 1
TEAMModelOS/Controllers/Client/HiTAControlller.cs

@@ -467,7 +467,7 @@ namespace TEAMModelOS.Controllers.Client
                     //}
 
                     Teacher teacher = jsonsc.ToObject<Teacher>();
-                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, defaultschool, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, clientc, expire: 1);
+                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, defaultschool, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
                     try
                     {
                         await clientc.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));

+ 3 - 3
TEAMModelOS/Controllers/Client/HiTeachController.cs

@@ -249,7 +249,7 @@ namespace TEAMModelOS.Controllers.Client
                     }
 
                     Teacher teacher = jsonsc.ToObject<Teacher>();
-                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, defaultschool, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, defaultschool, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
                     try
                     {
                         await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
@@ -274,7 +274,7 @@ namespace TEAMModelOS.Controllers.Client
                         defaultSchool = null,
                         schools = new List<Teacher.TeacherSchool>(),
                     };
-                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, "", Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, "", Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
                     teacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<Teacher>(teacher, new PartitionKey("Base"));
                 }
 
@@ -739,7 +739,7 @@ namespace TEAMModelOS.Controllers.Client
                 try
                 {
                     Teacher teacher = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<Teacher>($"{id}", new PartitionKey("Base"));
-                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, school_code.GetString(), Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, school_code.GetString(), Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
                     await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                 }
                 catch

+ 2 - 2
TEAMModelOS/Controllers/Student/StudentController.cs

@@ -552,7 +552,7 @@ namespace TEAMModelOS.Controllers
             var auth_token = JwtAuthExtension.CreateAuthToken(_option.HostName, id, name, picture, _option.JwtSecretKey, scope: Constant.ScopeStudent, Website: "IES", areaId: areaId, schoolID: school_code, roles: new[] { "student" }, expire: 1);
 
             //用户在线记录
-            student.loginInfos = await LoginService.DoLoginInfo(student.loginInfos, school_code, Constant.ScopeStudent, id, ip, _azureRedis, _azureStorage, cosmosClient, expire: 1);
+            student.loginInfos = await LoginService.DoLoginInfo(student.loginInfos, school_code, Constant.ScopeStudent, id, ip, _azureRedis, _azureStorage, expire: 1);
 
             await cosmosClient.GetContainer("TEAMModelOS", "Student").ReplaceItemAsync<Student>(student, id, new PartitionKey($"Base-{school_code}"));
 
@@ -684,7 +684,7 @@ namespace TEAMModelOS.Controllers
                         //換取AuthToken,提供給前端
                         var auth_token = JwtAuthExtension.CreateAuthToken(_option.HostName, id.GetString(), name.GetString(), picture.GetString(), _option.JwtSecretKey, Website: "IES", areaId: schoolInfo.areaId, scope: Constant.ScopeStudent, schoolID: school_code.GetString(), roles: new[] { "student" }, expire: 1);
                         //在线人数记录
-                        student.loginInfos = await LoginService.DoLoginInfo(student.loginInfos, school_code.GetString(), Constant.ScopeStudent, id.GetString(), ip, _azureRedis, _azureStorage, client, expire: 1);
+                        student.loginInfos = await LoginService.DoLoginInfo(student.loginInfos, school_code.GetString(), Constant.ScopeStudent, id.GetString(), ip, _azureRedis, _azureStorage, expire: 1);
                         //保存学生登录信息
                         await client.GetContainer("TEAMModelOS", "Student").ReplaceItemAsync<Student>(student, student.id, new PartitionKey($"{student.code}"));
 

+ 3 - 3
TEAMModelOS/Controllers/Student/TmdUserController.cs

@@ -126,8 +126,8 @@ namespace TEAMModelOS.Controllers
                     }
                     loginInfos = tmdUser.loginInfos;
 
-                   //在线人数记录
-                   tmdUser.loginInfos = await LoginService.DoLoginInfo(tmdUser.loginInfos, Schoolid, Constant.ScopeTmdUser, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                    //在线人数记录
+                    tmdUser.loginInfos = await LoginService.DoLoginInfo(tmdUser.loginInfos, Schoolid?.ToString(), Constant.ScopeTmdUser, id, ip, _azureRedis, _azureStorage, expire: 1);
 
                    await client.GetContainer("TEAMModelOS", "Student").ReplaceItemAsync<TmdUser>(tmdUser, id, new PartitionKey("Base"));
                     //預設學校ID
@@ -152,7 +152,7 @@ namespace TEAMModelOS.Controllers
                         var container = _azureStorage.GetBlobContainerClient(id);
                         await container.CreateIfNotExistsAsync(PublicAccessType.None); //嘗試創建Teacher私有容器,如存在則不做任何事,保障容器一定存在
                         //在线人数记录
-                        teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, "", Constant.ScopeTmdUser, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                        teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, "", Constant.ScopeTmdUser, id, ip, _azureRedis, _azureStorage, expire: 1);
                         teacher = await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Student").CreateItemAsync<TmdUser>(teacher, new PartitionKey("Base"));
                     }
                 }

+ 1 - 1
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -408,7 +408,7 @@ namespace TEAMModelOS.Controllers
                     school_code = teacher.schools[0].schoolId;
                     teacher.defaultSchool = school_code;
                     //在线人数记录
-                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, school_code, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, client, expire: 1);
+                    teacher.loginInfos = await LoginService.DoLoginInfo(teacher.loginInfos, school_code, Constant.ScopeTeacher, id, ip, _azureRedis, _azureStorage, expire: 1);
                     teacher = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                 }
                 var response = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id, new PartitionKey($"Teacher-{school_code}"));