fix
This commit is contained in:
parent
2aacbf1c3e
commit
d3c96184b8
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
|
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/fssql"
|
"fusenapi/utils/fssql"
|
||||||
|
@ -174,7 +173,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
err = tx.Model(&FsUser{}).Where("email = ?", token.Email).Take(user).Error
|
err = tx.Model(&FsUser{}).Where("email = ?", token.Email).Take(user).Error
|
||||||
log.Println("success", token.TraceId)
|
logx.Info("success", token.TraceId)
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
|
||||||
FirstName := token.Extend["first_name"].(string)
|
FirstName := token.Extend["first_name"].(string)
|
||||||
|
@ -195,11 +194,11 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("success", token.TraceId)
|
logx.Info("success", token.TraceId)
|
||||||
|
|
||||||
// 继承guest_id的资源表
|
// 继承guest_id的资源表
|
||||||
err = InheritGuestIdResource(tx, user.Id, token.GuestId, func(txResouce, txUserMaterial, txUserInfo *gorm.DB) error {
|
err = InheritGuestIdResource(tx, user.Id, token.GuestId, func(txResouce, txUserMaterial, txUserInfo *gorm.DB) error {
|
||||||
log.Println("success", token.TraceId)
|
logx.Info("success", token.TraceId)
|
||||||
userProfile := &UserProfile{
|
userProfile := &UserProfile{
|
||||||
FirstName: FirstName,
|
FirstName: FirstName,
|
||||||
LastName: LastName,
|
LastName: LastName,
|
||||||
|
@ -224,8 +223,9 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
|
|
||||||
err = txUserInfo.Where("module = 'profile' and user_id = ?", uinfo.UserId).Take(nil).Error
|
err = txUserInfo.Where("module = 'profile' and user_id = ?", uinfo.UserId).Take(nil).Error
|
||||||
// txUserInfo.Statement.Table
|
// txUserInfo.Statement.Table
|
||||||
log.Println(err, "找到user_id1")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logx.Info(err)
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
err = txUserInfo.Create(uinfo).Error
|
err = txUserInfo.Create(uinfo).Error
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
|
@ -233,7 +233,7 @@ func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Println("找到user_id2")
|
logx.Info("找到user_id2")
|
||||||
err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUserInfo{}, metadata, "user_id = ?", *uinfo.UserId)
|
err = fssql.MetadataModulePATCH(txUserInfo, "profile", FsUserInfo{}, metadata, "user_id = ?", *uinfo.UserId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -97,7 +97,7 @@ func CommonNotify(WebsocketAddr, wid string, event *wevent.WebsocketEvent) error
|
||||||
func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEmailConfirmation, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEmailConfirmation, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
logx.Error("找到user_id1 UserEmailConfirmation")
|
|
||||||
switch auth.OperateType(req.OpType) {
|
switch auth.OperateType(req.OpType) {
|
||||||
case auth.OpTypeRegister:
|
case auth.OpTypeRegister:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user