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 query
import (
"context"
"database/sql"
"encoding/hex"
"encoding/json"
"fmt"
@@ -1401,13 +1402,13 @@ func (l *QueryServiceLogic) GetOrCreateUser(mobile string) (int64, error) {
return userID, nil
}
userModel, err := l.svcCtx.UserModel.FindOneByMobile(l.ctx, mobile)
userModel, err := l.svcCtx.UserModel.FindOneByMobile(l.ctx, sql.NullString{String: mobile, Valid: true})
if err != nil && !errors.Is(err, model.ErrNotFound) {
return 0, err
}
// 没有则创建账号
if userModel == nil {
userModel = &model.User{Mobile: mobile}
userModel = &model.User{Mobile: sql.NullString{String: mobile, Valid: true}}
// if len(userModel.Nickname) == 0 {
// userModel.Nickname = mobile
// }