CrazyIter_Bin 1 year ago
parent
commit
405fbc593e

+ 505 - 45
TEAMModelOS.SDK/Models/Service/SystemService.cs

@@ -116,9 +116,6 @@ namespace TEAMModelOS.SDK.Models.Service
             List<SchoolStick> schoolStickiness = new List<SchoolStick>();
             List<SchoolStick> schoolStickiness = new List<SchoolStick>();
             foreach (var chinaSchoolKey in schoolApiVisits)
             foreach (var chinaSchoolKey in schoolApiVisits)
             {
             {
-                if (chinaSchoolKey.Key.Equals("hbcn")) {
-                    Console.WriteLine("1");
-                }
                 SchoolStick stickiness = new SchoolStick()
                 SchoolStick stickiness = new SchoolStick()
                 {
                 {
                     id = chinaSchoolKey.Key
                     id = chinaSchoolKey.Key
@@ -129,20 +126,25 @@ namespace TEAMModelOS.SDK.Models.Service
                 int hitaTch= 0, hiteachTch = 0, ies5Tch = 0, otherTch = 0, ies5Stu = 0, otherStu = 0;
                 int hitaTch= 0, hiteachTch = 0, ies5Tch = 0, otherTch = 0, ies5Stu = 0, otherStu = 0;
                 double hitaCount = 0,   hiteachCount = 0, ies5TchCount = 0, otherTchCount = 0, ies5StuCount = 0, otherStuCount = 0;
                 double hitaCount = 0,   hiteachCount = 0, ies5TchCount = 0, otherTchCount = 0, ies5StuCount = 0, otherStuCount = 0;
                 double lessonCount= chinaSchoolKey.ToList().Where(x => x.path.Contains("hiteach/create-lesson")).Count() ;
                 double lessonCount= chinaSchoolKey.ToList().Where(x => x.path.Contains("hiteach/create-lesson")).Count() ;
-
-               
                 int teacherCount= teachers.Count() ;
                 int teacherCount= teachers.Count() ;
                 foreach (var user in teachers)
                 foreach (var user in teachers)
                 {
                 {
+                   TchStick tchStick = new TchStick()
+                    {
+                        id = user.Key,
+                        school= chinaSchoolKey.Key
+                    };
+
                     //HiTA
                     //HiTA
                     var teacherHitaVisit = apiVisits.Where(x => !string.IsNullOrWhiteSpace(x.userId)  && x.userId.Equals(user.Key) && x.client.Equals("hita"));
                     var teacherHitaVisit = apiVisits.Where(x => !string.IsNullOrWhiteSpace(x.userId)  && x.userId.Equals(user.Key) && x.client.Equals("hita"));
                     var teacherHitaVisitCount = teacherHitaVisit.Count();
                     var teacherHitaVisitCount = teacherHitaVisit.Count();
                     if (teacherHitaVisitCount>0) 
                     if (teacherHitaVisitCount>0) 
                     { hitaTch+=1; }
                     { hitaTch+=1; }
                     var teacherHitaVisitTime = GetUserDuration(teacherHitaVisit.OrderBy(x => x.time).Select(x => x.time).ToList());
                     var teacherHitaVisitTime = GetUserDuration(teacherHitaVisit.OrderBy(x => x.time).Select(x => x.time).ToList());
-
                     hitaCount+=teacherHitaVisitCount;
                     hitaCount+=teacherHitaVisitCount;
                     hitaTime+=teacherHitaVisitTime;
                     hitaTime+=teacherHitaVisitTime;
+                    tchStick.hita.count.value=teacherHitaVisitCount;
+                    tchStick.hita.duration.value=teacherHitaVisitTime;
                     //Other
                     //Other
                     var teacherOtherVisit = user.Where(x => !x.client.Equals("hita")&&!x.client.Equals("hiteach")&&!x.client.Equals("ies5"));
                     var teacherOtherVisit = user.Where(x => !x.client.Equals("hita")&&!x.client.Equals("hiteach")&&!x.client.Equals("ies5"));
                     var teacherOtherVisitCount= teacherOtherVisit.Count();
                     var teacherOtherVisitCount= teacherOtherVisit.Count();
@@ -151,6 +153,9 @@ namespace TEAMModelOS.SDK.Models.Service
                     { otherTch+=1; }
                     { otherTch+=1; }
                     otherTchCount+=teacherOtherVisitCount;
                     otherTchCount+=teacherOtherVisitCount;
                     otherTchTime+=teacherOtherVisitTime;
                     otherTchTime+=teacherOtherVisitTime;
+
+                    tchStick.otherTch.count.value=teacherOtherVisitCount;
+                    tchStick.otherTch.duration.value=teacherOtherVisitTime;
                     //HiTeach
                     //HiTeach
                     //教师访问hiteach 不带学校信息的
                     //教师访问hiteach 不带学校信息的
                     var teacherHiteachVisit = apiVisits.Where(x => !string.IsNullOrWhiteSpace(x.userId)  && x.userId.Equals(user.Key) && x.client.Equals("hiteach")  && string.IsNullOrWhiteSpace(x.school));
                     var teacherHiteachVisit = apiVisits.Where(x => !string.IsNullOrWhiteSpace(x.userId)  && x.userId.Equals(user.Key) && x.client.Equals("hiteach")  && string.IsNullOrWhiteSpace(x.school));
@@ -166,6 +171,9 @@ namespace TEAMModelOS.SDK.Models.Service
                     var teacherHiteachAllVisitTime = GetUserDuration(teacherHiteachAllVisit.OrderBy(x => x.time).Select(x => x.time).ToList());
                     var teacherHiteachAllVisitTime = GetUserDuration(teacherHiteachAllVisit.OrderBy(x => x.time).Select(x => x.time).ToList());
                     hiteachCount+=teacherHiteachAllVisitCount;
                     hiteachCount+=teacherHiteachAllVisitCount;
                     hiteachTime+=teacherHiteachAllVisitTime;
                     hiteachTime+=teacherHiteachAllVisitTime;
+
+                    tchStick.hiteach.count.value=teacherHiteachAllVisitCount;
+                    tchStick.hiteach.duration.value=teacherHiteachAllVisitTime;
                     //IES5
                     //IES5
                     var teacherIes5Visit = user.Where(x => x.client.Equals("ies5"));
                     var teacherIes5Visit = user.Where(x => x.client.Equals("ies5"));
                     var teacherIes5VisitCount= teacherIes5Visit.Count();
                     var teacherIes5VisitCount= teacherIes5Visit.Count();
@@ -174,11 +182,51 @@ namespace TEAMModelOS.SDK.Models.Service
                     var teacherIes5VisitTime = GetUserDuration(teacherIes5Visit.OrderBy(x => x.time).Select(x => x.time).ToList());
                     var teacherIes5VisitTime = GetUserDuration(teacherIes5Visit.OrderBy(x => x.time).Select(x => x.time).ToList());
                     ies5TchCount+=teacherIes5VisitCount;
                     ies5TchCount+=teacherIes5VisitCount;
                     ies5TchTime+=teacherIes5VisitTime;
                     ies5TchTime+=teacherIes5VisitTime;
+
+                    tchStick.ies5Tch.count.value=teacherIes5VisitCount;
+                    tchStick.ies5Tch.duration.value=teacherIes5VisitTime;
+                    double lessonCountTch = chinaSchoolKey.ToList().Where(x => x.path.Contains("hiteach/create-lesson") && x.userId.Equals(user.Key)).Count();
+                    tchStick.lesson.value=lessonCountTch;
+
+                    tchStick.tmd.count.value=tchStick.hita.count.value+tchStick.hiteach.count.value+tchStick.ies5Tch.count.value+tchStick.otherTch.count.value;
+                    tchStick.tmd.duration.value=tchStick.hita.duration.value+tchStick.hiteach.duration.value+tchStick.ies5Tch.duration.value+tchStick.otherTch.duration.value;
+
+                    tchStick.hita.userCount=1;
+                    tchStick.hiteach.userCount=1;
+                    tchStick.ies5Tch.userCount=1;
+                    tchStick.otherTch.userCount=1;
+                    tchStick.tmd.userCount=1;
+                    if (tchStick.hita.count.value>0  && tchStick.hita.duration.value>0)
+                    {
+                        tchStick.hita.stick.value= (tchStick.hita.duration.value/1000/tchStick.hita.count.value);
+                    }
+                    if (tchStick.ies5Tch.count.value>0  && tchStick.ies5Tch.duration.value>0)
+                    {
+                        tchStick.ies5Tch.stick.value= (tchStick.ies5Tch.duration.value/1000/tchStick.ies5Tch.count.value);
+                    }
+                    if (tchStick.otherTch.count.value>0  && tchStick.otherTch.duration.value>0)
+                    {
+                        tchStick.otherTch.stick.value= (tchStick.otherTch.duration.value/1000/tchStick.otherTch.count.value);
+                    }
+                    if (tchStick.hiteach.count.value>0  && tchStick.hiteach.duration.value>0)
+                    {
+                        tchStick.hiteach.stick.value= (tchStick.hiteach.duration.value/1000/tchStick.hiteach.count.value)+tchStick.lesson.value;
+                    }
+                    if (tchStick.tmd.count.value>0  && tchStick.tmd.duration.value>0)
+                    {
+                        tchStick.tmd.stick.value= (tchStick.tmd.duration.value/1000/tchStick.tmd.count.value)+ tchStick.lesson.value;
+                    }
+                    stickiness.tchSticks.Add(tchStick);
                 }
                 }
                 var student = chinaSchoolKey.ToList().Where(x => !string.IsNullOrWhiteSpace(x.userId) && !string.IsNullOrWhiteSpace(x.scope) && (x.scope.Equals("student")||x.scope.Equals("tmduser"))).GroupBy(x => x.userId);
                 var student = chinaSchoolKey.ToList().Where(x => !string.IsNullOrWhiteSpace(x.userId) && !string.IsNullOrWhiteSpace(x.scope) && (x.scope.Equals("student")||x.scope.Equals("tmduser"))).GroupBy(x => x.userId);
                 var studentCount  = student.Count();
                 var studentCount  = student.Count();
                 foreach (var user in student)
                 foreach (var user in student)
                 {
                 {
+                    StuStick stuStick = new StuStick
+                    {
+                        id=user.Key,
+                        school=chinaSchoolKey.Key
+                    };
                     var studentOtherVisit = user.Where(x => !x.client.Equals("ies5"));
                     var studentOtherVisit = user.Where(x => !x.client.Equals("ies5"));
                     var studentOtherVisitCount = studentOtherVisit.Count();
                     var studentOtherVisitCount = studentOtherVisit.Count();
                     if (studentOtherVisitCount>0)
                     if (studentOtherVisitCount>0)
@@ -193,6 +241,30 @@ namespace TEAMModelOS.SDK.Models.Service
                     ies5StuTime+=studentIes5VisitTime;
                     ies5StuTime+=studentIes5VisitTime;
                     otherStuCount+=studentOtherVisitCount;
                     otherStuCount+=studentOtherVisitCount;
                     otherStuTime+=studentOtherVisitTime;
                     otherStuTime+=studentOtherVisitTime;
+
+                    stuStick.ies5Stu.count.value=studentIes5VisitCount;
+                    stuStick.ies5Stu.duration.value=studentIes5VisitTime;
+                    stuStick.otherStu.count.value=studentOtherVisitCount;
+                    stuStick.otherStu.duration.value=studentOtherVisitTime;
+                    stuStick.tmd.count.value= stuStick.ies5Stu.count.value+stuStick.otherStu.count.value;
+                    stuStick.tmd.duration.value= stuStick.ies5Stu.duration.value+stuStick.otherStu.duration.value;
+                    stuStick.ies5Stu.userCount=1;
+                    stuStick.otherStu.userCount=1;
+                    stuStick.tmd.userCount=1;
+                    if (stuStick.ies5Stu.count.value>0  && stuStick.ies5Stu.duration.value>0)
+                    {
+                        stuStick.ies5Stu.stick.value= (stuStick.ies5Stu.duration.value/1000/stuStick.ies5Stu.count.value);
+                    }
+                    
+                    if (stuStick.otherStu.count.value>0  && stuStick.otherStu.duration.value>0)
+                    {
+                        stuStick.otherStu.stick.value=(stuStick.otherStu.duration.value/1000/stuStick.otherStu.count.value);
+                    }
+                    if (stuStick.tmd.count.value>0  && stuStick.tmd.duration.value>0)
+                    {
+                        stuStick.tmd.stick.value=(stuStick.tmd.duration.value/1000/stuStick.tmd.count.value);
+                    }
+                    stickiness.stuSticks.Add(stuStick);
                 }
                 }
                 stickiness.hita.duration.value=hitaTime;
                 stickiness.hita.duration.value=hitaTime;
                 stickiness.hiteach.duration.value=hiteachTime;
                 stickiness.hiteach.duration.value=hiteachTime;
@@ -218,34 +290,180 @@ namespace TEAMModelOS.SDK.Models.Service
                 stickiness.ies5Stu.count.value=ies5StuCount;
                 stickiness.ies5Stu.count.value=ies5StuCount;
                 stickiness.otherStu.count.value=otherStuCount;
                 stickiness.otherStu.count.value=otherStuCount;
                 stickiness.tmd.count.value=hitaCount+hiteachCount+ies5TchCount+otherTchCount+ies5StuCount+otherStuCount;
                 stickiness.tmd.count.value=hitaCount+hiteachCount+ies5TchCount+otherTchCount+ies5StuCount+otherStuCount;
-
-
                 stickiness.lesson.value=lessonCount;
                 stickiness.lesson.value=lessonCount;
                 stickiness.tmd.userCount=teacherCount+studentCount;
                 stickiness.tmd.userCount=teacherCount+studentCount;
+                if(stickiness.hita.count.value>0  && stickiness.hita.duration.value>0)
+                {
+                    stickiness.hita.stick.value=(stickiness.hita.userCount* stickiness.hita.count.value)/(stickiness.hita.duration.value/1000/stickiness.hita.count.value);
+                }
+                if (stickiness.ies5Stu.count.value>0  && stickiness.ies5Stu.duration.value>0)
+                { 
+                    stickiness.ies5Stu.stick.value=(stickiness.ies5Stu.userCount* stickiness.ies5Stu.count.value)/(stickiness.ies5Stu.duration.value/1000/stickiness.ies5Stu.count.value); 
+                }
+                if (stickiness.ies5Tch.count.value>0  && stickiness.ies5Tch.duration.value>0) 
+                {
+                    stickiness.ies5Tch.stick.value=(stickiness.ies5Tch.userCount* stickiness.ies5Tch.count.value)/(stickiness.ies5Tch.duration.value/1000/stickiness.ies5Tch.count.value);
+                }
+                if (stickiness.otherStu.count.value>0  && stickiness.otherStu.duration.value>0)
+                {
+                    stickiness.otherStu.stick.value=(stickiness.otherStu.userCount* stickiness.otherStu.count.value)/(stickiness.otherStu.duration.value/1000/stickiness.otherStu.count.value); 
+                }
+                if (stickiness.otherTch.count.value>0  && stickiness.otherTch.duration.value>0)
+                {
+                    stickiness.otherTch.stick.value=(stickiness.otherTch.userCount* stickiness.otherTch.count.value)/(stickiness.otherTch.duration.value/1000/stickiness.otherTch.count.value);
+                }
+                if (stickiness.hiteach.count.value>0  && stickiness.hiteach.duration.value>0)
+                {
+                    stickiness.hiteach.stick.value=(stickiness.hiteach.userCount* stickiness.hiteach.count.value)/(stickiness.hiteach.duration.value/1000/stickiness.hiteach.count.value)+stickiness.lesson.value;
+                }
+                if (stickiness.tmd.count.value>0  && stickiness.tmd.duration.value>0)
+                { 
+                    stickiness.tmd.stick.value=(stickiness.tmd.userCount* stickiness.tmd.count.value)/(stickiness.tmd.duration.value/1000/stickiness.tmd.count.value)+ stickiness.lesson.value;
+                }
+                stickiness.tchSticks= OrderByTchStick(stickiness.tchSticks);
+                stickiness.stuSticks= OrderByStuStick(stickiness.stuSticks);
                 schoolStickiness.Add(stickiness);
                 schoolStickiness.Add(stickiness);
             }
             }
+            
+            return OrderBySchoolStick(schoolStickiness); 
+        }
+        private static List<StuStick> OrderByStuStick(List<StuStick> stuStickiness)
+        {
             // 假设visit已经填充了数据
             // 假设visit已经填充了数据
 
 
             #region
             #region
-            var rank_tmd_count = schoolStickiness.Select(x=> x.tmd.count.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_hita_count = schoolStickiness.Select(x => x.hita.count.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_hiteach_count = schoolStickiness.Select(x => x.hiteach.count.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_ies5Tch_count = schoolStickiness.Select(x => x.ies5Tch.count.value).Distinct().OrderByDescending(v => v).ToList() ;
-            var rank_otherTch_count = schoolStickiness.Select(x => x.otherTch.count.value).Distinct().OrderByDescending(v => v).ToList() ;
-            var rank_ies5Stu_count = schoolStickiness.Select(x => x.ies5Stu.count.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_otherStu_count = schoolStickiness.Select(x => x.otherStu.count.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_lesson_count = schoolStickiness.Select(x => x.lesson.value).Distinct().OrderByDescending(v => v).ToList()  ;
+            var rank_tmd_count = stuStickiness.Select(x => x.tmd.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_count = stuStickiness.Select(x => x.ies5Stu.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_count = stuStickiness.Select(x => x.otherStu.count.value).Distinct().OrderByDescending(v => v).ToList();
             #endregion
             #endregion
             #region
             #region
-            var rank_tmd_duration = schoolStickiness.Select(x => x.tmd.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_hita_duration = schoolStickiness.Select(x => x.hita.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_hiteach_duration = schoolStickiness.Select(x => x.hiteach.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_ies5Tch_duration = schoolStickiness.Select(x => x.ies5Tch.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_otherTch_duration = schoolStickiness.Select(x => x.otherTch.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_ies5Stu_duration = schoolStickiness.Select(x => x.ies5Stu.duration.value).Distinct().OrderByDescending(v => v).ToList();
-            var rank_otherStu_duration = schoolStickiness.Select(x => x.otherStu.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_tmd_duration = stuStickiness.Select(x => x.tmd.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_duration = stuStickiness.Select(x => x.ies5Stu.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_duration = stuStickiness.Select(x => x.otherStu.duration.value).Distinct().OrderByDescending(v => v).ToList();
             #endregion
             #endregion
-            schoolStickiness.ForEach(x => {
+
+            #region
+            var rank_tmd_stick = stuStickiness.Select(x => x.tmd.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_stick = stuStickiness.Select(x => x.ies5Stu.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_stick = stuStickiness.Select(x => x.otherStu.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+            stuStickiness.ForEach(x =>
+            {
+                #region
+                if (x.tmd.count.value>0)
+                {
+                    int index_tmd_count = rank_tmd_count.FindIndex(i => i==x.tmd.count.value);
+                    if (index_tmd_count!=-1)
+                    {
+                        x.tmd.count.rank = index_tmd_count + 1;
+                    }
+                }
+
+                if (x.ies5Stu.count.value>0)
+                {
+                    int index_ies5Stu_count = rank_ies5Stu_count.FindIndex(i => i==x.ies5Stu.count.value);
+                    if (index_ies5Stu_count!=-1)
+                    {
+                        x.ies5Stu.count.rank = index_ies5Stu_count + 1;
+                    }
+                }
+
+                if (x.otherStu.count.value>0)
+                {
+                    int index_otherStu_count = rank_otherStu_count.FindIndex(i => i==x.otherStu.count.value);
+                    if (index_otherStu_count!=-1)
+                    {
+                        x.otherStu.count.rank = index_otherStu_count + 1;
+                    }
+                }
+
+
+
+                #endregion
+                #region
+                if (x.tmd.duration.value> 0) {
+                    int index_tmd_duration = rank_tmd_duration.FindIndex(i => i==x.tmd.duration.value);
+                    if (index_tmd_duration!=-1)
+                    {
+                        x.tmd.duration.rank = index_tmd_duration + 1;
+                    }
+                }
+
+
+                if (x.ies5Stu.duration.value>0) {
+                    int index_ies5Stu_duration = rank_ies5Stu_duration.FindIndex(i => i==x.ies5Stu.duration.value);
+                    if (index_ies5Stu_duration!=-1)
+                    {
+                        x.ies5Stu.duration.rank = index_ies5Stu_duration + 1;
+                    }
+                }
+                if (x.otherStu.duration.value>0) {
+                    int index_otherStu_duration = rank_otherStu_duration.FindIndex(i => i==x.otherStu.duration.value);
+                    if (index_otherStu_duration!=-1)
+                    {
+                        x.otherStu.duration.rank = index_otherStu_duration + 1;
+                    }
+                }
+
+                #endregion
+                #region
+                if (x.tmd.stick.value>0)
+                {
+                    int index_tmd_stick = rank_tmd_stick.FindIndex(i => i==x.tmd.stick.value);
+                    if (index_tmd_stick!=-1)
+                    {
+                        x.tmd.stick.rank = index_tmd_stick + 1;
+                    }
+                }
+                if (x.ies5Stu.stick.value>0)
+                {
+                    int index_ies5Stu_stick = rank_ies5Stu_stick.FindIndex(i => i==x.ies5Stu.stick.value);
+                    if (index_ies5Stu_stick!=-1)
+                    {
+                        x.ies5Stu.stick.rank = index_ies5Stu_stick + 1;
+                    }
+                }
+
+                if (x.otherStu.stick.value>0)
+                {
+                    int index_otherStu_stick = rank_otherStu_stick.FindIndex(i => i==x.otherStu.stick.value);
+                    if (index_otherStu_stick!=-1)
+                    {
+                        x.otherStu.stick.rank = index_otherStu_stick + 1;
+                    }
+                }
+                #endregion
+            });
+            return stuStickiness;
+        }
+        private static List<TchStick> OrderByTchStick(List<TchStick> tchStickiness)
+        {
+            // 假设visit已经填充了数据
+
+            #region
+            var rank_tmd_count = tchStickiness.Select(x => x.tmd.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_count = tchStickiness.Select(x => x.hita.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_count = tchStickiness.Select(x => x.hiteach.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_count = tchStickiness.Select(x => x.ies5Tch.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_count = tchStickiness.Select(x => x.otherTch.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_lesson_count = tchStickiness.Select(x => x.lesson.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+            #region
+            var rank_tmd_duration = tchStickiness.Select(x => x.tmd.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_duration = tchStickiness.Select(x => x.hita.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_duration = tchStickiness.Select(x => x.hiteach.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_duration = tchStickiness.Select(x => x.ies5Tch.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_duration = tchStickiness.Select(x => x.otherTch.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+
+            #region
+            var rank_tmd_stick = tchStickiness.Select(x => x.tmd.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_stick = tchStickiness.Select(x => x.hita.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_stick = tchStickiness.Select(x => x.hiteach.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_stick = tchStickiness.Select(x => x.ies5Tch.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_stick = tchStickiness.Select(x => x.otherTch.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+            tchStickiness.ForEach(x => {
                 #region
                 #region
                 int index_tmd_count = rank_tmd_count.FindIndex(i => i==x.tmd.count.value);
                 int index_tmd_count = rank_tmd_count.FindIndex(i => i==x.tmd.count.value);
                 if (index_tmd_count!=-1)
                 if (index_tmd_count!=-1)
@@ -273,18 +491,6 @@ namespace TEAMModelOS.SDK.Models.Service
                     x.otherTch.count.rank = index_otherTch_count + 1;
                     x.otherTch.count.rank = index_otherTch_count + 1;
                 }
                 }
 
 
-                int index_ies5Stu_count = rank_ies5Stu_count.FindIndex(i => i==x.ies5Stu.count.value);
-                if (index_ies5Stu_count!=-1)
-                {
-                    x.ies5Stu.count.rank = index_ies5Stu_count + 1;
-                }
-
-                int index_otherStu_count = rank_otherStu_count.FindIndex(i => i==x.otherStu.count.value);
-                if (index_otherStu_count!=-1)
-                {
-                    x.otherStu.count.rank = index_otherStu_count + 1;
-                }
-
                 int index_lesson_count = rank_lesson_count.FindIndex(i => i==x.lesson.value);
                 int index_lesson_count = rank_lesson_count.FindIndex(i => i==x.lesson.value);
                 if (index_lesson_count!=-1)
                 if (index_lesson_count!=-1)
                 {
                 {
@@ -318,20 +524,271 @@ namespace TEAMModelOS.SDK.Models.Service
                     x.otherTch.duration.rank = index_otherTch_duration + 1;
                     x.otherTch.duration.rank = index_otherTch_duration + 1;
                 }
                 }
 
 
-                int index_ies5Stu_duration = rank_ies5Stu_duration.FindIndex(i => i==x.ies5Stu.duration.value);
-                if (index_ies5Stu_duration!=-1)
+                
+                #endregion
+                #region
+                int index_tmd_stick = rank_tmd_stick.FindIndex(i => i==x.tmd.stick.value);
+                if (index_tmd_stick!=-1)
+                {
+                    x.tmd.stick.rank = index_tmd_stick + 1;
+                }
+                int index_hita_stick = rank_hita_stick.FindIndex(i => i==x.hita.stick.value);
+                if (index_hita_stick!=-1)
+                {
+                    x.hita.stick.rank = index_hita_stick + 1;
+                }
+                int index_hiteach_stick = rank_hiteach_stick.FindIndex(i => i==x.hiteach.stick.value);
+                if (index_hiteach_stick!=-1)
+                {
+                    x.hiteach.stick.rank = index_hiteach_stick + 1;
+                }
+                int index_ies5Tch_stick = rank_ies5Tch_stick.FindIndex(i => i==x.ies5Tch.stick.value);
+                if (index_ies5Tch_stick!=-1)
                 {
                 {
-                    x.ies5Stu.duration.rank = index_ies5Stu_duration + 1;
+                    x.ies5Tch.stick.rank = index_ies5Tch_stick + 1;
                 }
                 }
+                int index_otherTch_stick = rank_otherTch_stick.FindIndex(i => i==x.otherTch.stick.value);
+                if (index_otherTch_stick!=-1)
+                {
+                    x.otherTch.stick.rank = index_otherTch_stick + 1;
+                }
+
+               
+                #endregion
+            });
+            return tchStickiness;
+        }
+        private static List<SchoolStick> OrderBySchoolStick(List<SchoolStick> schoolStickiness) 
+        {
+            // 假设visit已经填充了数据
+
+            #region
+            var rank_tmd_count = schoolStickiness.Select(x => x.tmd.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_count = schoolStickiness.Select(x => x.hita.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_count = schoolStickiness.Select(x => x.hiteach.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_count = schoolStickiness.Select(x => x.ies5Tch.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_count = schoolStickiness.Select(x => x.otherTch.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_count = schoolStickiness.Select(x => x.ies5Stu.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_count = schoolStickiness.Select(x => x.otherStu.count.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_lesson_count = schoolStickiness.Select(x => x.lesson.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+            #region
+            var rank_tmd_duration = schoolStickiness.Select(x => x.tmd.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_duration = schoolStickiness.Select(x => x.hita.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_duration = schoolStickiness.Select(x => x.hiteach.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_duration = schoolStickiness.Select(x => x.ies5Tch.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_duration = schoolStickiness.Select(x => x.otherTch.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_duration = schoolStickiness.Select(x => x.ies5Stu.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_duration = schoolStickiness.Select(x => x.otherStu.duration.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
 
 
-                int index_otherStu_duration = rank_otherStu_duration.FindIndex(i => i==x.otherStu.duration.value);
-                if (index_otherStu_duration!=-1)
+            #region
+            var rank_tmd_stick = schoolStickiness.Select(x => x.tmd.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hita_stick = schoolStickiness.Select(x => x.hita.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_hiteach_stick = schoolStickiness.Select(x => x.hiteach.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Tch_stick = schoolStickiness.Select(x => x.ies5Tch.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherTch_stick = schoolStickiness.Select(x => x.otherTch.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_ies5Stu_stick = schoolStickiness.Select(x => x.ies5Stu.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            var rank_otherStu_stick = schoolStickiness.Select(x => x.otherStu.stick.value).Distinct().OrderByDescending(v => v).ToList();
+            #endregion
+            schoolStickiness.ForEach(x => {
+                #region
+                if (x.tmd.count.value>0)
                 {
                 {
-                    x.otherStu.duration.rank = index_otherStu_duration + 1;
+                    int index_tmd_count = rank_tmd_count.FindIndex(i => i==x.tmd.count.value);
+                    if (index_tmd_count!=-1)
+                    {
+                        x.tmd.count.rank = index_tmd_count + 1;
+                    }
+                }
+                if (x.hita.count.value>0) 
+                {
+                    int index_hita_count = rank_hita_count.FindIndex(i => i==x.hita.count.value);
+                    if (index_hita_count!=-1)
+                    {
+                        x.hita.count.rank = index_hita_count + 1;
+                    }
+                }
+                
+                if (x.hiteach.count.value>0)
+                {
+                    int index_hiteach_count = rank_hiteach_count.FindIndex(i => i==x.hiteach.count.value);
+                    if (index_hiteach_count!=-1)
+                    {
+                        x.hiteach.count.rank = index_hiteach_count + 1;
+                    }
+                }
+                if (x.ies5Tch.count.value>0) 
+                {
+                    int index_ies5Tch_count = rank_ies5Tch_count.FindIndex(i => i==x.ies5Tch.count.value);
+                    if (index_ies5Tch_count!=-1)
+                    {
+                        x.ies5Tch.count.rank = index_ies5Tch_count + 1;
+                    }
+                }
+                if (x.otherTch.count.value>0)
+                {
+                    int index_otherTch_count = rank_otherTch_count.FindIndex(i => i==x.otherTch.count.value);
+                    if (index_otherTch_count!=-1)
+                    {
+                        x.otherTch.count.rank = index_otherTch_count + 1;
+                    }
+                }
+                if (x.ies5Stu.count.value>0)
+                {
+                    int index_ies5Stu_count = rank_ies5Stu_count.FindIndex(i => i==x.ies5Stu.count.value);
+                    if (index_ies5Stu_count!=-1)
+                    {
+                        x.ies5Stu.count.rank = index_ies5Stu_count + 1;
+                    }
+                }
+                if (x.otherStu.count.value>0) 
+                {
+                    int index_otherStu_count = rank_otherStu_count.FindIndex(i => i==x.otherStu.count.value);
+                    if (index_otherStu_count!=-1)
+                    {
+                        x.otherStu.count.rank = index_otherStu_count + 1;
+                    }
+                }
+                if (x.lesson.value>0)
+                {
+                    int index_lesson_count = rank_lesson_count.FindIndex(i => i==x.lesson.value);
+                    if (index_lesson_count!=-1)
+                    {
+                        x.lesson.rank = index_lesson_count + 1;
+                    }
                 }
                 }
                 #endregion
                 #endregion
+                #region
+                if (x.tmd.duration.value>0)
+                {
+                    int index_tmd_duration = rank_tmd_duration.FindIndex(i => i==x.tmd.duration.value);
+                    if (index_tmd_duration!=-1)
+                    {
+                        x.tmd.duration.rank = index_tmd_duration + 1;
+                    }
+                }
+               
+                if (x.hita.duration.value>0)
+                {
+                    int index_hita_duration = rank_hita_duration.FindIndex(i => i==x.hita.duration.value);
+                    if (index_hita_duration!=-1)
+                    {
+                        x.hita.duration.rank = index_hita_duration + 1;
+                    }
+                }
+                if (x.hiteach.duration.value>0)
+                {
+                    int index_hiteach_duration = rank_hiteach_duration.FindIndex(i => i==x.hiteach.duration.value);
+                    if (index_hiteach_duration!=-1)
+                    {
+                        x.hiteach.duration.rank = index_hiteach_duration + 1;
+                    }
+                }
+              
+                if (x.ies5Tch.duration.value>0) {
+                    int index_ies5Tch_duration = rank_ies5Tch_duration.FindIndex(i => i==x.ies5Tch.duration.value);
+                    if (index_ies5Tch_duration!=-1)
+                    {
+                        x.ies5Tch.duration.rank = index_ies5Tch_duration + 1;
+                    }
+                }
+               
+                if (x.otherTch.duration.value>0)
+                {
+                    int index_otherTch_duration = rank_otherTch_duration.FindIndex(i => i==x.otherTch.duration.value);
+                    if (index_otherTch_duration!=-1)
+                    {
+                        x.otherTch.duration.rank = index_otherTch_duration + 1;
+                    }
+                }
+              
+                if (x.ies5Stu.duration.value>0)
+                {
+                    int index_ies5Stu_duration = rank_ies5Stu_duration.FindIndex(i => i==x.ies5Stu.duration.value);
+                    if (index_ies5Stu_duration!=-1)
+                    {
+                        x.ies5Stu.duration.rank = index_ies5Stu_duration + 1;
+                    }
+                }
+               
+                if (x.otherStu.duration.value>0)
+                {
+                    int index_otherStu_duration = rank_otherStu_duration.FindIndex(i => i==x.otherStu.duration.value);
+                    if (index_otherStu_duration!=-1)
+                    {
+                        x.otherStu.duration.rank = index_otherStu_duration + 1;
+                    }
+                }
+               
+                #endregion
+                #region
+                if (x.tmd.stick.value>0) 
+                {
+                    int index_tmd_stick = rank_tmd_stick.FindIndex(i => i==x.tmd.stick.value);
+                    if (index_tmd_stick!=-1)
+                    {
+                        x.tmd.stick.rank = index_tmd_stick + 1;
+                    }
+                }
+                
+                if (x.hita.stick.value>0)
+                {
+                    int index_hita_stick = rank_hita_stick.FindIndex(i => i==x.hita.stick.value);
+                    if (index_hita_stick!=-1)
+                    {
+                        x.hita.stick.rank = index_hita_stick + 1;
+                    }
+                }
+              
+                if (x.hiteach.stick.value>0)
+                {
+                    int index_hiteach_stick = rank_hiteach_stick.FindIndex(i => i==x.hiteach.stick.value);
+                    if (index_hiteach_stick!=-1)
+                    {
+                        x.hiteach.stick.rank = index_hiteach_stick + 1;
+                    }
+                }
+               
+                if (x.ies5Tch.stick.value>0)
+                {
+                    int index_ies5Tch_stick = rank_ies5Tch_stick.FindIndex(i => i==x.ies5Tch.stick.value);
+                    if (index_ies5Tch_stick!=-1)
+                    {
+                        x.ies5Tch.stick.rank = index_ies5Tch_stick + 1;
+                    }
+                }
+              
+                if (x.otherTch.stick.value>0)
+                {
+                    int index_otherTch_stick = rank_otherTch_stick.FindIndex(i => i==x.otherTch.stick.value);
+                    if (index_otherTch_stick!=-1)
+                    {
+                        x.otherTch.stick.rank = index_otherTch_stick + 1;
+                    }
+                }
+               
+                if (x.ies5Stu.stick.value>0) 
+                {
+                    int index_ies5Stu_stick = rank_ies5Stu_stick.FindIndex(i => i==x.ies5Stu.stick.value);
+                    if (index_ies5Stu_stick!=-1)
+                    {
+                        x.ies5Stu.stick.rank = index_ies5Stu_stick + 1;
+                    }
+                }
+               
+                if (x.otherStu.stick.value>0) 
+                {
+                    int index_otherStu_stick = rank_otherStu_stick.FindIndex(i => i==x.otherStu.stick.value);
+                    if (index_otherStu_stick!=-1)
+                    {
+                        x.otherStu.stick.rank = index_otherStu_stick + 1;
+                    }
+                }
+                
+                #endregion
             });
             });
-            return schoolStickiness; 
+            return schoolStickiness;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -1237,9 +1694,10 @@ namespace TEAMModelOS.SDK.Models.Service
             #endregion
             #endregion
 
 
             public List<TchStick> tchSticks { get; set; } = new List<TchStick>();
             public List<TchStick> tchSticks { get; set; } = new List<TchStick>();
-            public List<SutStick> stuSticks { get; set; } = new List<SutStick>();
+            public List<StuStick> stuSticks { get; set; } = new List<StuStick>();
         }
         }
         public class TchStick {
         public class TchStick {
+            public string school { get; set; }
             /// <summary>
             /// <summary>
             /// 名字
             /// 名字
             /// </summary>
             /// </summary>
@@ -1277,8 +1735,10 @@ namespace TEAMModelOS.SDK.Models.Service
 
 
 
 
         }
         }
-        public class SutStick
+        public class StuStick
         {
         {
+            public string school { get; set; }
+
             /// <summary>
             /// <summary>
             /// 名字
             /// 名字
             /// </summary>
             /// </summary>

+ 1 - 100
TEAMModelOS/Controllers/System/BillController.cs

@@ -77,106 +77,7 @@ namespace TEAMModelOS.Controllers
             _azureRedis=azureRedis;
             _azureRedis=azureRedis;
             _longitudeLatitudeTranslator = longitudeLatitudeTranslator;
             _longitudeLatitudeTranslator = longitudeLatitudeTranslator;
         }
         }
-        [HttpPost("report-api-settle")]
-        [EnableCors("AllowSpecificOrigin")]
-        [AllowAnonymous]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<IActionResult> ReportApiSettle(JsonElement json) 
-        {
-          
-            List<string> times = json.GetProperty("times").ToObject<List<string>>();
-            
-            return Ok(new {  });
-        }
-        [HttpPost("report-api-reload")]
-        [EnableCors("AllowSpecificOrigin")]
-        [AllowAnonymous]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<IActionResult> ReportApiTest(JsonElement json)
-        {
-            try
-            {
-                List<string> times = json.GetProperty("times").ToObject<List<string>>();
-                foreach (var timeDate in times)
-                {
-                    if (DateTimeOffset.TryParse(timeDate, out DateTimeOffset date)) 
-                    {
-                        var gmt8Time = date.GetGMTTime(8);
-                        var nowGmt8Time=DateTimeOffset.Now.GetGMTTime(8);
-                        List<string> logs=   await _azureStorage.GetBlobContainerClient("0-service-log").List($"http-log/{date:yyyy}/{date:MM}/{date:dd}");
-                        List<HttpLog> httpLogs = new List<HttpLog>();
-                        foreach (var log in logs) {
-                            string nowPath = $"{nowGmt8Time:yyyy/MM/dd/HH}.log";
-                            if (!log.Contains("index.log")   &&!log.Contains(nowPath))
-                            {
-                                BlobDownloadResult result=   await _azureStorage.GetBlobContainerClient("0-service-log").GetBlobBaseClient(log).DownloadContentAsync();
-                                var content = result.Content.ToString();
-                                content= content.Substring(0, content.Length-2);
-                                if (content.EndsWith("}"))
-                                {
-                                    content=$"[{content}]";
-                                }
-                                else
-                                {
-                                    content=$"[{content}}}]";
-                                }
-                                httpLogs.AddRange(content.ToObject<List<HttpLog>>());
-                            }
-                        }
-                        (ConcurrentBag<ApiVisit> visits, ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)> uuidInfo)   =
-                            await SystemService.ConvertHttpLog(httpLogs, _azureRedis, _ipSearcher, _longitudeLatitudeTranslator, gmt8Time, true);
-                        if (visits!=null  && visits.Count>0)
-                        {
-                            var appendDayBlob = _azureStorage.GetBlobContainerClient("0-service-log").GetAppendBlobClient($"http-log/{gmt8Time:yyyy}/{gmt8Time:MM}/{gmt8Time:dd}/index.log");
-                            if (!await appendDayBlob.ExistsAsync())
-                            {
-
-                                await appendDayBlob.CreateAsync();
-                            }
-                            else {
-                                await appendDayBlob.DeleteAsync();
-                                await appendDayBlob.CreateAsync();
-                            }
-                            StringBuilder sb = new StringBuilder();
-                            foreach (var item in visits)
-                            {
-                                sb.Append($"{item.ToJsonString()},\n");
-
-                            }
-                            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes($"{sb}")))
-                            {
-                                await appendDayBlob.AppendBlockAsync(stream);
-                            }
-                        }
-                    }
-                }
-                return Ok(new {  });
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
-            }
-            return Ok();
-        }
-
-        /// <summary>
-        /// 使用时长,一天内累计
-        /// </summary>
-        /// <param name="json"></param>
-        /// <returns></returns>
-        [HttpPost("report-api")]
-        [EnableCors("AllowSpecificOrigin")]
-        [AllowAnonymous]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<IActionResult> ReportApi(JsonElement json)
-        {
-            List<ApiVisit> apiVisits = new List<ApiVisit>();
-            var scale = json.GetProperty("scale").GetString() ;
-            List<string> times = json.GetProperty("times").ToObject<List<string>>();
-            var data = await SystemService.VisitSettle(times, _azureStorage, _azureRedis, _longitudeLatitudeTranslator, _ipSearcher);
-            return Ok(new { data.chinaSchoolStickiness, data.globalSchoolStickiness });
-        }
-
+        
         [HttpPost("report")]
         [HttpPost("report")]
         [EnableCors("AllowSpecificOrigin")]
         [EnableCors("AllowSpecificOrigin")]
         [AllowAnonymous]
         [AllowAnonymous]

+ 29 - 13
TEAMModelOS/Filter/RequestAuditFilter.cs

@@ -21,6 +21,8 @@ using System.Net.Http;
 using System.Net.Http.Json;
 using System.Net.Http.Json;
 using TEAMModelOS.Models;
 using TEAMModelOS.Models;
 using Microsoft.Extensions.Options;
 using Microsoft.Extensions.Options;
+using System.Collections.Generic;
+using FastJSON;
 
 
 namespace TEAMModelOS.Filter
 namespace TEAMModelOS.Filter
 {
 {
@@ -31,6 +33,7 @@ namespace TEAMModelOS.Filter
         private readonly DingDing _dingding;
         private readonly DingDing _dingding;
         private readonly Option _option;
         private readonly Option _option;
         private string p = "os";
         private string p = "os";
+        private readonly Dictionary<string, object> _param = new Dictionary<string, object>() { { "param" ,"idschool"} };
         public RequestAuditFilter(/*ILoggerFactory loggerFactory*/IHttpClientFactory httpClient, DingDing dingding, IOptionsSnapshot<Option> option)
         public RequestAuditFilter(/*ILoggerFactory loggerFactory*/IHttpClientFactory httpClient, DingDing dingding, IOptionsSnapshot<Option> option)
         {
         {
             //  _logger = loggerFactory.CreateLogger<RequestAuditFilter>();
             //  _logger = loggerFactory.CreateLogger<RequestAuditFilter>();
@@ -93,6 +96,7 @@ namespace TEAMModelOS.Filter
                         var jwt = new JwtSecurityTokenHandler().ReadJwtToken(XAuthIdToken.ToString());
                         var jwt = new JwtSecurityTokenHandler().ReadJwtToken(XAuthIdToken.ToString());
                         id = jwt.Payload.Sub;
                         id = jwt.Payload.Sub;
                         name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
                         name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
+                        picture = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("picture"))?.Value;
                         if (string.IsNullOrEmpty(tokenSha))
                         if (string.IsNullOrEmpty(tokenSha))
                         {
                         {
                             tokenSha= ShaHashHelper.GetSHA1(XAuthIdToken.ToString());
                             tokenSha= ShaHashHelper.GetSHA1(XAuthIdToken.ToString());
@@ -119,7 +123,7 @@ namespace TEAMModelOS.Filter
                     {
                     {
                         var jwt = new JwtSecurityTokenHandler().ReadJwtToken(XAutApiToken);
                         var jwt = new JwtSecurityTokenHandler().ReadJwtToken(XAutApiToken);
                         id = jwt.Payload.Sub;
                         id = jwt.Payload.Sub;
-
+                        picture = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("picture"))?.Value;
                         if (string.IsNullOrEmpty(tokenSha))
                         if (string.IsNullOrEmpty(tokenSha))
                         {
                         {
                             tokenSha= jwt.Payload.Jti;
                             tokenSha= jwt.Payload.Jti;
@@ -140,6 +144,7 @@ namespace TEAMModelOS.Filter
                         school = $"{jwt.Payload.Azp}".Equals("true")|| $"{jwt.Payload.Azp}".Equals("false") ? "": $"{jwt.Payload.Azp}";
                         school = $"{jwt.Payload.Azp}".Equals("true")|| $"{jwt.Payload.Azp}".Equals("false") ? "": $"{jwt.Payload.Azp}";
                         name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
                         name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
                         scope = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("scope"))?.Value;
                         scope = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("scope"))?.Value;
+                        picture = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("picture"))?.Value;
                         roles = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("roles"))?.Value;
                         roles = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("roles"))?.Value;
                         if (string.IsNullOrWhiteSpace(scope)) {
                         if (string.IsNullOrWhiteSpace(scope)) {
                             if (!string.IsNullOrWhiteSpace(roles) )
                             if (!string.IsNullOrWhiteSpace(roles) )
@@ -188,7 +193,21 @@ namespace TEAMModelOS.Filter
                 // string region = await _searcher.SearchIpAsync(remoteIPv4);
                 // string region = await _searcher.SearchIpAsync(remoteIPv4);
                 //同一个账号,同一IP,同一接口,UA标识(UA标识随意切换则表示可能会存在DDOS),时间段
                 //同一个账号,同一IP,同一接口,UA标识(UA标识随意切换则表示可能会存在DDOS),时间段
                 //_logger.LogInformation(new{ ua=httpContext.GetUserAgent(), ip=remoteIPv4,time=requestedTime,path =$"{httpRequest.PathBase}{httpRequest.Path}",host= $"{httpRequest.Host}", param=parameters,id ,name ,school,succeed =isRequestSucceed }.ToJsonString());
                 //_logger.LogInformation(new{ ua=httpContext.GetUserAgent(), ip=remoteIPv4,time=requestedTime,path =$"{httpRequest.PathBase}{httpRequest.Path}",host= $"{httpRequest.Host}", param=parameters,id ,name ,school,succeed =isRequestSucceed }.ToJsonString());
+                //参数大小超过 102400 100kb ,51200 50KB, 25600  25KB则不记录参数详情
+                if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(school))
+                {
+                    //如果学校和教师的id都有,则不需要参数接入。
+                    parameters=_param;
 
 
+                }
+                else {
+                    if ($"{httpRequest.Path}".Contains("image-quant", StringComparison.OrdinalIgnoreCase))
+                    {
+                        parameters=_param;
+                    }
+                }
+                //multipart/form-data此类型不会自动记录parameters,不用担心文件上传在日志的大小影响。   // application/json
+                //   var d = httpRequest.ContentType; 
                 var data = new
                 var data = new
                 {
                 {
                     //ua =ua,
                     //ua =ua,
@@ -200,6 +219,7 @@ namespace TEAMModelOS.Filter
                     id = id,
                     id = id,
                     name = name,
                     name = name,
                     school = school,
                     school = school,
+                    picture = picture,
                     client = client,
                     client = client,
                     tid = tokenSha,
                     tid = tokenSha,
                     scope = scope,
                     scope = scope,
@@ -211,21 +231,17 @@ namespace TEAMModelOS.Filter
                 };
                 };
                 var httpclient=    _httpClient.CreateClient();
                 var httpclient=    _httpClient.CreateClient();
                 httpclient.Timeout=  TimeSpan.FromSeconds(10); 
                 httpclient.Timeout=  TimeSpan.FromSeconds(10); 
-#if DEBUG
-                var  response = await httpclient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/api/http-log", data);
-                //if (response.StatusCode==HttpStatusCode.OK) 
-                //{
-                //    string result =   await response.Content.ReadAsStringAsync();
-                    
-                //}
-#else
-            _=  httpclient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/api/http-log",data);
-#endif
-                //   _ = _httpTrigger.RequestHttpTrigger(data, "China", "http-log");
+//#if DEBUG
+//                var  response = await httpclient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/api/http-log", data);
+
+//#else
+          
+//#endif
+                _=  httpclient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/api/http-log", data);
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                await _dingding.SendBotMsg($"HTTP日志访问错误:{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+                await _dingding.SendBotMsg($"{_option.Location},HTTP日志访问错误:{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
                 var actionContext = await next();
                 var actionContext = await next();
             }
             }