fix wxpayment and login

This commit is contained in:
2025-04-26 15:10:01 +08:00
parent ad6f343473
commit d72ed7d0a3
12 changed files with 35 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package agent
import (
"context"
"database/sql"
"fmt"
"qnc-server/app/user/model"
jwtx "qnc-server/common/jwt"
@@ -58,12 +59,12 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
var userID int64
transErr := l.svcCtx.AgentAuditModel.Trans(l.ctx, func(transCtx context.Context, session sqlx.Session) error {
// 两种情况1. 已注册账号然后申请代理 2. 未注册账号申请代理
user, findUserErr := l.svcCtx.UserModel.FindOneByMobile(l.ctx, encryptedMobile)
user, findUserErr := l.svcCtx.UserModel.FindOneByMobile(l.ctx, sql.NullString{String: encryptedMobile, Valid: true})
if findUserErr != nil && !errors.Is(findUserErr, model.ErrNotFound) {
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "代理申请, 读取数据库获取用户失败, mobile: %s, err: %+v", encryptedMobile, err)
}
if user == nil {
user = &model.User{Mobile: encryptedMobile}
user = &model.User{Mobile: sql.NullString{String: encryptedMobile, Valid: true}}
// if len(user.Nickname) == 0 {
// user.Nickname = encryptedMobile
// }