diff --git a/aliyun/sms.go b/aliyun/sms.go index fea1948..5c20d4e 100644 --- a/aliyun/sms.go +++ b/aliyun/sms.go @@ -1,6 +1,7 @@ package aliyun import ( + utils "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils" "encoding/json" "errors" "fmt" @@ -41,11 +42,16 @@ func AliyunSendSms(accessKeyId, accessKeySecret, phone, signName, templateCode, } }() // 复制代码运行请自行打印 API 的返回值 - _, _err = client.SendSmsVerifyCodeWithOptions(sendSmsVerifyCodeRequest, runtime) + body, _err := client.SendSmsVerifyCodeWithOptions(sendSmsVerifyCodeRequest, runtime) if _err != nil { 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 }()