|
@@ -8,22 +8,24 @@ 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.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+@Service
|
|
|
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));
|
|
|
+ private static SmsService smsService;
|
|
|
|
|
|
public void sendMsg(String countryCode, String phoneNumber, String code){
|
|
|
+ smsService = SmsServiceImpl.getInstance(new SmsServiceInfoConfig(smsSwitch.getAK(), smsSwitch.getSK()));
|
|
|
+
|
|
|
SmsSendRequest req = new SmsSendRequest();
|
|
|
req.setPhoneNumbers(countryCode.replaceAll("\\+", "") + phoneNumber);
|
|
|
req.setSmsAccount(smsSwitch.getSmsAccount());
|