feat: mysql 列表读写切换

This commit is contained in:
ssongliu
2022-12-24 13:31:30 +08:00
committed by ssongliu
parent e1c2348e44
commit 44df6acb5d
13 changed files with 207 additions and 99 deletions

View File

@@ -85,16 +85,19 @@ func OperationLog() gin.HandlerFunc {
}
}
}
var values []interface{}
for key, value := range formatMap {
if strings.Contains(operationDic.FormatEN, key) {
operationDic.FormatZH = strings.ReplaceAll(operationDic.FormatZH, key, "%v")
operationDic.FormatEN = strings.ReplaceAll(operationDic.FormatEN, key, "%v")
values = append(values, value)
if strings.Contains(operationDic.FormatEN, "["+key+"]") {
if arrys, ok := value.([]string); ok {
operationDic.FormatZH = strings.ReplaceAll(operationDic.FormatZH, "["+key+"]", fmt.Sprintf("[%v]", strings.Join(arrys, ",")))
operationDic.FormatEN = strings.ReplaceAll(operationDic.FormatEN, "["+key+"]", fmt.Sprintf("[%v]", strings.Join(arrys, ",")))
} else {
operationDic.FormatZH = strings.ReplaceAll(operationDic.FormatZH, "["+key+"]", fmt.Sprintf("[%v]", value))
operationDic.FormatEN = strings.ReplaceAll(operationDic.FormatEN, "["+key+"]", fmt.Sprintf("[%v]", value))
}
}
}
record.DetailZH = fmt.Sprintf(operationDic.FormatZH, values...)
record.DetailEN = fmt.Sprintf(operationDic.FormatEN, values...)
record.DetailEN = operationDic.FormatEN
record.DetailZH = operationDic.FormatZH
writer := responseBodyWriter{
ResponseWriter: c.Writer,