api.go 896 B

12345678910111213141516171819202122232425262728293031
  1. // Path: routes 注册路由
  2. package routes
  3. import (
  4. "github.com/gin-gonic/gin"
  5. "github.com/runningwater/gohub/app/http/controllers/api/v1/auth"
  6. )
  7. // RegisterAPIRoutes 注册路由
  8. func RegisterAPIRoutes(router *gin.Engine) {
  9. // v1 路由组,所有 v1 版本的路由都放在这里
  10. v1 := router.Group("/v1")
  11. {
  12. authGroup := v1.Group("/auth")
  13. {
  14. suc := new(auth.SignupController)
  15. vcc := new(auth.VerifyCodeController)
  16. // 注册手机号是否已存在
  17. authGroup.POST("/signup/phone/exist", suc.IsPhoneExist)
  18. // 注册邮箱是否已存在
  19. authGroup.POST("/signup/email/exist", suc.IsEmailExist)
  20. // 显示图片验证码
  21. authGroup.POST("/verify_code/captcha", vcc.ShowCaptcha)
  22. // 发送手机验证码
  23. authGroup.POST("/verify_code/phone", vcc.SendUsingPhone)
  24. // 发送邮箱验证码
  25. authGroup.POST("/verify_code/email", vcc.SendUsingEmail)
  26. }
  27. }
  28. }