|
@@ -96,16 +96,16 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
|
|
|
String phone = sysSMSDTO.getPhone();
|
|
|
Integer phoneAreaCode = sysSMSDTO.getPhone_area_code();
|
|
|
|
|
|
- // [腾讯云] 号码信息查询 (判断手机号码是否有效)
|
|
|
- List<Map<String, Object>> phoneInfoList = getDescribePhoneNumberInfo(phoneAreaCode + phone);
|
|
|
- if (phoneInfoList != null) {
|
|
|
- Map<String, Object> phoneInfo = phoneInfoList.get(0);
|
|
|
- String code = (String) phoneInfo.get("code");
|
|
|
- if (!"Ok".equals(code)) {
|
|
|
- String message = (String) phoneInfo.get("message");
|
|
|
- throw new CustomException("发送失败,请检查手机号码格式", 6001, phoneInfo);
|
|
|
- }
|
|
|
- }
|
|
|
+// // [腾讯云] 号码信息查询 (判断手机号码是否有效)
|
|
|
+// List<Map<String, Object>> phoneInfoList = getDescribePhoneNumberInfo(phoneAreaCode + phone);
|
|
|
+// if (phoneInfoList != null) {
|
|
|
+// Map<String, Object> phoneInfo = phoneInfoList.get(0);
|
|
|
+// String code = (String) phoneInfo.get("code");
|
|
|
+// if (!"Ok".equals(code)) {
|
|
|
+// String message = (String) phoneInfo.get("message");
|
|
|
+// throw new CustomException("发送失败,请检查手机号码格式", 6001, phoneInfo);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
|
@@ -302,110 +302,110 @@ public class SDKTencentSMSServiceImpl implements SDKTencentSMSService {
|
|
|
/**
|
|
|
* [腾讯云] 套餐包信息统计
|
|
|
*/
|
|
|
- @Override
|
|
|
- public List<Map<String, Object>> getSmsPackagesStatistics(String beginTime, String endTime) {
|
|
|
- try {
|
|
|
-
|
|
|
- // ----------------------------------------------------------------------
|
|
|
- Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
|
|
- ClientProfile clientProfile = new ClientProfile();
|
|
|
- SmsClient client = new SmsClient(cred, "ap-guangzhou",clientProfile);
|
|
|
-
|
|
|
- SmsPackagesStatisticsRequest req = new SmsPackagesStatisticsRequest();
|
|
|
- req.setSmsSdkAppId(sdkAppId);
|
|
|
- req.setLimit(100L);
|
|
|
- req.setOffset(0L);
|
|
|
- req.setBeginTime((String) getCurrentAndBeforeDate(beginTime, endTime, 7).get("beginTime"));
|
|
|
- req.setEndTime(((String) getCurrentAndBeforeDate(beginTime, endTime, 7).get("endTime")));
|
|
|
-
|
|
|
- /* 通过 client 对象调用 SendStatusStatistics 方法发起请求。注意请求方法名与请求对象是对应的
|
|
|
- * 返回的 res 是一个 SendStatusStatisticsResponse 类的实例,与请求对象对应 */
|
|
|
- SmsPackagesStatisticsResponse res = client.SmsPackagesStatistics(req);
|
|
|
-
|
|
|
- // 输出json格式的字符串回包
|
|
|
- String resString = SendStatusStatisticsResponse.toJsonString(res);
|
|
|
- JSONObject resp = JSONUtil.parseObj(resString);
|
|
|
-
|
|
|
- System.out.println(resp);
|
|
|
- /*
|
|
|
- {
|
|
|
- "SmsPackagesStatisticsSet": [
|
|
|
- {
|
|
|
- "PackageCreateTime": 1713863741,
|
|
|
- "PackageEffectiveTime": 1713863741,
|
|
|
- "PackageExpiredTime": 1721726141,
|
|
|
- "PackageAmount": 500,
|
|
|
- "PackageType": 0,
|
|
|
- "PackageId": 1002730611,
|
|
|
- "CurrentUsage": 13
|
|
|
- }
|
|
|
- ],
|
|
|
- "RequestId": "15f81795-7a14-43cc-9215-efcc8886e1af"
|
|
|
- }
|
|
|
- */
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) MapUtil.get(resp, "SmsPackagesStatisticsSet");
|
|
|
- List<Map<String, Object>> result = ListUtil.convertToUnderscoreCase(list);
|
|
|
-
|
|
|
- return result;
|
|
|
-
|
|
|
-
|
|
|
- } catch (TencentCloudSDKException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public List<Map<String, Object>> getSmsPackagesStatistics(String beginTime, String endTime) {
|
|
|
+// try {
|
|
|
+//
|
|
|
+// // ----------------------------------------------------------------------
|
|
|
+// Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
|
|
+// ClientProfile clientProfile = new ClientProfile();
|
|
|
+// SmsClient client = new SmsClient(cred, "ap-guangzhou",clientProfile);
|
|
|
+//
|
|
|
+// SmsPackagesStatisticsRequest req = new SmsPackagesStatisticsRequest();
|
|
|
+// req.setSmsSdkAppId(sdkAppId);
|
|
|
+// req.setLimit(100L);
|
|
|
+// req.setOffset(0L);
|
|
|
+// req.setBeginTime((String) getCurrentAndBeforeDate(beginTime, endTime, 7).get("beginTime"));
|
|
|
+// req.setEndTime(((String) getCurrentAndBeforeDate(beginTime, endTime, 7).get("endTime")));
|
|
|
+//
|
|
|
+// /* 通过 client 对象调用 SendStatusStatistics 方法发起请求。注意请求方法名与请求对象是对应的
|
|
|
+// * 返回的 res 是一个 SendStatusStatisticsResponse 类的实例,与请求对象对应 */
|
|
|
+// SmsPackagesStatisticsResponse res = client.SmsPackagesStatistics(req);
|
|
|
+//
|
|
|
+// // 输出json格式的字符串回包
|
|
|
+// String resString = SendStatusStatisticsResponse.toJsonString(res);
|
|
|
+// JSONObject resp = JSONUtil.parseObj(resString);
|
|
|
+//
|
|
|
+// System.out.println(resp);
|
|
|
+// /*
|
|
|
+// {
|
|
|
+// "SmsPackagesStatisticsSet": [
|
|
|
+// {
|
|
|
+// "PackageCreateTime": 1713863741,
|
|
|
+// "PackageEffectiveTime": 1713863741,
|
|
|
+// "PackageExpiredTime": 1721726141,
|
|
|
+// "PackageAmount": 500,
|
|
|
+// "PackageType": 0,
|
|
|
+// "PackageId": 1002730611,
|
|
|
+// "CurrentUsage": 13
|
|
|
+// }
|
|
|
+// ],
|
|
|
+// "RequestId": "15f81795-7a14-43cc-9215-efcc8886e1af"
|
|
|
+// }
|
|
|
+// */
|
|
|
+// List<Map<String, Object>> list = (List<Map<String, Object>>) MapUtil.get(resp, "SmsPackagesStatisticsSet");
|
|
|
+// List<Map<String, Object>> result = ListUtil.convertToUnderscoreCase(list);
|
|
|
+//
|
|
|
+// return result;
|
|
|
+//
|
|
|
+//
|
|
|
+// } catch (TencentCloudSDKException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* [腾讯云] 号码信息查询
|
|
|
*/
|
|
|
- @Override
|
|
|
- public List<Map<String, Object>> getDescribePhoneNumberInfo(String phones) {
|
|
|
- try {
|
|
|
-
|
|
|
- if (phones == null) {
|
|
|
- throw new CustomException("手机号码不能为空");
|
|
|
- }
|
|
|
- String[] phoneNumberSet = phones.split(",");
|
|
|
-
|
|
|
- // ----------------------------------------------------------------------
|
|
|
- Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
|
|
- ClientProfile clientProfile = new ClientProfile();
|
|
|
- SmsClient client = new SmsClient(cred, "ap-guangzhou",clientProfile);
|
|
|
-
|
|
|
- DescribePhoneNumberInfoRequest req = new DescribePhoneNumberInfoRequest();
|
|
|
- req.setPhoneNumberSet(phoneNumberSet);
|
|
|
-
|
|
|
- DescribePhoneNumberInfoResponse res = client.DescribePhoneNumberInfo(req);
|
|
|
-
|
|
|
- // 输出json格式的字符串回包
|
|
|
- String resString = SendStatusStatisticsResponse.toJsonString(res);
|
|
|
- JSONObject resp = JSONUtil.parseObj(resString);
|
|
|
- /*
|
|
|
- {
|
|
|
- "PhoneNumberInfoSet": [
|
|
|
- {
|
|
|
- "Code": "InvalidParameterValue.IncorrectPhoneNumber",
|
|
|
- "Message": "incorrect phoneNumber format",
|
|
|
- "NationCode": "",
|
|
|
- "SubscriberNumber": "",
|
|
|
- "PhoneNumber": "13670511519",
|
|
|
- "IsoCode": "DEF",
|
|
|
- "IsoName": ""
|
|
|
- }
|
|
|
- ],
|
|
|
- "RequestId": "b49704fe-5286-4d4a-87eb-f560a72320ab"
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) MapUtil.get(resp, "PhoneNumberInfoSet");
|
|
|
- List<Map<String, Object>> result = ListUtil.convertToUnderscoreCase(list);
|
|
|
-
|
|
|
- return result;
|
|
|
-
|
|
|
-
|
|
|
- } catch (TencentCloudSDKException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public List<Map<String, Object>> getDescribePhoneNumberInfo(String phones) {
|
|
|
+// try {
|
|
|
+//
|
|
|
+// if (phones == null) {
|
|
|
+// throw new CustomException("手机号码不能为空");
|
|
|
+// }
|
|
|
+// String[] phoneNumberSet = phones.split(",");
|
|
|
+//
|
|
|
+// // ----------------------------------------------------------------------
|
|
|
+// Credential cred = new Credential(SECRET_ID, SECRET_KEY);
|
|
|
+// ClientProfile clientProfile = new ClientProfile();
|
|
|
+// SmsClient client = new SmsClient(cred, "ap-guangzhou",clientProfile);
|
|
|
+//
|
|
|
+// DescribePhoneNumberInfoRequest req = new DescribePhoneNumberInfoRequest();
|
|
|
+// req.setPhoneNumberSet(phoneNumberSet);
|
|
|
+//
|
|
|
+// DescribePhoneNumberInfoResponse res = client.DescribePhoneNumberInfo(req);
|
|
|
+//
|
|
|
+// // 输出json格式的字符串回包
|
|
|
+// String resString = SendStatusStatisticsResponse.toJsonString(res);
|
|
|
+// JSONObject resp = JSONUtil.parseObj(resString);
|
|
|
+// /*
|
|
|
+// {
|
|
|
+// "PhoneNumberInfoSet": [
|
|
|
+// {
|
|
|
+// "Code": "InvalidParameterValue.IncorrectPhoneNumber",
|
|
|
+// "Message": "incorrect phoneNumber format",
|
|
|
+// "NationCode": "",
|
|
|
+// "SubscriberNumber": "",
|
|
|
+// "PhoneNumber": "13670511519",
|
|
|
+// "IsoCode": "DEF",
|
|
|
+// "IsoName": ""
|
|
|
+// }
|
|
|
+// ],
|
|
|
+// "RequestId": "b49704fe-5286-4d4a-87eb-f560a72320ab"
|
|
|
+// }
|
|
|
+// */
|
|
|
+//
|
|
|
+// List<Map<String, Object>> list = (List<Map<String, Object>>) MapUtil.get(resp, "PhoneNumberInfoSet");
|
|
|
+// List<Map<String, Object>> result = ListUtil.convertToUnderscoreCase(list);
|
|
|
+//
|
|
|
+// return result;
|
|
|
+//
|
|
|
+//
|
|
|
+// } catch (TencentCloudSDKException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
}
|