MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / UpdateProfile

Method UpdateProfile

internal/api/user.go:354–375  ·  view source on GitHub ↗

UpdateProfile 更新用户资料(管理员)

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

352
353// UpdateProfile 更新用户资料(管理员)
354func (uh *UserHandler) UpdateProfile(ctx *gin.Context) {
355 var req req.UpdateProfileAdminReq
356 if err := ctx.ShouldBindJSON(&req); err != nil {
357 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
358 return
359 }
360
361 err := uh.svc.UpdateProfileAdmin(ctx, domain.Profile{
362 RealName: req.RealName,
363 Avatar: req.Avatar,
364 About: req.About,
365 Birthday: req.Birthday,
366 Phone: &req.Phone,
367 UserID: req.UserID,
368 })
369 if err != nil {
370 apiresponse.ErrorWithMessage(ctx, UserProfileUpdateFailure)
371 return
372 }
373
374 apiresponse.Success(ctx)
375}

Callers

nothing calls this directly

Calls 3

ErrorWithMessageFunction · 0.92
SuccessFunction · 0.92
UpdateProfileAdminMethod · 0.65

Tested by

no test coverage detected