GetProfile 获取用户资料
(ctx *gin.Context)
| 250 | |
| 251 | // GetProfile 获取用户资料 |
| 252 | func (uh *UserHandler) GetProfile(ctx *gin.Context) { |
| 253 | var req req.GetProfileReq |
| 254 | if err := ctx.ShouldBindQuery(&req); err != nil { |
| 255 | apiresponse.ErrorWithMessage(ctx, "无效的请求参数") |
| 256 | return |
| 257 | } |
| 258 | |
| 259 | uc, ok := requireUser(ctx) |
| 260 | if !ok { |
| 261 | return |
| 262 | } |
| 263 | |
| 264 | profile, err := uh.svc.GetProfileByUserID(ctx, uc.Uid) |
| 265 | if err != nil { |
| 266 | apiresponse.ErrorWithMessage(ctx, UserProfileGetFailure) |
| 267 | return |
| 268 | } |
| 269 | |
| 270 | apiresponse.SuccessWithData(ctx, profile) |
| 271 | } |
| 272 | |
| 273 | // UpdateProfileByID 更新用户资料 |
| 274 | func (uh *UserHandler) UpdateProfileByID(ctx *gin.Context) { |
nothing calls this directly
no test coverage detected