This commit is contained in:
2026-05-01 14:09:46 +08:00
5 changed files with 39 additions and 16 deletions

View File

@@ -105,6 +105,8 @@ type (
LevelName string `json:"level_name"` // 等级名称 LevelName string `json:"level_name"` // 等级名称
Region string `json:"region"` // 区域 Region string `json:"region"` // 区域
Mobile string `json:"mobile"` // 手机号 Mobile string `json:"mobile"` // 手机号
RealName string `json:"real_name"` // 姓名(来自实名表)
IdCard string `json:"id_card"` // 身份证(解密后明文返回)
WechatId string `json:"wechat_id"` // 微信号 WechatId string `json:"wechat_id"` // 微信号
TeamLeaderId string `json:"team_leader_id"` // 团队首领ID TeamLeaderId string `json:"team_leader_id"` // 团队首领ID
AgentCode int64 `json:"agent_code"` AgentCode int64 `json:"agent_code"`

View File

@@ -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"
@@ -79,11 +80,25 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
// 查询钱包信息 // 查询钱包信息
wallet, _ := l.svcCtx.AgentWalletModel.FindOneByAgentId(l.ctx, agent.Id) wallet, _ := l.svcCtx.AgentWalletModel.FindOneByAgentId(l.ctx, agent.Id)
// 查询实名认证信息 // 查询实名认证信息(数据库姓名明文、身份证密文,解密后明文返回不脱敏)
realNameInfo, _ := l.svcCtx.AgentRealNameModel.FindOneByAgentId(l.ctx, agent.Id) realNameInfo, _ := l.svcCtx.AgentRealNameModel.FindOneByAgentId(l.ctx, agent.Id)
isRealName := false isRealName := false
if realNameInfo != nil && realNameInfo.VerifyTime.Valid { realName := ""
isRealName = true // verify_time不为空表示已通过三要素核验 idCardPlain := "" // 解密后明文返回
if realNameInfo != nil {
if realNameInfo.VerifyTime.Valid {
isRealName = true // verify_time不为空表示已通过三要素核验
}
realName = realNameInfo.Name
if realNameInfo.IdCard != "" {
key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey)
if keyErr == nil {
decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, key)
if err == nil {
idCardPlain = decrypted
}
}
}
} }
wechatId := "" wechatId := ""
@@ -108,6 +123,8 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
LevelName: levelName, LevelName: levelName,
Region: region, Region: region,
Mobile: agent.Mobile, Mobile: agent.Mobile,
RealName: realName,
IdCard: idCardPlain,
WechatId: wechatId, WechatId: wechatId,
TeamLeaderId: teamLeaderId, TeamLeaderId: teamLeaderId,
AgentCode: agent.AgentCode, AgentCode: agent.AgentCode,

View File

@@ -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
}
} }
} }
} }

View File

@@ -1609,7 +1609,6 @@ func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error
if err != nil { if err != nil {
return nil, err return nil, err
} }
return convertTianyuanResponse(resp) return convertTianyuanResponse(resp)
} }

View File

@@ -1053,6 +1053,8 @@ type AgentListItem struct {
LevelName string `json:"level_name"` // 等级名称 LevelName string `json:"level_name"` // 等级名称
Region string `json:"region"` // 区域 Region string `json:"region"` // 区域
Mobile string `json:"mobile"` // 手机号 Mobile string `json:"mobile"` // 手机号
RealName string `json:"real_name"` // 姓名(来自实名表)
IdCard string `json:"id_card"` // 身份证(解密后明文返回)
WechatId string `json:"wechat_id"` // 微信号 WechatId string `json:"wechat_id"` // 微信号
TeamLeaderId string `json:"team_leader_id"` // 团队首领ID TeamLeaderId string `json:"team_leader_id"` // 团队首领ID
AgentCode int64 `json:"agent_code"` AgentCode int64 `json:"agent_code"`