|
@@ -28,12 +28,14 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(YimeiSmsPlugin.class);
|
|
|
|
|
|
- @Value("${com.properties.sms-appId:EUCP-EMY-SMS1-DX0Y9}")
|
|
|
+ @Value("${sms.yimei.appId:EUCP-EMY-SMS1-DX0Y9}")
|
|
|
private String appId;
|
|
|
- @Value("${com.properties.sms-secretKey:B0C8230D0F2ACC64}")
|
|
|
+ @Value("${sms.yimei.secretKey:B0C8230D0F2ACC64}")
|
|
|
private String secretKey;
|
|
|
- @Value("${com.properties.sms-host-dev:http://bjmtn.b2m.cn}")
|
|
|
+ @Value("${sms.yimei.reqUrl:http://bjmtn.b2m.cn}")
|
|
|
private String host;
|
|
|
+ @Value("${sms.yimei.companyName:酷乐秀}")
|
|
|
+ private String companyName;
|
|
|
|
|
|
public final static String PLUGIN_NAME = "YiMei";
|
|
|
|
|
@@ -67,6 +69,7 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
|
|
|
|
|
|
@Override
|
|
|
public boolean send(String subject, String content, String receiver, String url, String jpushType) throws Exception {
|
|
|
+ content = "【" + companyName + "】" + content;
|
|
|
String result = getParam(subject, content, receiver, host + "/simpleinter/sendSMS");
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
if ("SUCCESS".equals(json.get("code"))) {
|
|
@@ -80,6 +83,7 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
|
|
|
@Override
|
|
|
public boolean batchSend(String subject, String content, String[] receivers, String url, String jpushType) throws Exception {
|
|
|
String join = StringUtils.join(receivers, ",");
|
|
|
+ content = "【" + companyName + "】" + content;
|
|
|
String result = getParam(subject, content, join, host + "/simpleinter/sendSMS");
|
|
|
logger.info("调用短信接口返回:{}", result);
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
@@ -94,4 +98,13 @@ public class YimeiSmsPlugin implements MessageSenderPlugin, InitializingBean {
|
|
|
public void afterPropertiesSet() throws Exception {
|
|
|
MessageSenderPluginContext.addMessageSender(this);
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ YimeiSmsPlugin plugin = new YimeiSmsPlugin();
|
|
|
+ plugin.appId = "EUCP-EMY-SMS1-DX0Y9";
|
|
|
+ plugin.companyName="酷乐秀";
|
|
|
+ plugin.host = "http://bjmtn.b2m.cn";
|
|
|
+ plugin.secretKey = "B0C8230D0F2ACC64";
|
|
|
+ plugin.send("", "测试内容", "13720176797", "", "");
|
|
|
+ }
|
|
|
}
|