fix: mobile

master
howell 4 years ago
parent 38fb3060f0
commit f406478406

@ -11,6 +11,7 @@ import (
"recook/internal/v2/logic/app/upgrade"
"recook/internal/v2/model/recook/user"
"recook/tools"
"strings"
"time"
"git.oa00.com/go/mysql"
@ -55,7 +56,24 @@ func (o Proxy) Create(c *gin.Context) {
}
}
type ArgsSend struct {
Mobile string `json:"mobile"`
}
func (o Proxy) Send(c *gin.Context) {
args := ArgsSend{}
if err := tools.ParseParams(&args, c); err != nil {
back.Fail(c, err.Error())
return
}
if len(args.Mobile) != 11 || !strings.HasPrefix(args.Mobile, "1") {
back.Fail(c, fmt.Errorf("手机格式异常").Error())
return
}
id, _ := common.GetAppUserId(c)
var u user.RecookUserInfoModel
@ -65,7 +83,7 @@ func (o Proxy) Send(c *gin.Context) {
}
randString := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000))
request := message.ReturnRequest(u.Mobile, randString)
request := message.ReturnRequest(args.Mobile, randString)
response, err := message.Client.ProcessCommonRequest(request)
if err != nil {
back.Err(c, err.Error())

Loading…
Cancel
Save