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