|
@@ -1,5 +1,9 @@
|
|
-using HTEXLib.COMM.Helpers;
|
|
|
|
|
|
+using DocumentFormat.OpenXml.Bibliography;
|
|
|
|
+using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
|
+using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
|
+using HTEXLib.COMM.Helpers;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
+using OpenXmlPowerTools;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
@@ -7,6 +11,7 @@ using System.IdentityModel.Tokens.Jwt;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
using System.Text.Json;
|
|
|
|
+using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Extension;
|
|
@@ -62,7 +67,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public static (ConcurrentBag<ApiVist> vists, ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)> uuidInfo) ConvertHttpLog(ConcurrentBag<HttpLog> logs, IPSearcher _ipSearcher, Region2LongitudeLatitudeTranslator _longitudeLatitudeTranslator)
|
|
|
|
|
|
+ public static async Task<(ConcurrentBag<ApiVist> vists, ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)> uuidInfo)> ConvertHttpLog(List<HttpLog> logs,AzureRedisFactory _azureRedis, IPSearcher _ipSearcher, Region2LongitudeLatitudeTranslator _longitudeLatitudeTranslator)
|
|
{
|
|
{
|
|
ConcurrentBag<ApiVist> vists = new ConcurrentBag<ApiVist>();
|
|
ConcurrentBag<ApiVist> vists = new ConcurrentBag<ApiVist>();
|
|
ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)> uuidInfo = new ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)>();
|
|
ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)> uuidInfo = new ConcurrentBag<(string uuid, HttpLog httpLog, List<string> tmdid, List<string> school)>();
|
|
@@ -81,11 +86,27 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
school= log.school,
|
|
school= log.school,
|
|
tname= log.name,
|
|
tname= log.name,
|
|
path = log.path,
|
|
path = log.path,
|
|
- year=log.year,
|
|
|
|
- month=log.month,
|
|
|
|
- day=log.day,
|
|
|
|
- hour=log.hour
|
|
|
|
|
|
+ client=log.p.Equals("os", StringComparison.OrdinalIgnoreCase) ? "ies5" : log.p,
|
|
|
|
+ scope=log.scope,
|
|
|
|
+ host= log.host,
|
|
|
|
+ hostName=log.hostName,
|
|
|
|
+ l=log.l,
|
|
};
|
|
};
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(log.year) && !string.IsNullOrWhiteSpace(log.month) && !string.IsNullOrWhiteSpace(log.day) && !string.IsNullOrWhiteSpace(log.hour) )
|
|
|
|
+ {
|
|
|
|
+ vist.year =log.year;
|
|
|
|
+ vist.month=log.month;
|
|
|
|
+ vist.day=log.day;
|
|
|
|
+ vist.hour=log.hour;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var time = DateTimeOffset.FromUnixTimeMilliseconds(log.time);
|
|
|
|
+ vist.year = $"{time:yyyy}";
|
|
|
|
+ vist.month = $"{time:MM}";
|
|
|
|
+ vist.day = $"{time:dd}";
|
|
|
|
+ vist.hour =$"{time:HH}";
|
|
|
|
+ }
|
|
|
|
+
|
|
if (string.IsNullOrWhiteSpace(vist.userId))
|
|
if (string.IsNullOrWhiteSpace(vist.userId))
|
|
{
|
|
{
|
|
|
|
|
|
@@ -113,6 +134,9 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
var name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
|
|
var name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
|
|
if (!string.IsNullOrWhiteSpace(id) && long.TryParse(id, out long _id))
|
|
if (!string.IsNullOrWhiteSpace(id) && long.TryParse(id, out long _id))
|
|
{
|
|
{
|
|
|
|
+ vist.userId=id;
|
|
|
|
+ vist.scope="teahcer";
|
|
|
|
+ vist.tname=name;
|
|
useridMatch.Add(id);
|
|
useridMatch.Add(id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -121,11 +145,25 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
case bool when node.Path.Contains("tmdid")||node.Path.Contains("id")||node.Path.Contains("teacherId")
|
|
case bool when node.Path.Contains("tmdid")||node.Path.Contains("id")||node.Path.Contains("teacherId")
|
|
||node.Path.Contains("teacher")||node.Path.Contains("tid")||node.Path.Contains("tId")||node.Path.Contains("userid")
|
|
||node.Path.Contains("teacher")||node.Path.Contains("tid")||node.Path.Contains("tId")||node.Path.Contains("userid")
|
|
- ||node.Path.Contains("userId")||node.Path.Contains("studentId")||node.Path.Contains("student")||node.Path.Contains("studentid"):
|
|
|
|
|
|
+ ||node.Path.Contains("userId"):
|
|
{
|
|
{
|
|
if (!string.IsNullOrWhiteSpace($"{node}") && long.TryParse($"{node}", out long _id))
|
|
if (!string.IsNullOrWhiteSpace($"{node}") && long.TryParse($"{node}", out long _id))
|
|
{
|
|
{
|
|
|
|
+ vist.userId=$"{node}";
|
|
|
|
+ vist.scope="teahcer";
|
|
useridMatch.Add($"{node}");
|
|
useridMatch.Add($"{node}");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case bool when node.Path.Contains("studentId")||node.Path.Contains("student")||node.Path.Contains("studentid"):
|
|
|
|
+ {
|
|
|
|
+ if (!string.IsNullOrWhiteSpace($"{node}") && long.TryParse($"{node}", out long _id))
|
|
|
|
+ {
|
|
|
|
+ vist.userId=$"{node}";
|
|
|
|
+ vist.scope="student";
|
|
|
|
+ useridMatch.Add($"{node}");
|
|
|
|
+
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -135,6 +173,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
{
|
|
{
|
|
if (long.TryParse($"{node}", out long _id))
|
|
if (long.TryParse($"{node}", out long _id))
|
|
{
|
|
{
|
|
|
|
+ vist.userId=$"{node}";
|
|
useridMatch.Add($"{node}");
|
|
useridMatch.Add($"{node}");
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -144,6 +183,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
{
|
|
{
|
|
if (long.TryParse(_code, out long _codeid))
|
|
if (long.TryParse(_code, out long _codeid))
|
|
{
|
|
{
|
|
|
|
+ vist.userId=$"{node}";
|
|
useridMatch.Add($"{_code}");
|
|
useridMatch.Add($"{_code}");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -155,9 +195,43 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (log.path.Contains("process-notify",StringComparison.OrdinalIgnoreCase)) {
|
|
|
|
+ string s= log.param.ToJsonString().Replace("\\","");
|
|
|
|
+ Regex regextmdid = new Regex("\"tmdid\":\"(\\d+)\"");
|
|
|
|
+ Match matchtmdid = regextmdid.Match(s);
|
|
|
|
+ if (matchtmdid.Success)
|
|
|
|
+ {
|
|
|
|
+ var t= matchtmdid.Groups[1].Value;
|
|
|
|
+
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(t)) {
|
|
|
|
+ vist.userId=t;
|
|
|
|
+ vist.scope="teahcer";
|
|
|
|
+ useridMatch.Add(t);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Regex regexname = new Regex("\"tmdname\":\"(.+?)\"");
|
|
|
|
+ Match matchname = regexname.Match(s);
|
|
|
|
+ if (matchname.Success)
|
|
|
|
+ {
|
|
|
|
+ var t = matchname.Groups[1].Value;
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(t))
|
|
|
|
+ {
|
|
|
|
+ vist.tname=t;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (string.IsNullOrWhiteSpace(vist.school))
|
|
|
|
|
|
+ else {
|
|
|
|
+ if (string.IsNullOrWhiteSpace($"{vist.scope}"))
|
|
|
|
+ {
|
|
|
|
+ vist.scope="teacher";
|
|
|
|
+ uuidInfo.Add((uuid, log, new List<string>() { vist.userId }, new List<string>()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrWhiteSpace(vist.school) || vist.school.Equals("true") || vist.school.Equals("false") )
|
|
{
|
|
{
|
|
|
|
+ vist.school="";
|
|
string path = "$..['school','id','schoolId','schoolid','schoolCode','school_code','schoolcode','code']";
|
|
string path = "$..['school','id','schoolId','schoolid','schoolCode','school_code','schoolcode','code']";
|
|
JObject jsonObject = JObject.Parse(log.param.GetRawText());
|
|
JObject jsonObject = JObject.Parse(log.param.GetRawText());
|
|
var nodes_path = jsonObject.SelectTokens(path);
|
|
var nodes_path = jsonObject.SelectTokens(path);
|
|
@@ -171,16 +245,18 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
case bool when node.Path.Contains("school")||node.Path.Contains("id")||node.Path.Contains("schoolId")
|
|
case bool when node.Path.Contains("school")||node.Path.Contains("id")||node.Path.Contains("schoolId")
|
|
||node.Path.Contains("schoolid")||node.Path.Contains("schoolCode")||node.Path.Contains("school_code")||node.Path.Contains("schoolcode"):
|
|
||node.Path.Contains("schoolid")||node.Path.Contains("schoolCode")||node.Path.Contains("school_code")||node.Path.Contains("schoolcode"):
|
|
{
|
|
{
|
|
- if (!$"{node}".Contains("-")&& $"{node}".Length<=8)
|
|
|
|
|
|
+ if (!$"{node}".Contains("-")&& $"{node}".Length<=8 && $"{node}".Length>=1)
|
|
{
|
|
{
|
|
|
|
+ vist.school=$"{node}";
|
|
schoolMatch.Add($"{node}");
|
|
schoolMatch.Add($"{node}");
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case bool when node.Path.Contains("code"):
|
|
case bool when node.Path.Contains("code"):
|
|
{
|
|
{
|
|
- if (!$"{node}".Contains("-")&& $"{node}".Length<=8)
|
|
|
|
|
|
+ if (!$"{node}".Contains("-")&& $"{node}".Length<=8&& $"{node}".Length>=1)
|
|
{
|
|
{
|
|
|
|
+ vist.school=$"{node}";
|
|
schoolMatch.Add($"{node}");
|
|
schoolMatch.Add($"{node}");
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -188,8 +264,9 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
string[] codes = $"{node}".Split("-");
|
|
string[] codes = $"{node}".Split("-");
|
|
foreach (var _code in codes)
|
|
foreach (var _code in codes)
|
|
{
|
|
{
|
|
- if ($"{node}".Length<=8)
|
|
|
|
|
|
+ if ($"{_code}".Length<=8 && $"{_code}".Length>=1)
|
|
{
|
|
{
|
|
|
|
+ vist.school=$"{_code}";
|
|
schoolMatch.Add($"{_code}");
|
|
schoolMatch.Add($"{_code}");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -201,9 +278,22 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ if (log.path.Contains("process-notify", StringComparison.OrdinalIgnoreCase))
|
|
|
|
+ {
|
|
|
|
+ string s = log.param.ToJsonString().Replace("\\", "");
|
|
|
|
+ Regex regexname = new Regex("\"schoolId\":\"(.+?)\"");
|
|
|
|
+ Match matchname = regexname.Match(s);
|
|
|
|
+ if (matchname.Success)
|
|
|
|
+ {
|
|
|
|
+ var t = matchname.Groups[1].Value;
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(t))
|
|
|
|
+ {
|
|
|
|
+ vist.school=t;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
//处理 client
|
|
//处理 client
|
|
{
|
|
{
|
|
@@ -228,6 +318,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
if (log.client.Equals("HiTA", StringComparison.OrdinalIgnoreCase))
|
|
if (log.client.Equals("HiTA", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
{
|
|
vist.client="hita";
|
|
vist.client="hita";
|
|
|
|
+ vist.scope="teacher";
|
|
}
|
|
}
|
|
if (log.client.Equals("HiTeachCC", StringComparison.OrdinalIgnoreCase))
|
|
if (log.client.Equals("HiTeachCC", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
{
|
|
@@ -235,6 +326,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
if (log.client.Equals("HiTeach", StringComparison.OrdinalIgnoreCase))
|
|
if (log.client.Equals("HiTeach", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
{
|
|
|
|
+ vist.scope="teacher";
|
|
vist.client="hiteach";
|
|
vist.client="hiteach";
|
|
}
|
|
}
|
|
if (log.client.Equals("Open", StringComparison.OrdinalIgnoreCase))
|
|
if (log.client.Equals("Open", StringComparison.OrdinalIgnoreCase))
|
|
@@ -245,124 +337,129 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
//补全站点
|
|
//补全站点
|
|
{
|
|
{
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teammodelos-yx.chinacloudsites.cn")||log.host.Equals("teammodelos.chinacloudsites.cn")
|
|
|
|
- ||log.host.Equals("yx.teammodel.cn")))
|
|
|
|
|
|
+ if (
|
|
|
|
+ (log.host.Equals("wwww.teammodel.net")||log.host.Equals("ies5-rc.teammodel.net")))
|
|
{
|
|
{
|
|
- log.host="IES-正式站";
|
|
|
|
- log.host="www.teammodel.cn";
|
|
|
|
|
|
+ vist.hostName="国际站";
|
|
|
|
+ vist.host="www.teammodel.net";
|
|
vist.client="ies5";
|
|
vist.client="ies5";
|
|
|
|
+ vist.l="Global";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("scyx.teammodel.cn") ||log.host.Equals("jinniu.teammodel.cn")))
|
|
|
|
|
|
+ else if (
|
|
|
|
+ log.host.Equals("teammodelos-yx.chinacloudsites.cn")||log.host.Equals("teammodelos.chinacloudsites.cn")
|
|
|
|
+ ||log.host.Equals("yx.teammodel.cn")||log.host.Equals("teammodelos-rc.chinacloudsites.cn")||log.host.Equals("rc.teammodel.cn")|| log.host.Equals("www.teammodel.cn"))
|
|
{
|
|
{
|
|
- log.host="研修2.0-正式站";
|
|
|
|
- log.host="scyx.teammodel.cn";
|
|
|
|
- vist.client="ability";
|
|
|
|
|
|
+ vist.hostName="大陆站";
|
|
|
|
+ vist.host="www.teammodel.cn";
|
|
|
|
+ vist.client="ies5"; vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("open.teammodel.cn")))
|
|
|
|
|
|
+ else if ((log.host.Contains("localhost") && log.p.Equals("os"))|| log.host.Equals("teammodelos-test.chinacloudsites.cn") ||log.host.Equals("test.teammodel.cn"))
|
|
{
|
|
{
|
|
- log.host="开放平台-正式站";
|
|
|
|
- log.host="open.teammodel.cn";
|
|
|
|
- vist.client="open";
|
|
|
|
|
|
+ vist.hostName="测试站";
|
|
|
|
+ vist.host="test.teammodel.cn";
|
|
|
|
+ vist.client="ies5"; vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("open-test.teammodel.cn") ||log.host.Equals("zhiyin-test.teammodel.cn")))
|
|
|
|
|
|
+ else if (
|
|
|
|
+ (log.host.Equals("scyx.teammodel.cn") ||log.host.Equals("jinniu.teammodel.cn")))
|
|
{
|
|
{
|
|
- log.host="开放平台-测试站";
|
|
|
|
- log.host="open-test.teammodel.cn";
|
|
|
|
- vist.client="open";
|
|
|
|
|
|
+ vist.hostName="研修2.0";
|
|
|
|
+ vist.host="scyx.teammodel.cn";
|
|
|
|
+ vist.client="ability"; vist.l="China";
|
|
}
|
|
}
|
|
-
|
|
|
|
- //
|
|
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teammodelos-rc.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (
|
|
|
|
+ log.host.Equals("open.teammodel.cn")||log.host.Equals("open-test.teammodel.cn") ||log.host.Equals("zhiyin-test.teammodel.cn"))
|
|
{
|
|
{
|
|
- log.host="IES-RC站";
|
|
|
|
- log.host="rc.teammodel.cn";
|
|
|
|
- vist.client="ies5";
|
|
|
|
|
|
+ vist.hostName="开放平台";
|
|
|
|
+ vist.host="open.teammodel.cn";
|
|
|
|
+ vist.client="open"; vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teammodelos-test.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if ((log.host.Equals("bi-rc.teammodel.net") || log.host.Equals("bi.teammodel.net")))
|
|
{
|
|
{
|
|
- log.host="IES-测试站";
|
|
|
|
- log.host="test.teammodel.cn";
|
|
|
|
- vist.client="ies5";
|
|
|
|
- }
|
|
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teammodelbi-test.chinacloudsites.cn")))
|
|
|
|
- {
|
|
|
|
- log.host="BI-测试站";
|
|
|
|
- log.host="bitest.teammodel.cn";
|
|
|
|
- vist.client="bi";
|
|
|
|
- }
|
|
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teammodelbi.chinacloudsites.cn")))
|
|
|
|
- {
|
|
|
|
- log.host="BI-正式站";
|
|
|
|
- log.host="bi.teammodel.cn";
|
|
|
|
|
|
+ vist.hostName="国际站";
|
|
|
|
+ vist.host="bi.teammodel.net";
|
|
vist.client="bi";
|
|
vist.client="bi";
|
|
|
|
+ if (string.IsNullOrWhiteSpace(vist.scope))
|
|
|
|
+ {
|
|
|
|
+ vist.scope="admin";
|
|
|
|
+ }
|
|
|
|
+ vist.l="Global";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("teamcontest.chinacloudsites.cn")))
|
|
|
|
- {
|
|
|
|
- log.host="赛课-正式站";
|
|
|
|
- log.host="contest.teammodel.cn";
|
|
|
|
- vist.client="contest";
|
|
|
|
|
|
|
|
- }
|
|
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("contest.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (log.host.Equals("teammodelbi.chinacloudsites.cn") ||log.host.Equals("bi.teammodel.cn"))
|
|
{
|
|
{
|
|
- log.host="赛课-正式站";
|
|
|
|
- log.host="contest.teammodel.cn";
|
|
|
|
- vist.client="contest";
|
|
|
|
|
|
+ vist.hostName="大陆站";
|
|
|
|
+ vist.host="bi.teammodel.cn";
|
|
|
|
+ vist.client="bi";
|
|
|
|
+ if (string.IsNullOrWhiteSpace(vist.scope))
|
|
|
|
+ {
|
|
|
|
+ vist.scope="admin";
|
|
|
|
+ }
|
|
|
|
+ vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("contest-test.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (log.host.Equals("bitest.teammodel.cn")||log.host.Equals("teammodelbi-test.chinacloudsites.cn")||(log.host.Contains("localhost") && (log.p.Equals("bi"))))
|
|
{
|
|
{
|
|
- log.host="赛课-测试站";
|
|
|
|
- log.host="contest-test.teammodel.cn";
|
|
|
|
- vist.client="contest";
|
|
|
|
|
|
+ vist.hostName="测试站";
|
|
|
|
+ vist.host="testbi.teammodel.cn";
|
|
|
|
+ vist.client="bi";
|
|
|
|
+ if (string.IsNullOrWhiteSpace(vist.scope)) {
|
|
|
|
+ vist.scope="admin";
|
|
|
|
+ }
|
|
|
|
+ vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("hiteachcc.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (
|
|
|
|
+ log.host.Equals("teamcontest.chinacloudsites.cn")||log.host.Equals("contest.chinacloudsites.cn")||log.host.Equals("contest-test.chinacloudsites.cn"))
|
|
{
|
|
{
|
|
- log.host="CC-正式站";
|
|
|
|
- log.host="hiteachcc.teammodel.cn";
|
|
|
|
- vist.client="hiteachcc";
|
|
|
|
|
|
+ vist.hostName="大陆站";
|
|
|
|
+ vist.host="contest.teammodel.cn";
|
|
|
|
+ vist.client="contest"; vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host) &&(log.host.Equals("appraisal.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (
|
|
|
|
+ log.host.Equals("hiteachcc.chinacloudsites.cn"))
|
|
{
|
|
{
|
|
- log.host="评价-正式站";
|
|
|
|
- log.host="appraisal.teammodel.cn";
|
|
|
|
- vist.client="appraisal";
|
|
|
|
|
|
+ vist.hostName="正式站";
|
|
|
|
+ vist.host="hiteachcc.teammodel.cn";
|
|
|
|
+ vist.client="hiteachcc";
|
|
|
|
+ vist.l="China";
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(log.host)
|
|
|
|
- &&(log.host.Equals("appraisal-test.chinacloudsites.cn")))
|
|
|
|
|
|
+ else if (log.host.Equals("appraisal.chinacloudsites.cn"))
|
|
{
|
|
{
|
|
- log.host="评价-测试站";
|
|
|
|
- log.host="appraisal-test.teammodel.cn";
|
|
|
|
- vist.client="appraisal";
|
|
|
|
|
|
+ vist.hostName="大陆站";
|
|
|
|
+ vist.host="appraisal.teammodel.cn";
|
|
|
|
+ vist.client="appraisal";
|
|
|
|
+ vist.l="China";
|
|
}
|
|
}
|
|
- if (log.host.Equals("localhost") && log.p.Equals("appraisal"))
|
|
|
|
|
|
+ else if ((log.host.Contains("localhost") && log.p.Equals("appraisal"))||log.host.Equals("appraisal-test.teammodel.cn") ||log.host.Equals("appraisal-test.chinacloudsites.cn"))
|
|
{
|
|
{
|
|
- log.host="评价-测试站";
|
|
|
|
- log.host="appraisal-test.teammodel.cn";
|
|
|
|
|
|
+ vist.hostName="测试站";
|
|
|
|
+ vist.host="appraisal-test.teammodel.cn";
|
|
vist.client="appraisal";
|
|
vist.client="appraisal";
|
|
|
|
+ vist.l="China";
|
|
}
|
|
}
|
|
- if (log.host.Equals("localhost") && log.p.Equals("os"))
|
|
|
|
- {
|
|
|
|
- log.host="IES-测试站";
|
|
|
|
- log.host="test.teammodel.cn";
|
|
|
|
- vist.client="ies5";
|
|
|
|
- }
|
|
|
|
- else if (log.host.Equals("localhost") && (log.p.Equals("bi")))
|
|
|
|
- {
|
|
|
|
- log.host="BI-测试站";
|
|
|
|
- log.host="bitest.teammodel.cn";
|
|
|
|
- vist.client="bi";
|
|
|
|
|
|
+ else {
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(log.p))
|
|
|
|
+ {
|
|
|
|
+ vist.client=log.p.Equals("os",StringComparison.OrdinalIgnoreCase)?"ies5": log.p;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ vist.client="other";
|
|
|
|
+ }
|
|
|
|
+ if (log.host.EndsWith(".cn"))
|
|
|
|
+ {
|
|
|
|
+ vist.hostName="大陆站";
|
|
|
|
+ vist.l="China";
|
|
|
|
+ }
|
|
|
|
+ else if (log.host.EndsWith(".net"))
|
|
|
|
+ {
|
|
|
|
+ vist.hostName="国际站";
|
|
|
|
+ vist.l="Global";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ vist.hostName="其他";
|
|
|
|
+ vist.l="其他";
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -373,7 +470,14 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
{
|
|
{
|
|
vist.client="ability";
|
|
vist.client="ability";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if (log.path.Contains("teahcer") )
|
|
|
|
+ {
|
|
|
|
+ vist.scope="teahcer";
|
|
|
|
+ }
|
|
|
|
+ if (log.path.Contains("tmduer"))
|
|
|
|
+ {
|
|
|
|
+ vist.scope=Constant.ScopeTmdUser;
|
|
|
|
+ }
|
|
if (log.path.StartsWith("/activity"))
|
|
if (log.path.StartsWith("/activity"))
|
|
{
|
|
{
|
|
vist.client="contest";
|
|
vist.client="contest";
|
|
@@ -390,9 +494,16 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
if (log.path.Contains("art") ||log.path.Contains("aclassone/find-children-activity") ||log.path.Contains("aclassone/find-teacher-activity") ||log.path.Contains("aclassone/find-summary-activity") ||log.path.Contains("aclassone/upload-all") ||log.path.Contains("aclassone/delete"))
|
|
if (log.path.Contains("art") ||log.path.Contains("aclassone/find-children-activity") ||log.path.Contains("aclassone/find-teacher-activity") ||log.path.Contains("aclassone/find-summary-activity") ||log.path.Contains("aclassone/upload-all") ||log.path.Contains("aclassone/delete"))
|
|
{
|
|
{
|
|
vist.client="art";
|
|
vist.client="art";
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if (log.path.Contains("common/exam/upsert-record"))
|
|
|
|
+ {
|
|
|
|
+ JObject jobject = JObject.Parse(log.param.GetRawText());
|
|
|
|
+ var jtokens = jobject.SelectTokens("$..artId");
|
|
|
|
+ if (jtokens!=null && jtokens.Count()>0) {
|
|
|
|
+ vist.client="art";
|
|
|
|
+ vist.scope=Constant.ScopeStudent;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (log.path.Contains("habb"))
|
|
if (log.path.Contains("habb"))
|
|
{
|
|
{
|
|
vist.client="habb";
|
|
vist.client="habb";
|
|
@@ -418,7 +529,6 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
{
|
|
{
|
|
vist.client="sokrate";
|
|
vist.client="sokrate";
|
|
}
|
|
}
|
|
-
|
|
|
|
if (log.path.Contains("hiteach"))
|
|
if (log.path.Contains("hiteach"))
|
|
{
|
|
{
|
|
vist.client="hiteach";
|
|
vist.client="hiteach";
|
|
@@ -430,7 +540,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
//从token的role 能否获取 开放平台
|
|
//从token的role 能否获取 开放平台
|
|
//单点登录及第三方接口
|
|
//单点登录及第三方接口
|
|
- if (log.path.Contains("lepei") || log.path.Contains("sc/") || log.path.Contains("/sso") || log.path.Contains("sc-init") || log.path.Contains("data-push") || log.path.Contains("xkw")|| log.path.Contains("tianbo")
|
|
|
|
|
|
+ if (log.path.Contains("lepei") || log.path.Contains("sc/") || log.path.Contains("/sso") || log.path.Contains("sc-init")|| log.path.Contains("moofen") || log.path.Contains("data-push") || log.path.Contains("xkw")|| log.path.Contains("tianbo")
|
|
|| log.path.Contains("oauth/check-bind")|| log.path.Contains("dingding") || log.path.Contains("wechat")
|
|
|| log.path.Contains("oauth/check-bind")|| log.path.Contains("dingding") || log.path.Contains("wechat")
|
|
)
|
|
)
|
|
{
|
|
{
|
|
@@ -439,11 +549,14 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
}
|
|
}
|
|
|
|
|
|
//处理IP转地区
|
|
//处理IP转地区
|
|
- vist.region=await _ipSearcher.SearchIpAsync(vist.ip);
|
|
|
|
- if (!string.IsNullOrWhiteSpace(vist.region))
|
|
|
|
|
|
+ var region=await _ipSearcher.SearchIpAsync(vist.ip);
|
|
|
|
+ if (string.IsNullOrWhiteSpace(region)) {
|
|
|
|
+ region="未知IP·未知IP·未知IP";
|
|
|
|
+ }
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(region))
|
|
{
|
|
{
|
|
- vist.region= vist.region.Replace("省·", "·").Replace("市·", "·").Replace("特别行政区·", "·").Replace("藏族羌族自治州·", "·");
|
|
|
|
- var regions = vist.region.Split("·");
|
|
|
|
|
|
+ region= region.Replace("省·", "·").Replace("市·", "·").Replace("特别行政区·", "·").Replace("藏族羌族自治州·", "·");
|
|
|
|
+ var regions = region.Split("·");
|
|
if (regions.Length==4)
|
|
if (regions.Length==4)
|
|
{
|
|
{
|
|
vist.area= regions[0];
|
|
vist.area= regions[0];
|
|
@@ -465,6 +578,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
vist.area= regions[0];
|
|
vist.area= regions[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
//处理地区转经纬度
|
|
//处理地区转经纬度
|
|
{
|
|
{
|
|
IEnumerable<JToken> tokens = default;
|
|
IEnumerable<JToken> tokens = default;
|
|
@@ -519,26 +633,124 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
{
|
|
{
|
|
tokens= _longitudeLatitudeTranslator.regionJson.SelectTokens($"$..[?(@.country=~ /.*{vist.area}/i && @.m=='1')]");
|
|
tokens= _longitudeLatitudeTranslator.regionJson.SelectTokens($"$..[?(@.country=~ /.*{vist.area}/i && @.m=='1')]");
|
|
}
|
|
}
|
|
- if (tokens!= null && tokens!=default && tokens.Any() && tokens.Count()>0)
|
|
|
|
|
|
+ if ( tokens!=null && tokens.Any() )
|
|
{
|
|
{
|
|
List<RegionLngLat> regionLngLats = new List<RegionLngLat>();
|
|
List<RegionLngLat> regionLngLats = new List<RegionLngLat>();
|
|
foreach (JToken token in tokens)
|
|
foreach (JToken token in tokens)
|
|
{
|
|
{
|
|
regionLngLats.Add(token.ToString().ToObject<RegionLngLat>());
|
|
regionLngLats.Add(token.ToString().ToObject<RegionLngLat>());
|
|
}
|
|
}
|
|
- var region = regionLngLats.FindAll(x => string.IsNullOrWhiteSpace(x.area));
|
|
|
|
- if (!region.IsNotEmpty())
|
|
|
|
|
|
+ var points = regionLngLats.FindAll(x => string.IsNullOrWhiteSpace(x.area));
|
|
|
|
+ if (!points.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ points= regionLngLats.FindAll(x => !string.IsNullOrWhiteSpace(x.m) && x.m.Equals("1"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ vist.lat=points?.FirstOrDefault()?.lat;
|
|
|
|
+ vist.lng=points?.FirstOrDefault()?.lng;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ if (vist.area.Equals("内网IP"))
|
|
|
|
+ {
|
|
|
|
+ if (vist.host.Contains(".cn") || vist.host.Contains("localhost"))
|
|
|
|
+ {
|
|
|
|
+ vist.lat="30.655821878416408";
|
|
|
|
+ vist.lng="104.08153351042463";
|
|
|
|
+ vist.area="中国";
|
|
|
|
+ vist.province="四川";
|
|
|
|
+ vist.city="成都";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ vist.lat="25.044332";
|
|
|
|
+ vist.lng="121.509062";
|
|
|
|
+ vist.area="中国";
|
|
|
|
+ vist.province="台湾";
|
|
|
|
+ vist.city="台湾";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- region= regionLngLats.FindAll(x => !string.IsNullOrWhiteSpace(x.m) && x.m.Equals("1"));
|
|
|
|
|
|
+ vist.lat="30.655821878416408";
|
|
|
|
+ vist.lng="104.08153351042463";
|
|
|
|
+ vist.area="中国";
|
|
|
|
+ vist.province="四川";
|
|
|
|
+ vist.city="成都";
|
|
}
|
|
}
|
|
- vist.point= region?.FirstOrDefault();
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- vist.host= log.host;
|
|
|
|
- vist.hostName=log.hostName;
|
|
|
|
|
|
+
|
|
uuidInfo.Add((uuid, log, useridMatch, schoolMatch));
|
|
uuidInfo.Add((uuid, log, useridMatch, schoolMatch));
|
|
vists.Add(vist);
|
|
vists.Add(vist);
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ List<(string tmd, bool exists, string scope)> tmdexists = new List<(string tmd, bool exists, string scope)>();
|
|
|
|
+ List<(string sch, bool exists)> schexists = new List<(string sch, bool exists)>();
|
|
|
|
+ var tmds = uuidInfo.SelectMany(x => x.tmdid).ToHashSet();
|
|
|
|
+ if (tmds.Any())
|
|
|
|
+ {
|
|
|
|
+ foreach (var tmd in tmds)
|
|
|
|
+ {
|
|
|
|
+ var exists = await _azureRedis.GetRedisClient().KeyExistsAsync($"Blob:Catalog:{tmd}");
|
|
|
|
+ if (exists)
|
|
|
|
+ {
|
|
|
|
+ tmdexists.Add((tmd, exists, "teacher"));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ exists = await _azureRedis.GetRedisClient().KeyExistsAsync($"Login:School:hbcn:student:{tmd}");
|
|
|
|
+ tmdexists.Add((tmd, exists, "student"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ var schs = uuidInfo.SelectMany(x => x.school).ToHashSet();
|
|
|
|
+ if (schs.Any())
|
|
|
|
+ {
|
|
|
|
+ foreach (var sch in schs)
|
|
|
|
+ {
|
|
|
|
+ var exists = await _azureRedis.GetRedisClient().KeyExistsAsync(sch);
|
|
|
|
+ schexists.Add((sch, exists));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ foreach (var item in uuidInfo)
|
|
|
|
+ {
|
|
|
|
+ foreach (var tmd in item.tmdid)
|
|
|
|
+ {
|
|
|
|
+ var tmdext = tmdexists.Find(x => x.tmd.Equals(tmd));
|
|
|
|
+ if (tmdext.tmd!= null && tmdext.exists)
|
|
|
|
+ {
|
|
|
|
+ var vist = vists.Where(x => x.id.Equals(item.uuid));
|
|
|
|
+ foreach (var vi in vist)
|
|
|
|
+ {
|
|
|
|
+ vi.userId=tmd;
|
|
|
|
+ if (string.IsNullOrWhiteSpace(vi.scope))
|
|
|
|
+ {
|
|
|
|
+ vi.scope=tmdext.scope;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var sch in item.school)
|
|
|
|
+ {
|
|
|
|
+ var schext = schexists.Find(x => x.sch.Equals(sch));
|
|
|
|
+ if (schext.sch!= null && schext.exists)
|
|
|
|
+ {
|
|
|
|
+ var vist = vists.Where(x => x.id.Equals(item.uuid));
|
|
|
|
+ foreach (var vi in vist)
|
|
|
|
+ {
|
|
|
|
+ vi.school=sch;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return (vists, uuidInfo);
|
|
return (vists, uuidInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -555,23 +767,23 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 具体功能
|
|
/// 具体功能
|
|
/// </summary>
|
|
/// </summary>
|
|
- public string func { get; set; }
|
|
|
|
|
|
+ // public string func { get; set; }
|
|
|
|
|
|
public string userId { get; set; }
|
|
public string userId { get; set; }
|
|
public string scope { get; set; }
|
|
public string scope { get; set; }
|
|
public string tname { get; set; }
|
|
public string tname { get; set; }
|
|
public string school { get; set; }
|
|
public string school { get; set; }
|
|
public string ip { get; set; }
|
|
public string ip { get; set; }
|
|
- public string region { get; set; }
|
|
|
|
|
|
+ //public string region { get; set; }
|
|
public string area { get; set; }
|
|
public string area { get; set; }
|
|
public string province { get; set; }
|
|
public string province { get; set; }
|
|
- public string city { get; set; }
|
|
|
|
|
|
+ public string city { get; set; } = "";
|
|
public long time { get; set; }
|
|
public long time { get; set; }
|
|
/// <summary>
|
|
/// <summary>
|
|
///
|
|
///
|
|
/// </summary>
|
|
/// </summary>
|
|
public string host { get; set; }
|
|
public string host { get; set; }
|
|
- public string hostName = "其他";
|
|
|
|
|
|
+ public string hostName { get; set; } = "其他";
|
|
/// <summary>
|
|
/// <summary>
|
|
/// tokenid
|
|
/// tokenid
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -580,7 +792,10 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
public string month { get; set; }
|
|
public string month { get; set; }
|
|
public string day { get; set; }
|
|
public string day { get; set; }
|
|
public string hour { get; set; }
|
|
public string hour { get; set; }
|
|
- public RegionLngLat point { get; set; }
|
|
|
|
|
|
+ //public RegionLngLat point { get; set; }
|
|
|
|
+ public string lat { get; set; }
|
|
|
|
+ public string lng { get; set; }
|
|
|
|
+ public string l { get; set; }
|
|
}
|
|
}
|
|
|
|
|
|
public class HttpLog
|
|
public class HttpLog
|
|
@@ -604,6 +819,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
public string month { get; set; }
|
|
public string month { get; set; }
|
|
public string day { get; set; }
|
|
public string day { get; set; }
|
|
public string hour { get; set; }
|
|
public string hour { get; set; }
|
|
|
|
+ public string l { get; set; }
|
|
|
|
|
|
}
|
|
}
|
|
public record RegionLngLat
|
|
public record RegionLngLat
|