- 发送短信时判断EnableStoreWrite
This commit is contained in:
@@ -28,16 +28,18 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
|
|||||||
for _, mobileNum := range mobileList {
|
for _, mobileNum := range mobileList {
|
||||||
if mobileNum != "" {
|
if mobileNum != "" {
|
||||||
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
globals.SugarLogger.Debugf("SendSMSMsg mobileNum:%s, templateCode:%s", mobileNum, templateCode)
|
||||||
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
|
if globals.EnableStoreWrite {
|
||||||
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
|
||||||
errList.AddErr(err)
|
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
|
||||||
} else if response.Code != aliyunsmsclient.ResponseCodeOk {
|
errList.AddErr(err)
|
||||||
errMsg := fmt.Sprintf("SendSMSMsg mobileNum:%s failed with response:%s", mobileNum, utils.Format4Output(response, false))
|
} else if response.Code != aliyunsmsclient.ResponseCodeOk {
|
||||||
errList.AddErr(fmt.Errorf(errMsg))
|
errMsg := fmt.Sprintf("SendSMSMsg mobileNum:%s failed with response:%s", mobileNum, utils.Format4Output(response, false))
|
||||||
if warningMap[response.Code] == 1 {
|
errList.AddErr(fmt.Errorf(errMsg))
|
||||||
globals.SugarLogger.Warnf(errMsg)
|
if warningMap[response.Code] == 1 {
|
||||||
} else {
|
globals.SugarLogger.Warnf(errMsg)
|
||||||
globals.SugarLogger.Infof(errMsg)
|
} else {
|
||||||
|
globals.SugarLogger.Infof(errMsg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user