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);
}
}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步