|
- package hdl
-
- import (
- "applet/app/e"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/utils"
- "github.com/gin-gonic/gin"
- )
-
- // UserInfo
- // @Summary 用户信息
- // @Tags 用户信息
- // @Description 用户信息
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} md.UserInfoResp "具体数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/v1/userInfo [get]
- func UserInfo(c *gin.Context) {
- user := svc.GetUser(c)
- res := md.UserInfoResp{
- Id: utils.Int64ToStr(user.Id),
- Phone: user.Phone,
- Nickname: user.Phone,
- InviteCode: user.SystemInviteCode,
- IsBindExtend: "0",
- }
- if user.Avatar == "" {
- user.Avatar = svc.GetSysCfgStr("default_avatar")
- }
- if user.Avatar != "" {
- res.HeadImg = svc.GetOssUrl(user.Avatar)
- }
- if user.CustomInviteCode != "" {
- res.InviteCode = user.CustomInviteCode
- }
- if user.ParentUid > 0 {
- res.IsBindExtend = "1"
- }
- e.OutSuc(c, res, nil)
- return
- }
|