蛋蛋星球-客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.1 KiB

  1. package hdl
  2. import (
  3. "applet/app/e"
  4. "applet/app/md"
  5. "applet/app/svc"
  6. "applet/app/utils"
  7. "github.com/gin-gonic/gin"
  8. )
  9. // UserInfo
  10. // @Summary 用户信息
  11. // @Tags 用户信息
  12. // @Description 用户信息
  13. // @Accept json
  14. // @Produce json
  15. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  16. // @Success 200 {object} md.UserInfoResp "具体数据"
  17. // @Failure 400 {object} md.Response "具体错误"
  18. // @Router /api/v1/userInfo [get]
  19. func UserInfo(c *gin.Context) {
  20. user := svc.GetUser(c)
  21. res := md.UserInfoResp{
  22. Id: utils.Int64ToStr(user.Id),
  23. Phone: user.Phone,
  24. Nickname: user.Phone,
  25. InviteCode: user.SystemInviteCode,
  26. IsBindExtend: "0",
  27. }
  28. if user.Avatar == "" {
  29. user.Avatar = svc.GetSysCfgStr("default_avatar")
  30. }
  31. if user.Avatar != "" {
  32. res.HeadImg = svc.GetOssUrl(user.Avatar)
  33. }
  34. if user.CustomInviteCode != "" {
  35. res.InviteCode = user.CustomInviteCode
  36. }
  37. if user.ParentUid > 0 {
  38. res.IsBindExtend = "1"
  39. }
  40. e.OutSuc(c, res, nil)
  41. return
  42. }