Files

34 lines
785 B
Go
Raw Normal View History

2021-09-29 16:43:40 +08:00
package api
import (
"SciencesServer/app/basic/controller"
"github.com/gin-gonic/gin"
)
type Sms struct{}
2022-02-11 11:02:29 +08:00
func (*Sms) Captcha(c *gin.Context) {
2021-09-29 16:43:40 +08:00
form := &struct {
Mobile string `json:"mobile" form:"mobile" binding:"required"`
}{}
if err := Bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := controller.NewSms()().Captcha(form.Mobile)
2022-02-11 11:02:29 +08:00
APIResponse(err)(c)
}
func (*Sms) CaptchaValidate(c *gin.Context) {
form := &struct {
Mobile string `json:"mobile" form:"mobile" binding:"required"`
Captcha string `json:"captcha" form:"captcha" binding:"required"`
}{}
if err := Bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := controller.NewSms()().CaptchaValidate(form.Mobile, form.Captcha)
APIResponse(err, data)(c)
2021-09-29 16:43:40 +08:00
}