user.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package api
  2. import (
  3. "github.com/gin-gonic/gin"
  4. apiResp "github.com/lejianwen/rustdesk-api/http/response/api"
  5. "github.com/lejianwen/rustdesk-api/service"
  6. "net/http"
  7. )
  8. type User struct {
  9. }
  10. // currentUser 当前用户
  11. // @Tags 用户
  12. // @Summary 用户信息
  13. // @Description 用户信息
  14. // @Accept json
  15. // @Produce json
  16. // @Success 200 {object} apiResp.UserPayload
  17. // @Failure 500 {object} response.Response
  18. // @Router /currentUser [get]
  19. // @Security token
  20. //func (u *User) currentUser(c *gin.Context) {
  21. // user := service.AllService.UserService.CurUser(c)
  22. // up := (&apiResp.UserPayload{}).FromName(user)
  23. // c.JSON(http.StatusOK, up)
  24. //}
  25. // Info 用户信息
  26. // @Tags 用户
  27. // @Summary 用户信息
  28. // @Description 用户信息
  29. // @Accept json
  30. // @Produce json
  31. // @Success 200 {object} apiResp.UserPayload
  32. // @Failure 500 {object} response.Response
  33. // @Router /currentUser [get]
  34. // @Security token
  35. func (u *User) Info(c *gin.Context) {
  36. user := service.AllService.UserService.CurUser(c)
  37. up := (&apiResp.UserPayload{}).FromUser(user)
  38. c.JSON(http.StatusOK, up)
  39. }