This commit is contained in:
Mrx
2026-03-11 18:26:09 +08:00
parent 021349c60e
commit 96a02f73d4
3 changed files with 39 additions and 34 deletions

View File

@@ -109,6 +109,7 @@ type (
FrozenBalance float64 `json:"frozen_balance"` // 冻结余额 FrozenBalance float64 `json:"frozen_balance"` // 冻结余额
WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额 WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额
IsRealName bool `json:"is_real_name"` // 是否已实名 IsRealName bool `json:"is_real_name"` // 是否已实名
RealName string `json:"real_name"` // 姓名(实名认证的姓名)
IdCardPlain string `json:"id_card_plain"` // 身份证号(解密后的明文) IdCardPlain string `json:"id_card_plain"` // 身份证号(解密后的明文)
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
} }

View File

@@ -80,26 +80,28 @@ 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
idCardPlain := "" // 解密后明文返回 realName := ""
if realNameInfo != nil { idCardPlain := "" // 解密后明文返回
if realNameInfo.VerifyTime.Valid { if realNameInfo != nil {
isRealName = true // verify_time不为空表示已通过三要素核验 if realNameInfo.VerifyTime.Valid {
} isRealName = true // verify_time不为空表示已通过三要素核验
if realNameInfo.IdCard != "" { }
key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey) realName = realNameInfo.Name
if keyErr == nil { if realNameInfo.IdCard != "" {
decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, key) 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
}
} }
} }
} }
}
wechatId := "" wechatId := ""
if agent.WechatId.Valid { if agent.WechatId.Valid {
wechatId = agent.WechatId.String wechatId = agent.WechatId.String
} }
@@ -114,24 +116,25 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR
region = agent.Region.String region = agent.Region.String
} }
item := types.AgentListItem{ item := types.AgentListItem{
Id: agent.Id, Id: agent.Id,
UserId: agent.UserId, UserId: agent.UserId,
Level: agent.Level, Level: agent.Level,
LevelName: levelName, LevelName: levelName,
Region: region, Region: region,
Mobile: agent.Mobile, Mobile: agent.Mobile,
WechatId: wechatId, WechatId: wechatId,
TeamLeaderId: teamLeaderId, TeamLeaderId: teamLeaderId,
AgentCode: agent.AgentCode, AgentCode: agent.AgentCode,
Balance: 0, Balance: 0,
TotalEarnings: 0, TotalEarnings: 0,
FrozenBalance: 0, FrozenBalance: 0,
WithdrawnAmount: 0, WithdrawnAmount: 0,
IsRealName: isRealName, IsRealName: isRealName,
IdCardPlain: idCardPlain, RealName: realName,
CreateTime: agent.CreateTime.Format("2006-01-02 15:04:05"), IdCardPlain: idCardPlain,
} CreateTime: agent.CreateTime.Format("2006-01-02 15:04:05"),
}
if wallet != nil { if wallet != nil {
item.Balance = wallet.Balance item.Balance = wallet.Balance

View File

@@ -1110,6 +1110,7 @@ type AgentListItem struct {
FrozenBalance float64 `json:"frozen_balance"` // 冻结余额 FrozenBalance float64 `json:"frozen_balance"` // 冻结余额
WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额 WithdrawnAmount float64 `json:"withdrawn_amount"` // 提现总额
IsRealName bool `json:"is_real_name"` // 是否已实名 IsRealName bool `json:"is_real_name"` // 是否已实名
RealName string `json:"real_name"` // 姓名(实名认证的姓名)
IdCardPlain string `json:"id_card_plain"` // 身份证号(解密后的明文) IdCardPlain string `json:"id_card_plain"` // 身份证号(解密后的明文)
CreateTime string `json:"create_time"` // 创建时间 CreateTime string `json:"create_time"` // 创建时间
} }