| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package auth
- import (
- "github.com/gin-gonic/gin"
- v1 "github.com/runningwater/gohub/app/http/controllers/api/v1"
- "github.com/runningwater/gohub/app/models/user"
- "github.com/runningwater/gohub/app/requests"
- )
- // SignupController 处理用户注册相关的逻辑
- type SignupController struct {
- v1.BaseApiController
- }
- func (controller *SignupController) IsPhoneExist(c *gin.Context) {
- // 初始化请求对象
- req := requests.SignupPhoneExistRequest{}
- if ok := requests.Validate(c, &req, requests.ValidateSignupPhoneExist); !ok {
- return
- }
- // 检查数据库并返回响应
- c.JSON(200, gin.H{
- "exist": user.IsPhoneExist(req.Phone),
- })
- }
- func (controller *SignupController) IsEmailExist(c *gin.Context) {
- // 初始化请求对象
- req := requests.SignupEmailExistRequest{}
- if ok := requests.Validate(c, &req, requests.ValidateSignupEmailExist);!ok {
- return
- }
- // 检查数据库并返回响应
- c.JSON(200, gin.H{
- "exist": user.IsEmailExist(req.Email),
- })
- }
|