From e52f0e260ab82161cb9f2b1e19678c0c37af7b52 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 6 Sep 2019 10:18:09 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E6=97=B6=E5=88=A4=E6=96=ADEnableStoreWrite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/smsmsg/smsmsg.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/business/jxutils/smsmsg/smsmsg.go b/business/jxutils/smsmsg/smsmsg.go index 4f134ef66..3d799bc25 100644 --- a/business/jxutils/smsmsg/smsmsg.go +++ b/business/jxutils/smsmsg/smsmsg.go @@ -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) + } } } }