|
@@ -1,34 +1,38 @@
|
|
|
package com.tourism.webadmin.back.util;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.tourism.webadmin.config.SmsSwitch;
|
|
|
import com.volcengine.model.request.SmsSendRequest;
|
|
|
import com.volcengine.model.response.SmsSendResponse;
|
|
|
import com.volcengine.service.sms.SmsService;
|
|
|
import com.volcengine.service.sms.SmsServiceInfoConfig;
|
|
|
import com.volcengine.service.sms.impl.SmsServiceImpl;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class SMSUtils {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SmsSwitch smsSwitch;
|
|
|
private static final String AK = "AKLTYzA3ZDNiY2M5MWNlNGM1NThhM2ZlN2JhNTIyYWMxZDA";
|
|
|
|
|
|
private static final String SK = "WXpVME1USTBNbVprTnpKaU5HTTNORGhsT1dJNU1tUXlaVFl4TjJVeE1Uaw==";
|
|
|
|
|
|
private static SmsService smsService = SmsServiceImpl.getInstance(new SmsServiceInfoConfig(AK, SK));
|
|
|
|
|
|
- public static void sendMsg(String countryCode, String phoneNumber, String code){
|
|
|
+ public void sendMsg(String countryCode, String phoneNumber, String code){
|
|
|
SmsSendRequest req = new SmsSendRequest();
|
|
|
req.setPhoneNumbers(countryCode.replaceAll("\\+", "") + phoneNumber);
|
|
|
+ req.setSmsAccount(smsSwitch.getSmsAccount());
|
|
|
if(countryCode.equals("86") || StringUtils.isBlank(countryCode)){
|
|
|
- req.setSmsAccount("7fe76339");
|
|
|
- req.setTemplateId("ST_7fe71e56");
|
|
|
- req.setSign("山东老韩国际人才合作");
|
|
|
+ req.setTemplateId(smsSwitch.getChinaTemplateId());
|
|
|
+ req.setSign(smsSwitch.getChinaSign());
|
|
|
}else {
|
|
|
- req.setSmsAccount("7fe76339");
|
|
|
- req.setTemplateId("ST_7fe70c7c");
|
|
|
- req.setSign("XYTravel");
|
|
|
+ req.setTemplateId(smsSwitch.getOtherTemplateId());
|
|
|
+ req.setSign(smsSwitch.getOtherSign());
|
|
|
}
|
|
|
|
|
|
Map<String,String> param = new HashMap<>();
|