Browse Source

快站

master
huangjiajun 2 months ago
parent
commit
50d608c7fd
1 changed files with 22 additions and 2 deletions
  1. +22
    -2
      sms/api.go

+ 22
- 2
sms/api.go View File

@@ -14,7 +14,7 @@ import (
"xorm.io/xorm"
)

//短信数量
// 短信数量
func SmsNumGetSmsNum(engine *xorm.Engine, smsType, uid interface{}) int {
numData := offical.GetSmsNum(engine, smsType, uid)
num := 0
@@ -27,7 +27,7 @@ func SmsNumGetSmsNum(engine *xorm.Engine, smsType, uid interface{}) int {
return num
}

//发送短信
// 发送短信
func SmsSend(engine *xorm.Engine, args map[string]interface{}) error {
num := SmsNumGetSmsNum(engine, args["sms_type"], args["uid"])
ex := strings.Split(args["mobile"].(string), ",")
@@ -218,3 +218,23 @@ func SmsMobApiSend(args map[string]interface{}) (string, error) {
fmt.Println(err)
return string(post), err
}

func SMSMobCheck(args map[string]interface{}) (bool, error) {
// https://www.mob.com/wiki/detailed/?wiki=SMSSDK_for_yanzhengmafuwuduanxiaoyanjiekou&id=23
url := "https://webapi.sms.mob.com/sms/verify"
fmt.Println(args)
// 发送请求
respBody, err := zhios_third_party_utils.CurlPost(url, args, nil)
if err != nil {
fmt.Println(err)
return false, err
}
code := gjson.GetBytes(respBody, "status").Int()
if code == 468 {
return false, errors.New("验证码错误")
}
if code != 200 {
return false, errors.New("验证码错误~")
}
return true, nil
}

Loading…
Cancel
Save