|
@@ -3,6 +3,7 @@ package com.cyksj.common.util;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.http.Method;
|
|
import cn.hutool.http.Method;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import com.tencentcloudapi.common.Credential;
|
|
import com.tencentcloudapi.common.Credential;
|
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
|
import com.tencentcloudapi.common.profile.ClientProfile;
|
|
@@ -66,13 +67,19 @@ public class SmsUtil {
|
|
|
System.out.println(execute.body());
|
|
System.out.println(execute.body());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static void batchSendLuoKey2Msg(List<String> mobile, String msg) {
|
|
|
|
|
|
|
+ public static Boolean batchSendLuoKey2Msg(List<String> mobile, String msg) throws Exception {
|
|
|
HttpRequest request = new HttpRequest(BATCH_URL);
|
|
HttpRequest request = new HttpRequest(BATCH_URL);
|
|
|
request.setMethod(Method.POST);
|
|
request.setMethod(Method.POST);
|
|
|
request.basicAuth("api", LVSINCO_PASSWORD);
|
|
request.basicAuth("api", LVSINCO_PASSWORD);
|
|
|
request.form("mobile_list", mobile.stream().collect(Collectors.joining(",")));
|
|
request.form("mobile_list", mobile.stream().collect(Collectors.joining(",")));
|
|
|
request.form("message", msg);
|
|
request.form("message", msg);
|
|
|
HttpResponse execute = request.execute();
|
|
HttpResponse execute = request.execute();
|
|
|
|
|
+ JSONObject re = Jsons.parseObject(execute.body(), JSONObject.class);
|
|
|
|
|
+ if (re.getInt("error") == 0) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ log.error(execute.body());
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void sendTencent(String mobile, String msg) {
|
|
public static void sendTencent(String mobile, String msg) {
|