|
|
@@ -41,6 +41,9 @@ public class SmsUtil {
|
|
|
|
|
|
private static final String TENCENT_SMS_TEMPLATE_ID = "1705927";
|
|
|
|
|
|
+ //国际腾讯云短信
|
|
|
+ private static final String TENCENT_SMS_INTERNATIONAL_TEMPLATE_ID = "1705927";
|
|
|
+
|
|
|
private static final Logger log = LoggerFactory.getLogger(SmsUtil.class);
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
@@ -83,7 +86,7 @@ public class SmsUtil {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public static void sendTencent(String mobile, String msg) {
|
|
|
+ public static void sendTencent(Integer cid, String mobile, String msg) {
|
|
|
try {
|
|
|
/* 必要步骤:
|
|
|
* 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
|
|
|
@@ -129,6 +132,9 @@ public class SmsUtil {
|
|
|
|
|
|
/* 模板 ID: 必须填写已审核通过的模板 ID */
|
|
|
String templateId = TENCENT_SMS_TEMPLATE_ID;
|
|
|
+ if (cid != 86) {
|
|
|
+ templateId = TENCENT_SMS_INTERNATIONAL_TEMPLATE_ID;
|
|
|
+ }
|
|
|
req.setTemplateId(templateId);
|
|
|
|
|
|
/* 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 */
|
|
|
@@ -137,6 +143,7 @@ public class SmsUtil {
|
|
|
|
|
|
/* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]
|
|
|
* 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号 */
|
|
|
+ mobile = String.format("+%s%s", cid, mobile);
|
|
|
String[] phoneNumberSet = {mobile};
|
|
|
req.setPhoneNumberSet(phoneNumberSet);
|
|
|
|