|
@@ -684,24 +684,33 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
|
|
}
|
|
}
|
|
|
|
|
|
public boolean getSendSms(int markId, String mobile, String content) throws Exception {
|
|
public boolean getSendSms(int markId, String mobile, String content) throws Exception {
|
|
- if (org.apache.commons.lang.StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
|
|
|
|
- String regex = "^(1[3-9]\\d{9}$)";
|
|
|
|
- Pattern pattern = Pattern.compile(regex);
|
|
|
|
- Matcher matcher = pattern.matcher(mobile);
|
|
|
|
- if (matcher.matches()) {
|
|
|
|
- Map<String, Object> map = new HashMap<>(2);
|
|
|
|
- map.put("content", content);
|
|
|
|
- map.put("mobile", mobile);
|
|
|
|
- String coreServer = Global.getConfig("caimei.core");
|
|
|
|
- String url = coreServer + "/tools/sms/send";
|
|
|
|
- String result = HttpRequest.sendPost(url, map);
|
|
|
|
- JSONObject parseObject = JSONObject.parseObject(result);
|
|
|
|
- Integer code = parseObject.getInteger("code");
|
|
|
|
- if (code != 0) {
|
|
|
|
- logger.info("短信发送失败,手机号>>>>" + mobile);
|
|
|
|
- } else {
|
|
|
|
- newOrderDao.updateSendNum(markId, 1);
|
|
|
|
- return true;
|
|
|
|
|
|
+ String config = Global.getConfig("cm.config");
|
|
|
|
+ //测试环境手机号允许发短信
|
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
|
+ list.add("15917362709");
|
|
|
|
+ list.add("15814011616");
|
|
|
|
+ list.add("13100721916");
|
|
|
|
+ list.add("15113936829");
|
|
|
|
+ if (config.equals("product") || list.contains(mobile)) {
|
|
|
|
+ if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
|
|
|
|
+ String regex = "^(1[3-9]\\d{9}$)";
|
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
|
+ Matcher matcher = pattern.matcher(mobile);
|
|
|
|
+ if (matcher.matches()) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>(2);
|
|
|
|
+ map.put("content", content);
|
|
|
|
+ map.put("mobile", mobile);
|
|
|
|
+ String coreServer = Global.getConfig("caimei.core");
|
|
|
|
+ String url = coreServer + "/tools/sms/send";
|
|
|
|
+ String result = HttpRequest.sendPost(url, map);
|
|
|
|
+ JSONObject parseObject = JSONObject.parseObject(result);
|
|
|
|
+ Integer code = parseObject.getInteger("code");
|
|
|
|
+ if (code != 0) {
|
|
|
|
+ logger.info("短信发送失败,手机号>>>>" + mobile);
|
|
|
|
+ } else {
|
|
|
|
+ newOrderDao.updateSendNum(markId, 1);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|