解决无法获取用户绑定信息

This commit is contained in:
2025-06-16 16:50:10 +08:00
parent 2903be6223
commit 2bbe45f40c
7 changed files with 85 additions and 106 deletions

View File

@ -13,5 +13,5 @@ func (c *ControllerV1) GetUserBoundInfo(ctx context.Context, req *v1.GetUserBoun
if err != nil {
return nil, err
}
return &v1.GetUserBoundInfoRes{IsBound: out.IsBound}, nil
return &v1.GetUserBoundInfoRes{IsBound: out.IsBound, Nick: out.Nick, AppNames: out.AppNames, Utype: out.Utype, Ctime: out.Ctime}, nil
}

View File

@ -3,7 +3,6 @@ package internal
import (
"context"
"fmt"
"github.com/go-resty/resty/v2"
"github.com/gogf/gf/v2/frame/g"
"server/internal/consts"
"server/internal/dao"
@ -268,20 +267,16 @@ func (s *sUser) UnBoundUrl(ctx context.Context, in *model.UserBoundUrlIn) (out *
}, nil
}
func (s *sUser) BoundInfo(ctx context.Context, in *model.UserBoundInfoIn) (out *model.UserBoundInfoOut, err error) {
url, err := gamelife.GetGamelifeClient(ctx).GetBound(ctx, in.PopenId)
result, err := gamelife.GetGamelifeClient(ctx).GetBound(ctx, in.PopenId)
if err != nil {
return nil, ecode.Fail.Sub("获取查询用户绑定信息 url 失败")
}
var result model.UserBoundResult
resp, err := resty.New().R().SetResult(&result).Post(url)
if err != nil {
return nil, ecode.Fail.Sub("调用游戏人生接口出现异常")
}
if resp.StatusCode() != 200 {
return nil, ecode.Fail.Sub("调用游戏人生接口失败")
return nil, err
}
return &model.UserBoundInfoOut{
IsBound: result.Result,
IsBound: result.Result,
AppNames: result.AppNames,
Ctime: result.Ctime,
Nick: result.Nick,
Utype: result.Utype,
}, nil
}

View File

@ -135,17 +135,18 @@ type GetPhoneCodeOut struct {
}
type UserGamelifeCache struct {
Aes string `json:"aes"`
IV string `json:"iv"`
Token string `json:"token"`
Aes string `json:"aes"`
IV string `json:"iv"`
Token string `json:"token"`
Params string `json:"params"`
}
type UserBoundResult struct {
Result bool `json:"result"`
Nick string `json:"nick"`
Ctime uint32 `json:"ctime"`
Utype int8 `json:"utype"`
AppName []string `json:"app_name"`
Result bool `json:"result"`
Nick string `json:"nick"`
Ctime uint32 `json:"ctime"`
Utype int8 `json:"utype"`
AppNames []string `json:"app_names"`
}
type UserBoundUrlIn struct {
PopenId string
@ -166,5 +167,9 @@ type UserBoundInfoIn struct {
PopenId string
}
type UserBoundInfoOut struct {
IsBound bool
IsBound bool
AppNames []string
Ctime uint32
Nick string
Utype int8
}