| @@ -109,11 +109,14 @@ 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"); | |||
| if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { | |||
| SMSResult.setRet(EnumMsgModelStatus.SUCCESS.getMessage()); | |||
| SMSResult.setAliyunModelCode(respo.getString("templateCode")); | |||
| } | |||
| JSONObject body = respo.getJSONObject("body"); | |||
| if (null != body) { | |||
| String code = body.getString("code"); | |||
| if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { | |||
| SMSResult.setRet(EnumMsgModelStatus.SUCCESS.getMessage()); | |||
| SMSResult.setAliyunModelCode(body.getString("templateCode")); | |||
| } | |||
| } | |||
| }catch (TeaException error) { | |||
| // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 | |||
| // 错误 message | |||
| @@ -151,22 +154,25 @@ 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"); | |||
| if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { | |||
| JSONObject obj = new JSONObject(); | |||
| 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")) { | |||
| JSONObject ajo = respo.getJSONObject("AuditInfo"); | |||
| if (null != ajo) { | |||
| reason = ajo.getString("RejectInfo"); | |||
| } | |||
| } | |||
| obj.put("reason",reason); | |||
| return obj.toJSONString(); | |||
| } | |||
| JSONObject body = respo.getJSONObject("body"); | |||
| if (null != body) { | |||
| String code = body.getString("code"); | |||
| if (StringUtils.isNotBlank(code) && code.equalsIgnoreCase("ok")) { | |||
| JSONObject obj = new JSONObject(); | |||
| obj.put("templateCode",body.getString("templateCode")); | |||
| String templateStauts = body.getString("templateStatus"); | |||
| obj.put("templateStatus",templateStauts);//0:审核中。1:审核通过。2:审核失败 | |||
| String reason = ""; | |||
| if (StringUtils.isNotBlank(templateStauts) && templateStauts.equals("2")) { | |||
| JSONObject ajo = body.getJSONObject("AuditInfo"); | |||
| if (null != ajo) { | |||
| reason = ajo.getString("RejectInfo"); | |||
| } | |||
| } | |||
| obj.put("reason",reason); | |||
| return obj.toJSONString(); | |||
| } | |||
| } | |||
| return null; | |||
| } catch (TeaException error) { | |||
| // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 | |||