fix: align customer payment encryption and protect original values
Deploy olons-admin production / deploy (push) Successful in 9m19s
Deploy olons-admin production / deploy (push) Successful in 9m19s
This commit is contained in:
@@ -95,6 +95,9 @@ type AppMemberEditInp struct {
|
||||
}
|
||||
|
||||
func (in *AppMemberEditInp) Filter(ctx context.Context) error {
|
||||
if err := rejectMaskedSensitiveFields(in.RealName, in.IdNo); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Id == 0 {
|
||||
return gerror.New("后台不支持创建会员,请由会员在C端完成注册")
|
||||
}
|
||||
@@ -156,6 +159,7 @@ type AppMemberPaymentListInp struct {
|
||||
func (in *AppMemberPaymentListInp) Filter(ctx context.Context) error { return nil }
|
||||
|
||||
type AppMemberPaymentModel struct {
|
||||
SensitiveUnavailable bool `json:"sensitiveUnavailable"`
|
||||
Id uint64 `json:"id"`
|
||||
MemberId uint64 `json:"memberId"`
|
||||
AccountType int `json:"accountType"`
|
||||
@@ -207,6 +211,9 @@ type AppMemberPaymentEditInp struct {
|
||||
}
|
||||
|
||||
func (in *AppMemberPaymentEditInp) Filter(ctx context.Context) error {
|
||||
if err := rejectMaskedSensitiveFields(in.Holder, in.IdentityNo, in.Mobile, in.AccountNo, in.DigitalRMBCode); err != nil {
|
||||
return err
|
||||
}
|
||||
if !dict.HasOptionKey(consts.PaymentAccountTypeOptions, in.AccountType) {
|
||||
return gerror.New("收款账户类型不合法")
|
||||
}
|
||||
@@ -260,12 +267,24 @@ type AppMemberAddressEditInp struct {
|
||||
}
|
||||
|
||||
func (in *AppMemberAddressEditInp) Filter(ctx context.Context) error {
|
||||
if err := rejectMaskedSensitiveFields(in.Receiver, in.Mobile, in.Address); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Id == 0 && (strings.TrimSpace(in.Receiver) == "" || strings.TrimSpace(in.Mobile) == "" || strings.TrimSpace(in.Address) == "") {
|
||||
return gerror.New("新增地址时收货人、手机号和详细地址不能为空")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func rejectMaskedSensitiveFields(values ...string) error {
|
||||
for _, value := range values {
|
||||
if strings.Contains(value, "*") {
|
||||
return gerror.New("不能保存带星号的脱敏资料,请填写完整信息或留空保留原值")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AppMemberAddressDeleteInp struct {
|
||||
Id uint64 `json:"id" v:"required|min:1#地址ID不能为空|地址ID不能为空"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user