feat:完善信息

This commit is contained in:
henry
2021-10-15 15:06:02 +08:00
parent af8691e943
commit ae9fb8ea0f
86 changed files with 215 additions and 216 deletions

View File

@ -0,0 +1,33 @@
package account
import (
"SciencesServer/app/handle"
"SciencesServer/utils"
"errors"
)
type Other struct{}
type OtherHandle func() *Other
// BindMobile 绑定手机号码
func (c *Other) BindMobile(token, mobile, captcha string) (interface{}, error) {
if !utils.ValidateMobile(mobile) {
return nil, errors.New("手机号码格式异常")
}
pass, err := handle.NewCaptcha().Validate(&handle.CaptchaSms{
Mobile: mobile, Captcha: captcha,
})
if err != nil {
return nil, err
} else if !pass {
return nil, errors.New("验证码错误或已过期")
}
return nil, nil
}
func NewOther() OtherHandle {
return func() *Other {
return &Other{}
}
}