package user import ( "nixcn-cms/internal/exception" "nixcn-cms/service" "nixcn-cms/utils" "github.com/gin-gonic/gin" "github.com/google/uuid" ) func (self *UserHandler) Info(c *gin.Context) { userIdOrig, ok := c.Get("user_id") if !ok { errorCode := new(exception.Builder). SetStatus(exception.StatusUser). SetService(exception.ServiceUser). SetEndpoint(exception.EndpointUserServiceInfo). SetType(exception.TypeCommon). SetOriginal(exception.CommonErrorMissingUserId). Throw(c). String() utils.HttpResponse(c, 403, errorCode) return } userId, err := uuid.Parse(userIdOrig.(string)) if err != nil { errorCode := new(exception.Builder). SetStatus(exception.StatusServer). SetService(exception.ServiceUser). SetEndpoint(exception.EndpointUserServiceInfo). SetType(exception.TypeCommon). SetOriginal(exception.CommonErrorUuidParseFailed). SetError(err). Throw(c). String() utils.HttpResponse(c, 500, errorCode) return } UserInfoPayload := &service.UserInfoPayload{ Context: c, UserId: userId, Data: nil, } result := self.svc.GetUserInfo(UserInfoPayload) if result.Common.Exception.Original != exception.CommonSuccess { utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String()) return } utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String(), result.Data) }