35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package smsctrl
|
|
|
|
import (
|
|
"91porn-server/app/service/smsser"
|
|
"91porn-server/common"
|
|
"91porn-server/common/log"
|
|
"91porn-server/common/stderr"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Captcha doc
|
|
// @Summary 短信验证码
|
|
// @Description 发送短信验证码,安卓客户端在用
|
|
// @Tags captcha
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param mobile formData string true "手机号码信息"
|
|
// @Param type formData integer false "发送验证码的用途 1-绑定手机号 2-手机号登陆"
|
|
// @Success 200 {string} json "{"msg": "操作成功","code":200,"data","验证码Id"}"
|
|
// @Router /sms/captcha [post]
|
|
func SendCaptcha(ctx *gin.Context) {
|
|
var args struct {
|
|
Mobile string `form:"mobile" json:"mobile" binding:"required"`
|
|
Type int64 `form:"type" json:"type"`
|
|
}
|
|
if err := ctx.ShouldBind(&args); err != nil {
|
|
log.WarnX(ctx, "SendCaptcha bind args", log.E(err))
|
|
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
|
return
|
|
}
|
|
errcode := smsser.SendSmsCode(ctx, args.Mobile, int(args.Type))
|
|
common.ServeJSON(ctx, errcode, nil)
|
|
}
|