|
|
|
@@ -12,6 +12,7 @@ import com.aliyuncs.exceptions.ClientException; |
|
|
|
import com.aliyuncs.profile.DefaultProfile; |
|
|
|
import com.aliyuncs.profile.IClientProfile; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.enums.EnumMsgModelStatus; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.sms.EnumSMSChannel; |
|
|
|
import com.iformall.sms.SMSExcutor; |
|
|
|
@@ -108,10 +109,10 @@ public class AliyunSMS implements SMSExcutor { |
|
|
|
com.aliyun.dysmsapi20170525.models.CreateSmsTemplateResponse resp = client.createSmsTemplateWithOptions(createSmsTemplateRequest, runtime); |
|
|
|
log.info(">>>"+JSON.toJSONString(resp)); |
|
|
|
JSONObject respo = JSON.parseObject(JSON.toJSONString(resp)); |
|
|
|
String code = respo.getString("Code"); |
|
|
|
String code = respo.getString("code"); |
|
|
|
if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { |
|
|
|
SMSResult.setRet("1"); |
|
|
|
SMSResult.setAliyunModelCode(respo.getString("TemplateCode")); |
|
|
|
SMSResult.setRet(EnumMsgModelStatus.SUCCESS.getMessage()); |
|
|
|
SMSResult.setAliyunModelCode(respo.getString("templateCode")); |
|
|
|
} |
|
|
|
}catch (TeaException error) { |
|
|
|
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 |
|
|
|
@@ -120,6 +121,7 @@ public class AliyunSMS implements SMSExcutor { |
|
|
|
// 诊断地址 |
|
|
|
//System.out.println(error.getData().get("Recommend")); |
|
|
|
log.error("addTemplate error:"+error.getMessage()+"|recommend:"+error.getData().get("Recommend"),error); |
|
|
|
SMSResult.setRet(EnumMsgModelStatus.FAIL.getMessage()); |
|
|
|
} catch (Exception _error) { |
|
|
|
TeaException error = new TeaException(_error.getMessage(), _error); |
|
|
|
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 |
|
|
|
@@ -128,6 +130,7 @@ public class AliyunSMS implements SMSExcutor { |
|
|
|
// 诊断地址 |
|
|
|
//System.out.println(error.getData().get("Recommend")); |
|
|
|
log.error("addTemplate error:"+error.getMessage()+"|recommend:"+error.getData().get("Recommend"),_error); |
|
|
|
SMSResult.setRet(EnumMsgModelStatus.FAIL.getMessage()); |
|
|
|
} |
|
|
|
return JSON.toJSONString(SMSResult); |
|
|
|
} |
|
|
|
@@ -148,11 +151,11 @@ public class AliyunSMS implements SMSExcutor { |
|
|
|
try { |
|
|
|
com.aliyun.dysmsapi20170525.models.GetSmsTemplateResponse resp = client.getSmsTemplateWithOptions(getSmsTemplateRequest, runtime); |
|
|
|
JSONObject respo = JSON.parseObject(JSON.toJSONString(resp)); |
|
|
|
String code = respo.getString("Code"); |
|
|
|
String code = respo.getString("code"); |
|
|
|
if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { |
|
|
|
JSONObject obj = new JSONObject(); |
|
|
|
obj.put("templateCode",respo.getString("TemplateCode")); |
|
|
|
String templateStauts = respo.getString("TemplateStatus"); |
|
|
|
obj.put("templateCode",respo.getString("templateCode")); |
|
|
|
String templateStauts = respo.getString("templateStatus"); |
|
|
|
obj.put("templateStatus",templateStauts);//0:审核中。1:审核通过。2:审核失败 |
|
|
|
String reason = ""; |
|
|
|
if (StringUtils.isNotBlank(templateStauts) && templateStauts.equals("2")) { |
|
|
|
|