by Robin at 20240223; fix

This commit is contained in:
Leufolium 2024-02-23 16:04:54 +08:00
parent 59f206a612
commit 8cb0ab6819
4 changed files with 5 additions and 3 deletions

View File

@ -126,7 +126,7 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
// 2.如果错误码是登录信息不存在,则判断为首次登录,将创建用户信息
if ec == errcode.ErrCodeLoginNotExist {
login, account, ec = s.utilRegisterUser(ctx, &req.MobilePhoneInfoComponent, req.Inviter)
login, account, ec = s.utilRegisterUser(ctx, &req.MobilePhoneInfoComponent, req.Inviter, req.BaseRequest.DevType)
if ec != errcode.ErrCodeLoginSrvOk {
logger.Error("utilRegisterUser failed")
ec = errcode.ErrCodeLoginRegisterUserFail

View File

@ -536,7 +536,7 @@ func (s *Service) OpLoginByVeriCode(ctx *gin.Context, req *loginproto.OpLoginByV
// 2.如果错误码是登录信息不存在,则判断为首次登录,将创建用户信息
if ec == errcode.ErrCodeLoginNotExist {
login, account, ec = s.utilRegisterUser(ctx, &req.MobilePhoneInfoComponent, req.Inviter)
login, account, ec = s.utilRegisterUser(ctx, &req.MobilePhoneInfoComponent, req.Inviter, req.BaseRequest.DevType)
if ec != errcode.ErrCodeLoginSrvOk {
logger.Error("utilRegisterUser failed")
ec = errcode.ErrCodeLoginRegisterUserFail

View File

@ -25,7 +25,7 @@ import (
// 不向外暴露的辅助公共函数
// 注册账户
func (s *Service) utilRegisterUser(ctx *gin.Context, req *loginproto.MobilePhoneInfoComponent, inviter *int64) (login *dbstruct.Login, account *dbstruct.Account, ec errcode.ErrCode) {
func (s *Service) utilRegisterUser(ctx *gin.Context, req *loginproto.MobilePhoneInfoComponent, inviter *int64, devType int32) (login *dbstruct.Login, account *dbstruct.Account, ec errcode.ErrCode) {
var err error
inviterUserId := int64(0)
@ -66,6 +66,7 @@ func (s *Service) utilRegisterUser(ctx *gin.Context, req *loginproto.MobilePhone
account.RegionCode = goproto.String(req.RegionCode)
account.PhoneHash = goproto.String(req.PhoneHash)
account.IsAMember = goproto.Int64(0)
account.DevType = goproto.Int32(devType)
if inviterUserId != 0 {
account.Inviter = goproto.Int64(inviterUserId)
}

View File

@ -22,6 +22,7 @@ type Account struct {
DiamondNum *int64 `json:"diamond_num" bson:"diamond_num"` // 钻石数量
Inviter *int64 `json:"inviter" bson:"inviter"` // 邀请人user_id
IsAMember *int64 `json:"is_a_member" bson:"is_a_member"` // 是否是会员0-否1-是
DevType *int32 `bson:"dev_type"` // 注册来源
Latitude *float64 `bson:"latitude"` // 纬度
Longitude *float64 `bson:"longitude"` // 经度
Ct *int64 `json:"ct" bson:"ct"` // 创建时间