user.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package routers
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "hongze/hongze_yb/controller/user"
  5. "hongze/hongze_yb/middleware"
  6. )
  7. func InitUser(r *gin.Engine) {
  8. rGroup := r.Group("user").Use(middleware.TokenNoLogin())
  9. {
  10. rGroup.POST("/login", user.Login)
  11. rGroup.GET("/get_sms_code", user.GetSmsCode)
  12. rGroup.GET("/get_email_code", user.GetEmailCode)
  13. }
  14. rGroup2 := r.Group("user").Use(middleware.Token())
  15. {
  16. rGroup2.GET("/info", user.Info)
  17. rGroup2.GET("/get_last_apply_record", user.GetLastApplyRecord)
  18. rGroup2.POST("/apply", user.Apply)
  19. rGroup2.GET("/get_tab_bar", user.GetTabBar)
  20. }
  21. initUser(r)
  22. }
  23. func initUser(r *gin.Engine) {
  24. rGroup := r.Group("api/user").Use(middleware.TokenNoLogin())
  25. {
  26. rGroup.POST("/login", user.Login)
  27. rGroup.GET("/get_sms_code", user.GetSmsCode)
  28. rGroup.GET("/get_email_code", user.GetEmailCode)
  29. }
  30. rGroup2 := r.Group("api/user").Use(middleware.Token())
  31. {
  32. rGroup2.GET("/info", user.Info)
  33. rGroup2.GET("/get_last_apply_record", user.GetLastApplyRecord)
  34. rGroup2.POST("/apply", user.Apply)
  35. rGroup2.GET("/get_tab_bar", user.GetTabBar)
  36. rGroup2.GET("/get_top_tab", user.GetTopTab)
  37. rGroup2.POST("/set", user.SetUserInfo)
  38. }
  39. }