- 发送短信时判断EnableStoreWrite

This commit is contained in:
gazebo
2019-09-06 10:18:09 +08:00
parent 0fbe4d7024
commit e52f0e260a

View File

@@ -28,16 +28,18 @@ func SendSMSMsg(mobileList []string, signName, templateCode string, templatePara
for _, mobileNum := range mobileList {
if mobileNum != "" {
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 {
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
errList.AddErr(err)
} else if response.Code != aliyunsmsclient.ResponseCodeOk {
errMsg := fmt.Sprintf("SendSMSMsg mobileNum:%s failed with response:%s", mobileNum, utils.Format4Output(response, false))
errList.AddErr(fmt.Errorf(errMsg))
if warningMap[response.Code] == 1 {
globals.SugarLogger.Warnf(errMsg)
} else {
globals.SugarLogger.Infof(errMsg)
if globals.EnableStoreWrite {
if response, err := api.SMSClient.Execute(globals.AliKey, globals.AliSecret, mobileNum, signName, templateCode, string(utils.MustMarshal(templateParam))); err != nil {
globals.SugarLogger.Warnf("SendSMSMsg mobileNum:%s failed with error:%v", mobileNum, err)
errList.AddErr(err)
} else if response.Code != aliyunsmsclient.ResponseCodeOk {
errMsg := fmt.Sprintf("SendSMSMsg mobileNum:%s failed with response:%s", mobileNum, utils.Format4Output(response, false))
errList.AddErr(fmt.Errorf(errMsg))
if warningMap[response.Code] == 1 {
globals.SugarLogger.Warnf(errMsg)
} else {
globals.SugarLogger.Infof(errMsg)
}
}
}
}