Browse Source

mob验证码

master
huangjiajun 5 days ago
parent
commit
c647f6414c
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      aliyun/sms.go

+ 8
- 2
aliyun/sms.go View File

@@ -1,6 +1,7 @@
package aliyun package aliyun


import ( import (
utils "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
@@ -41,11 +42,16 @@ func AliyunSendSms(accessKeyId, accessKeySecret, phone, signName, templateCode,
} }
}() }()
// 复制代码运行请自行打印 API 的返回值 // 复制代码运行请自行打印 API 的返回值
_, _err = client.SendSmsVerifyCodeWithOptions(sendSmsVerifyCodeRequest, runtime)
body, _err := client.SendSmsVerifyCodeWithOptions(sendSmsVerifyCodeRequest, runtime)
if _err != nil { if _err != nil {
return _err return _err
} }

if body != nil && body.Body != nil && body.Body.Code != nil && *body.Body.Code != "OK" {
if body.Body.Message != nil {
fmt.Println("阿里短信:" + utils.SerializeStr(body))
}
return errors.New("发送失败")
}
return nil return nil
}() }()




Loading…
Cancel
Save