user_controller.go 639 B

123456789101112131415161718192021222324252627282930313233
  1. package user
  2. import (
  3. "eta_mini_ht_api/common/component/cache"
  4. logger "eta_mini_ht_api/common/component/log"
  5. "eta_mini_ht_api/controllers"
  6. "fmt"
  7. )
  8. // Operations about Users
  9. type UserController struct {
  10. controllers.BaseController
  11. redis *cache.RedisCache
  12. }
  13. func (u *UserController) Prepare() {
  14. u.redis = cache.GetInstance()
  15. }
  16. type LoginCode struct {
  17. Code int `json:"code"`
  18. Msg string `json:"msg"`
  19. }
  20. // @Title GetAll
  21. // @Description get all Users
  22. // @Success 200 {object} models.User
  23. // @router / [get]
  24. func (u *UserController) Get() {
  25. logger.Warn("查询用户列表:%s")
  26. fmt.Print("查询用户列表")
  27. u.ServeJSON()
  28. }