@Override public IRespParam pushTemplate(List<BaseDto> kmTemplateList) throws Exception { for (BaseDto baseDto : kmTemplateList) { baseDto.put(TOKEN_NAME, getKmAccessToken()); MRespParam resp = HttpClientUtils.post(getUrl(sendSMS_path), baseDto, MRespParam.class); if (AppUtils.checkSuccess(resp.getRet())) { logger.debug("向KM推送模板消息成功,{}", kmTemplateList); } else { logger.error("向KM推送模板消息失败,{}", kmTemplateList, "返回消息是:", resp); } return resp; } return null; }
@Override public IRespParam sendsms(KSmsReqParam param) throws Exception { Dto pDto = new BaseDto(); pDto.put(TOKEN_NAME, getKmAccessToken()); pDto.put("phoneno", param.getPhoneno()); Dto nestedDto = new BaseDto(); nestedDto.put("validcode", param.getValidcode()); pDto.put("sms_content", nestedDto); MRespParam resp = HttpClientUtils.post(getUrl(sendSMS_path), pDto, MRespParam.class); if (AppUtils.checkSuccess(resp.getRet())) { logger.debug("发送短信成功,手机号是{}", param.getPhoneno()); } else { logger.error("发送短信失败,手机号是{}", param.getPhoneno(), "返回消息是:", resp); } return resp; }