init: radio init commit
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"strconv"
|
||||
"sundynix-go/global"
|
||||
common "sundynix-go/model/commom/request"
|
||||
"sundynix-go/model/radio"
|
||||
"sundynix-go/model/system"
|
||||
systemReq "sundynix-go/model/system/request"
|
||||
systemResp "sundynix-go/model/system/response"
|
||||
@@ -157,6 +158,17 @@ func (userService *UserService) MiniLogin(code string) (result *system.User, err
|
||||
if err := tx.Create(&newUser).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
// 创建小程序用户
|
||||
mpUser := radio.RadioUser{
|
||||
UserId: newUser.Id,
|
||||
OpenId: wxResp.Openid,
|
||||
UnionId: wxResp.Unionid,
|
||||
SessionKey: wxResp.SessionKey,
|
||||
}
|
||||
if err := tx.Create(&mpUser).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 赋值给外部变量以便返回
|
||||
user = newUser
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user