mirror of https://github.com/bjdgyc/anylink.git
修复test错误问题
This commit is contained in:
parent
eb8d55040c
commit
c8b34bd772
|
@ -40,11 +40,12 @@ var (
|
||||||
2: "Linux",
|
2: "Linux",
|
||||||
3: "Android",
|
3: "Android",
|
||||||
4: "iOS",
|
4: "iOS",
|
||||||
|
5: "Unknown",
|
||||||
},
|
},
|
||||||
ClientOps: []string{ // 客户端
|
ClientOps: []string{ // 客户端
|
||||||
0: "AnyConnect",
|
0: "AnyConnect",
|
||||||
1: "OpenConnect",
|
1: "OpenConnect",
|
||||||
2: "unknown",
|
2: "Unknown",
|
||||||
},
|
},
|
||||||
InfoOps: []string{ // 信息
|
InfoOps: []string{ // 信息
|
||||||
0: "用户掉线",
|
0: "用户掉线",
|
||||||
|
@ -56,6 +57,7 @@ var (
|
||||||
|
|
||||||
// 异步写入用户操作日志
|
// 异步写入用户操作日志
|
||||||
func (ua *UserActLogProcess) Add(u UserActLog, userAgent string) {
|
func (ua *UserActLogProcess) Add(u UserActLog, userAgent string) {
|
||||||
|
// os, client, ver
|
||||||
os_idx, client_idx, ver := ua.ParseUserAgent(userAgent)
|
os_idx, client_idx, ver := ua.ParseUserAgent(userAgent)
|
||||||
u.Os = os_idx
|
u.Os = os_idx
|
||||||
u.Client = client_idx
|
u.Client = client_idx
|
||||||
|
@ -107,6 +109,10 @@ func (ua *UserActLogProcess) GetInfoOpsById(id uint8) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ua *UserActLogProcess) ParseUserAgent(userAgent string) (os_idx, client_idx uint8, ver string) {
|
func (ua *UserActLogProcess) ParseUserAgent(userAgent string) (os_idx, client_idx uint8, ver string) {
|
||||||
|
// Unknown
|
||||||
|
if len(userAgent) == 0 {
|
||||||
|
return 5, 2, ""
|
||||||
|
}
|
||||||
// os
|
// os
|
||||||
os_idx = 2
|
os_idx = 2
|
||||||
if strings.Contains(userAgent, "windows") {
|
if strings.Contains(userAgent, "windows") {
|
||||||
|
|
Loading…
Reference in New Issue