fix: align customer payment encryption and protect original values
Deploy olons-admin production / deploy (push) Successful in 9m19s

This commit is contained in:
richjohnrambo
2026-10-22 22:33:42 +08:00
parent 70ef3d9d04
commit 3d69d68a5d
8 changed files with 371 additions and 46 deletions
+13 -8
View File
@@ -458,6 +458,7 @@ func (s *sSysAppMember) PaymentList(ctx context.Context, in *sysin.AppMemberPaym
if row.HolderCipher != "" {
plain, decryptErr := encrypt.DecryptField(ctx, row.HolderCipher)
if decryptErr != nil {
row.SensitiveUnavailable = true
g.Log().Warningf(ctx, "收款人姓名解密失败,回退为脱敏值 memberId:%d accountId:%d err:%+v", row.MemberId, row.Id, decryptErr)
row.Holder = row.HolderMask
} else {
@@ -469,6 +470,7 @@ func (s *sSysAppMember) PaymentList(ctx context.Context, in *sysin.AppMemberPaym
if row.IdentityNoCipher != "" {
plain, decryptErr := encrypt.DecryptField(ctx, row.IdentityNoCipher)
if decryptErr != nil {
row.SensitiveUnavailable = true
g.Log().Warningf(ctx, "收款人证件号解密失败,回退为脱敏值 memberId:%d accountId:%d err:%+v", row.MemberId, row.Id, decryptErr)
row.IdentityNo = row.IdentityNoMask
} else {
@@ -480,6 +482,7 @@ func (s *sSysAppMember) PaymentList(ctx context.Context, in *sysin.AppMemberPaym
if row.MobileCipher != "" {
plain, decryptErr := encrypt.DecryptField(ctx, row.MobileCipher)
if decryptErr != nil {
row.SensitiveUnavailable = true
g.Log().Warningf(ctx, "收款手机号解密失败,回退为脱敏值 memberId:%d accountId:%d err:%+v", row.MemberId, row.Id, decryptErr)
row.Mobile = row.MobileMask
} else {
@@ -491,6 +494,7 @@ func (s *sSysAppMember) PaymentList(ctx context.Context, in *sysin.AppMemberPaym
if row.AccountNoCipher != "" {
plain, decryptErr := encrypt.DecryptField(ctx, row.AccountNoCipher)
if decryptErr != nil {
row.SensitiveUnavailable = true
g.Log().Warningf(ctx, "收款账号解密失败,回退为脱敏值 memberId:%d accountId:%d err:%+v", row.MemberId, row.Id, decryptErr)
row.AccountNo = row.AccountNoMask
} else {
@@ -502,6 +506,7 @@ func (s *sSysAppMember) PaymentList(ctx context.Context, in *sysin.AppMemberPaym
if row.DigitalRmbCodeCipher != "" {
plain, decryptErr := encrypt.DecryptField(ctx, row.DigitalRmbCodeCipher)
if decryptErr != nil {
row.SensitiveUnavailable = true
g.Log().Warningf(ctx, "数字钱包编码解密失败,回退为脱敏值 memberId:%d accountId:%d err:%+v", row.MemberId, row.Id, decryptErr)
row.DigitalRMBCode = row.DigitalRMBCodeMask
} else {
@@ -534,7 +539,7 @@ func (s *sSysAppMember) PaymentEdit(ctx context.Context, in *sysin.AppMemberPaym
data[c.AlipayQrAttachmentId] = in.AlipayQrAttachmentId
}
if in.Holder != "" {
v, e := encrypt.EncryptField(ctx, in.Holder)
v, e := encrypt.EncryptPaymentField(ctx, in.Holder)
if e != nil {
return e
}
@@ -542,7 +547,7 @@ func (s *sSysAppMember) PaymentEdit(ctx context.Context, in *sysin.AppMemberPaym
data[c.HolderMask] = encrypt.MaskName(in.Holder)
}
if in.Mobile != "" {
v, e := encrypt.EncryptField(ctx, in.Mobile)
v, e := encrypt.EncryptPaymentField(ctx, in.Mobile)
if e != nil {
return e
}
@@ -550,11 +555,11 @@ func (s *sSysAppMember) PaymentEdit(ctx context.Context, in *sysin.AppMemberPaym
data[c.MobileMask] = encrypt.MaskMobile(in.Mobile)
}
if in.IdentityNo != "" {
v, e := encrypt.EncryptField(ctx, in.IdentityNo)
v, e := encrypt.EncryptPaymentField(ctx, in.IdentityNo)
if e != nil {
return e
}
h, e := encrypt.HashField(ctx, in.IdentityNo)
h, e := encrypt.HashPaymentField(ctx, in.IdentityNo)
if e != nil {
return e
}
@@ -563,11 +568,11 @@ func (s *sSysAppMember) PaymentEdit(ctx context.Context, in *sysin.AppMemberPaym
data[c.IdentityNoMask] = encrypt.MaskAccount(in.IdentityNo)
}
if in.AccountNo != "" {
v, e := encrypt.EncryptField(ctx, in.AccountNo)
v, e := encrypt.EncryptPaymentField(ctx, in.AccountNo)
if e != nil {
return e
}
h, e := encrypt.HashField(ctx, in.AccountNo)
h, e := encrypt.HashPaymentField(ctx, in.AccountNo)
if e != nil {
return e
}
@@ -576,11 +581,11 @@ func (s *sSysAppMember) PaymentEdit(ctx context.Context, in *sysin.AppMemberPaym
data[c.AccountNoMask] = encrypt.MaskAccount(in.AccountNo)
}
if in.DigitalRMBCode != "" {
v, e := encrypt.EncryptField(ctx, in.DigitalRMBCode)
v, e := encrypt.EncryptPaymentField(ctx, in.DigitalRMBCode)
if e != nil {
return e
}
h, e := encrypt.HashField(ctx, in.DigitalRMBCode)
h, e := encrypt.HashPaymentField(ctx, in.DigitalRMBCode)
if e != nil {
return e
}