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

Method GetProfile

internal/api/user.go:252–271  ·  view source on GitHub ↗

GetProfile 获取用户资料

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

250
251// GetProfile 获取用户资料
252func (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 更新用户资料
274func (uh *UserHandler) UpdateProfileByID(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
requireUserFunction · 0.85
GetProfileByUserIDMethod · 0.65

Tested by

no test coverage detected