用户修改头像、昵称、绑定手机号、获取用户详细信息
This commit is contained in:
35
internal/controller/user/user_v1_info.go
Normal file
35
internal/controller/user/user_v1_info.go
Normal file
@ -0,0 +1,35 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
"server/api/user/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error) {
|
||||
|
||||
id := g.RequestFromCtx(ctx).GetCtxVar("id").Int64()
|
||||
out, err := service.User().Info(ctx, &model.UserInfoIn{
|
||||
OpenId: req.OpenId,
|
||||
Id: int(id),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.InfoRes{
|
||||
Avatar: out.Avatar,
|
||||
Email: out.Email,
|
||||
Id: int(out.Id),
|
||||
Nickname: out.Nickname,
|
||||
PhoneNumber: out.PhoneNumber,
|
||||
QQPopenId: out.QQPopenId,
|
||||
RoleId: int(out.RoleId),
|
||||
Username: out.Username,
|
||||
WxOpenId: out.WxOpenId,
|
||||
WxPopenId: out.WxPopenId,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user