perf:消息发送接口该body类型为JSONObject

This commit is contained in:
曾文豪
2023-05-22 11:12:29 +08:00
parent c418a0b952
commit e29e9552ac
3 changed files with 6 additions and 4 deletions

View File

@@ -138,7 +138,7 @@ public class AliyunSmsSender implements TieshengMessageSender {
} }
@Override @Override
public MessageReqResp send(String user, String title, Object body) { public MessageReqResp send(String user, String title, JSONObject body) {
return sendSms(user, title, (JSONObject) body); return sendSms(user, title, (JSONObject) body);
} }

View File

@@ -1,6 +1,7 @@
package com.tiesheng.message.service; package com.tiesheng.message.service;
import cn.hutool.json.JSONObject;
import com.tiesheng.message.pojos.MessageReqResp; import com.tiesheng.message.pojos.MessageReqResp;
/** /**
@@ -19,7 +20,7 @@ public interface TieshengMessageSender {
* @param channel 消息通道,如果为空表示所有通道 * @param channel 消息通道,如果为空表示所有通道
* @return 返回的内容,如果为空表示发送成功 * @return 返回的内容,如果为空表示发送成功
*/ */
MessageReqResp send(String user, String title, Object body); MessageReqResp send(String user, String title, JSONObject body);
/** /**

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.tiesheng.core.mapper.CoreLogMessageMapper; import com.tiesheng.core.mapper.CoreLogMessageMapper;
import com.tiesheng.core.pojos.dao.CoreLogMessage; import com.tiesheng.core.pojos.dao.CoreLogMessage;
import com.tiesheng.message.pojos.MessageReqResp; import com.tiesheng.message.pojos.MessageReqResp;
@@ -34,7 +35,7 @@ public class CoreMessageService {
* @param body * @param body
* @param channels 消息通道如果为all时表示发送全部通道 * @param channels 消息通道如果为all时表示发送全部通道
*/ */
public void multiple(String user, String title, Object body, String... channels) { public void multiple(String user, String title, JSONObject body, String... channels) {
if (StrUtil.isEmpty(user) || ArrayUtil.isEmpty(channels)) { if (StrUtil.isEmpty(user) || ArrayUtil.isEmpty(channels)) {
return; return;
} }
@@ -56,7 +57,7 @@ public class CoreMessageService {
* @param title * @param title
* @param body * @param body
*/ */
public MessageReqResp send(String user, String title, Object body, String channel) { public MessageReqResp send(String user, String title, JSONObject body, String channel) {
if (StrUtil.isEmpty(user) || StrUtil.isEmpty(channel)) { if (StrUtil.isEmpty(user) || StrUtil.isEmpty(channel)) {
return null; return null;
} }