From 0dc053420aa85939fbc78f1e6be1c117b6a2f50f Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Wed, 11 Mar 2026 15:05:51 +0800 Subject: [PATCH 1/2] f --- app/main/api/desc/admin/admin_agent.api | 2 ++ .../admin_agent/admingetagentlistlogic.go | 19 ++++++++++++++++--- .../api/internal/service/apirequestService.go | 1 - app/main/api/internal/types/types.go | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/main/api/desc/admin/admin_agent.api b/app/main/api/desc/admin/admin_agent.api index 380c381..2094386 100644 --- a/app/main/api/desc/admin/admin_agent.api +++ b/app/main/api/desc/admin/admin_agent.api @@ -105,6 +105,8 @@ type ( LevelName string `json:"level_name"` // 等级名称 Region string `json:"region"` // 区域 Mobile string `json:"mobile"` // 手机号 + RealName string `json:"real_name"` // 姓名(来自实名表) + IdCard string `json:"id_card"` // 身份证(解密后明文返回) WechatId string `json:"wechat_id"` // 微信号 TeamLeaderId string `json:"team_leader_id"` // 团队首领ID AgentCode int64 `json:"agent_code"` diff --git a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go index 15c749a..3a41e6d 100644 --- a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go +++ b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go @@ -79,11 +79,22 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR // 查询钱包信息 wallet, _ := l.svcCtx.AgentWalletModel.FindOneByAgentId(l.ctx, agent.Id) - // 查询实名认证信息 + // 查询实名认证信息(数据库姓名明文、身份证密文,解密后明文返回不脱敏) realNameInfo, _ := l.svcCtx.AgentRealNameModel.FindOneByAgentId(l.ctx, agent.Id) isRealName := false - if realNameInfo != nil && realNameInfo.VerifyTime.Valid { - isRealName = true // verify_time不为空表示已通过三要素核验 + realName := "" + idCardPlain := "" // 解密后明文返回 + if realNameInfo != nil { + if realNameInfo.VerifyTime.Valid { + isRealName = true // verify_time不为空表示已通过三要素核验 + } + realName = realNameInfo.Name + if realNameInfo.IdCard != "" { + decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, []byte(l.svcCtx.Config.Encrypt.SecretKey)) + if err == nil { + idCardPlain = decrypted + } + } } wechatId := "" @@ -108,6 +119,8 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR LevelName: levelName, Region: region, Mobile: agent.Mobile, + RealName: realName, + IdCard: idCardPlain, WechatId: wechatId, TeamLeaderId: teamLeaderId, AgentCode: agent.AgentCode, diff --git a/app/main/api/internal/service/apirequestService.go b/app/main/api/internal/service/apirequestService.go index 1afbaf4..e1b5a07 100644 --- a/app/main/api/internal/service/apirequestService.go +++ b/app/main/api/internal/service/apirequestService.go @@ -1574,6 +1574,5 @@ func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error if err != nil { return nil, err } - return convertTianyuanResponse(resp) } diff --git a/app/main/api/internal/types/types.go b/app/main/api/internal/types/types.go index e35a1db..68565a3 100644 --- a/app/main/api/internal/types/types.go +++ b/app/main/api/internal/types/types.go @@ -988,6 +988,8 @@ type AgentListItem struct { LevelName string `json:"level_name"` // 等级名称 Region string `json:"region"` // 区域 Mobile string `json:"mobile"` // 手机号 + RealName string `json:"real_name"` // 姓名(来自实名表) + IdCard string `json:"id_card"` // 身份证(解密后明文返回) WechatId string `json:"wechat_id"` // 微信号 TeamLeaderId string `json:"team_leader_id"` // 团队首领ID AgentCode int64 `json:"agent_code"` From c9b4c5054097cfcab29dfbdfa32ee03ebcbc0827 Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Wed, 11 Mar 2026 15:28:54 +0800 Subject: [PATCH 2/2] f --- .../admin_agent/admingetagentlistlogic.go | 10 ++++--- .../admingetagentrealnamelistlogic.go | 27 ++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go index 3a41e6d..08423c0 100644 --- a/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go +++ b/app/main/api/internal/logic/admin_agent/admingetagentlistlogic.go @@ -2,6 +2,7 @@ package admin_agent import ( "context" + "encoding/hex" "qnc-server/app/main/api/internal/svc" "qnc-server/app/main/api/internal/types" @@ -90,9 +91,12 @@ func (l *AdminGetAgentListLogic) AdminGetAgentList(req *types.AdminGetAgentListR } realName = realNameInfo.Name if realNameInfo.IdCard != "" { - decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, []byte(l.svcCtx.Config.Encrypt.SecretKey)) - if err == nil { - idCardPlain = decrypted + key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey) + if keyErr == nil { + decrypted, err := crypto.DecryptIDCard(realNameInfo.IdCard, key) + if err == nil { + idCardPlain = decrypted + } } } } diff --git a/app/main/api/internal/logic/admin_agent/admingetagentrealnamelistlogic.go b/app/main/api/internal/logic/admin_agent/admingetagentrealnamelistlogic.go index bdd7f03..9f6c988 100644 --- a/app/main/api/internal/logic/admin_agent/admingetagentrealnamelistlogic.go +++ b/app/main/api/internal/logic/admin_agent/admingetagentrealnamelistlogic.go @@ -2,15 +2,15 @@ package admin_agent import ( "context" + "encoding/hex" + + "qnc-server/app/main/api/internal/svc" + "qnc-server/app/main/api/internal/types" "qnc-server/common/globalkey" "qnc-server/common/xerr" "qnc-server/pkg/lzkit/crypto" "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" ) @@ -72,16 +72,19 @@ func (l *AdminGetAgentRealNameListLogic) AdminGetAgentRealNameList(req *types.Ad } } - // 解密身份证号(仅显示部分) + // 解密身份证号(仅显示部分,密钥与实名认证写入时一致:hex 解码后使用) idCard := "" if realName.IdCard != "" { - decrypted, err := crypto.DecryptIDCard(realName.IdCard, []byte(l.svcCtx.Config.Encrypt.SecretKey)) - if err == nil { - // 脱敏显示 - if len(decrypted) > 10 { - idCard = decrypted[:3] + "***********" + decrypted[len(decrypted)-4:] - } else { - idCard = decrypted + key, keyErr := hex.DecodeString(l.svcCtx.Config.Encrypt.SecretKey) + if keyErr == nil { + decrypted, err := crypto.DecryptIDCard(realName.IdCard, key) + if err == nil { + // 脱敏显示 + if len(decrypted) > 10 { + idCard = decrypted[:3] + "***********" + decrypted[len(decrypted)-4:] + } else { + idCard = decrypted + } } } }