f
This commit is contained in:
@@ -2,6 +2,7 @@ package admin_agent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
"qnc-server/app/main/api/internal/svc"
|
"qnc-server/app/main/api/internal/svc"
|
||||||
"qnc-server/app/main/api/internal/types"
|
"qnc-server/app/main/api/internal/types"
|
||||||
@@ -90,9 +91,12 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
|
|||||||
}
|
}
|
||||||
realName = realNameInfo.Name
|
realName = realNameInfo.Name
|
||||||
if realNameInfo.IdCard != "" {
|
if realNameInfo.IdCard != "" {
|
||||||
decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, []byte(l.svcCtx.Config.Encrypt.SecretKey))
|
key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey)
|
||||||
if err == nil {
|
if keyErr == nil {
|
||||||
idCardPlain = decrypted
|
decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, key)
|
||||||
|
if err == nil {
|
||||||
|
idCardPlain = decrypted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ package admin_agent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
|
"qnc-server/app/main/api/internal/svc"
|
||||||
|
"qnc-server/app/main/api/internal/types"
|
||||||
"qnc-server/common/globalkey"
|
"qnc-server/common/globalkey"
|
||||||
"qnc-server/common/xerr"
|
"qnc-server/common/xerr"
|
||||||
"qnc-server/pkg/lzkit/crypto"
|
"qnc-server/pkg/lzkit/crypto"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"qnc-server/app/main/api/internal/svc"
|
|
||||||
"qnc-server/app/main/api/internal/types"
|
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,16 +72,19 @@ func (l *AdminGetAgentRealNameListLogic) AdminGetAgentRealNameList(req *types.Ad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解密身份证号(仅显示部分)
|
// 解密身份证号(仅显示部分,密钥与实名认证写入时一致:hex 解码后使用)
|
||||||
idCard := ""
|
idCard := ""
|
||||||
if realName.IdCard != "" {
|
if realName.IdCard != "" {
|
||||||
decrypted, err := crypto.DecryptIDCard(realName.IdCard, []byte(l.svcCtx.Config.Encrypt.SecretKey))
|
key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey)
|
||||||
if err == nil {
|
if keyErr == nil {
|
||||||
// 脱敏显示
|
decrypted, err := crypto.DecryptIDCard(realName.IdCard, key)
|
||||||
if len(decrypted) > 10 {
|
if err == nil {
|
||||||
idCard = decrypted[:3] + "***********" + decrypted[len(decrypted)-4:]
|
// 脱敏显示
|
||||||
} else {
|
if len(decrypted) > 10 {
|
||||||
idCard = decrypted
|
idCard = decrypted[:3] + "***********" + decrypted[len(decrypted)-4:]
|
||||||
|
} else {
|
||||||
|
idCard = decrypted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user