public NutMap doSmsSendPost(String content, String mobile) {
try {
Base_sms_config config = baseSmsConfigService.getConfig();
if (Lang.isNotEmpty(config) && !config.isDisabled()) {
Map<String, Object> params = new HashMap<>();
params.put("LoginName", config.getAccount());
params.put("Pwd", config.getPassword());
params.put("FeeType", "2");
params.put("Mobile", mobile);
params.put("Content", content);
params.put("SignName", conf.get("sms.request.sign", "【智慧守护家】"));
Header header = Header.create();
String url = config.getServerAddress();
Request request = Request.create(url, Request.METHOD.GET, params, header);
Response re = Sender.create(request).setTimeout(10 * 1000).send();
if (re.isOK()) {
String result = Strings.sNull(re.getContent());
if (result.startsWith("OK")) {
String[] strings = Strings.splitIgnoreBlank(result, "\\|");
NutMap nutMap = NutMap.NEW();
nutMap.setv("msgId", strings[1]);
nutMap.setv("code", 0);
return nutMap;
} else {
NutMap nutMap = NutMap.NEW();
int number = Integer.parseInt(result);
switch (number) {
case -21:
nutMap.setv("msg", "语音模板显示号码未设置");
break;
case -22:
nutMap.setv("msg", "语音模板ID不存在");
break;
case -23:
nutMap.setv("msg", "语音模板不存在");
break;
case -24:
nutMap.setv("msg", "语音模板参数不匹配");
break;
case -103:
nutMap.setv("msg", "IP未导白");
break;
}
nutMap.setv("code", -100);
return nutMap;
}
}
}
baseSmsConfigService.clearCache();
return NutMap.NEW().setv("code", -100);
} catch (HttpException e) {
log.error(e);
return NutMap.NEW().setv("code", -100);
}
}