Skip to content

Commit cb0a2b4

Browse files
authored
Merge pull request #371 from actiontech/main
Main
2 parents 1b4775f + ea5c1f4 commit cb0a2b4

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

internal/dms/storage/convert.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/actiontech/dms/internal/dms/biz"
1010
"github.com/actiontech/dms/internal/dms/storage/model"
11-
"github.com/actiontech/dms/pkg/dms-common/i18nPkg"
1211
"github.com/labstack/echo/v4/middleware"
1312

1413
pkgAes "github.com/actiontech/dms/pkg/dms-common/pkg/aes"
@@ -1087,11 +1086,6 @@ func convertModelCbOperationLog(model *model.CbOperationLog) (*biz.CbOperationLo
10871086
return nil, err
10881087
}
10891088

1090-
if len(model.I18nOpDetail) == 0 && model.OpDetail != "" {
1091-
// 兼容老数据
1092-
model.I18nOpDetail = i18nPkg.ConvertStr2I18nAsDefaultLang(model.OpDetail)
1093-
}
1094-
10951089
return &biz.CbOperationLog{
10961090
UID: model.UID,
10971091
ProjectID: model.ProjectID,

internal/dms/storage/model/model.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,11 @@ type DataExportTaskRecord struct {
466466

467467
type AuditResult struct {
468468
Level string `json:"level"`
469-
Message string `json:"message"` // Deprecated: use I18nAuditResultInfo instead
470469
RuleName string `json:"rule_name"`
471470
I18nAuditResultInfo I18nAuditResultInfo `json:"i18n_audit_result_info"`
472471
}
473472

474473
func (ar *AuditResult) GetAuditMsgByLangTag(lang language.Tag) string {
475-
if len(ar.I18nAuditResultInfo) == 0 {
476-
// 兼容老数据
477-
return ar.Message
478-
}
479474
return ar.I18nAuditResultInfo.GetAuditResultInfoByLangTag(lang).Message
480475
}
481476

@@ -529,11 +524,11 @@ func (a *AuditResults) String() string {
529524
func (a *AuditResults) Append(nar *AuditResult) {
530525
for i := range *a {
531526
ar := (*a)[i]
532-
if ar.Level == nar.Level && ar.RuleName == nar.RuleName && ar.Message == nar.Message {
527+
if ar.Level == nar.Level && ar.RuleName == nar.RuleName && ar.GetAuditMsgByLangTag(i18nPkg.DefaultLang) == nar.GetAuditMsgByLangTag(i18nPkg.DefaultLang) {
533528
return
534529
}
535530
}
536-
*a = append(*a, AuditResult{Level: nar.Level, RuleName: nar.RuleName, Message: nar.Message, I18nAuditResultInfo: nar.I18nAuditResultInfo})
531+
*a = append(*a, AuditResult{Level: nar.Level, RuleName: nar.RuleName, I18nAuditResultInfo: nar.I18nAuditResultInfo})
537532
}
538533

539534
type CbOperationLog struct {
@@ -542,7 +537,6 @@ type CbOperationLog struct {
542537
OpTime *time.Time `json:"op_time"`
543538
DBServiceUID string `json:"db_service_uid" gorm:"size:32"`
544539
OpType string `json:"op_type" gorm:"size:255"`
545-
OpDetail string `json:"op_detail" gorm:"type:longtext"` // Deprecated: use I18nOpDetail instead
546540
I18nOpDetail i18nPkg.I18nStr `json:"i18n_op_detail" gorm:"column:i18n_op_detail; type:json"`
547541
OpSessionID *string `json:"op_session_id" gorm:"size:255"`
548542
ProjectID string `json:"project_id" gorm:"size:32"`

0 commit comments

Comments
 (0)