perf:调整消息日志相关代码
This commit is contained in:
@@ -4,8 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.pojos.UserChannel;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -61,18 +61,18 @@ public class TsMessageService {
|
||||
* @param userChannel
|
||||
* @param body
|
||||
*/
|
||||
public MessageReqResp send(UserChannel userChannel, JSONObject body) {
|
||||
public ApiResp<String> send(UserChannel userChannel, JSONObject body) {
|
||||
|
||||
if (StrUtil.isEmpty(userChannel.getUser()) || StrUtil.isEmpty(userChannel.getChannel())) {
|
||||
return null;
|
||||
return ApiResp.resp130("消息对象或消息通道不存在");
|
||||
}
|
||||
|
||||
TsMessageSender messageSender = CollUtil.findOne(messageSenderList,
|
||||
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
|
||||
if (messageSender != null) {
|
||||
messageSender.send(userChannel.getUser(), body);
|
||||
return messageSender.send(userChannel.getUser(), body);
|
||||
}
|
||||
return null;
|
||||
return ApiResp.resp130("消息未成功发送");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user