@@ -0,0 +1,41 @@
|
||||
package notictrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/notiser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SendCaptcha doc
|
||||
// @Summary 发送验证码
|
||||
// @Description 发送用户注册、登录的验证码
|
||||
// @Tags captcha
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param mobile formData string false "手机号码信息"
|
||||
// @Param email formData string false "邮箱地址"
|
||||
// @Param type formData integer false "发送验证码的用途 1-绑定手机号 2-手机号登陆 3-email"
|
||||
// @Success 200 {string} string "操作成功"
|
||||
// @Router /api/app/notification/captcha [post]
|
||||
func SendCaptcha(ctx *gin.Context) {
|
||||
var args struct {
|
||||
Mobile string `form:"mobile" json:"mobile"`
|
||||
Email string `form:"email" json:"email"`
|
||||
Type int `form:"type" json:"type"`
|
||||
}
|
||||
if err := ctx.ShouldBind(&args); err != nil {
|
||||
log.Warn("SendCaptcha bind args", log.E(err))
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
if args.Email == "" && args.Mobile == "" {
|
||||
log.ErrorX(ctx, "empty phone number and email", log.Any("args", args))
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
errcode := notiser.SendCaptcha(ctx, args.Mobile, args.Email, args.Type)
|
||||
common.ServeJSON(ctx, errcode, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user