perf:调整消息通知
This commit is contained in:
@@ -7,8 +7,7 @@ import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.tiesheng.message.service.TieshengMessageSender;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -22,16 +21,13 @@ import java.util.*;
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "tiesheng.aliyun")
|
||||
public class AliyunSmsConfig {
|
||||
public class AliyunSmsConfig implements TieshengMessageSender {
|
||||
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
private static final String ENDPOINT = "https://dysmsapi.aliyuncs.com";
|
||||
|
||||
@Autowired
|
||||
TieshengMessageConfigurer tieshengMessageConfigurer;
|
||||
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String signName;
|
||||
@@ -62,7 +58,7 @@ public class AliyunSmsConfig {
|
||||
*/
|
||||
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
|
||||
|
||||
MessageReqResp reqResp = new MessageReqResp();
|
||||
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
||||
reqResp.setTarget(phoneNumbers);
|
||||
reqResp.setResult(1);
|
||||
reqResp.setContent(JSONUtil.createObj()
|
||||
@@ -115,11 +111,19 @@ public class AliyunSmsConfig {
|
||||
reqResp.setToast(respObj.getStr("Message"));
|
||||
}
|
||||
|
||||
tieshengMessageConfigurer.onMessageSend("阿里云短信", reqResp);
|
||||
|
||||
return reqResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageReqResp send(String user, String title, Object body) {
|
||||
return sendSms(user, title, (JSONObject) body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "sms";
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user