sync: 对齐小程序 v1.0.2 生产代码并脱敏
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model"
|
||||
)
|
||||
|
||||
func appDiagnosisApplyNetworkBlock(info *model.AppDiagnosisInfoItem, raw json.RawMessage) bool {
|
||||
var data struct {
|
||||
NetBlockStatus *string `json:"netBlockStatus"`
|
||||
NetBlockTypes []struct {
|
||||
BlockType string `json:"blockType"`
|
||||
BlockTypeName string `json:"blockTypeName"`
|
||||
} `json:"netBlockTypes"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &data); err != nil || data.NetBlockStatus == nil {
|
||||
return false
|
||||
}
|
||||
status := strings.TrimSpace(*data.NetBlockStatus)
|
||||
if status != "0" && status != "1" {
|
||||
return false
|
||||
}
|
||||
info.NetBlockStatus = appDiagnosisStringPtr(status)
|
||||
info.NetBlockReason = nil
|
||||
if status == "1" {
|
||||
names := make([]string, 0, len(data.NetBlockTypes))
|
||||
seen := make(map[string]bool)
|
||||
for _, item := range data.NetBlockTypes {
|
||||
name := strings.TrimSpace(item.BlockTypeName)
|
||||
if item.BlockType != "0" && name != "" && !seen[name] {
|
||||
names = append(names, name)
|
||||
seen[name] = true
|
||||
}
|
||||
}
|
||||
info.NetBlockReason = appDiagnosisStringPtr(strings.Join(names, "、"))
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user