34 lines
785 B
Go
34 lines
785 B
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/basic/controller"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Sms struct{}
|
|
|
|
func (*Sms) Captcha(c *gin.Context) {
|
|
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)
|
|
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)
|
|
}
|