This commit is contained in:
dute7liang
2024-01-11 23:38:56 +08:00
parent f7485b9066
commit 728192d4f0
21 changed files with 231 additions and 58 deletions

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.ruoyi.yunxin.client.ImMessageClient;
import com.ruoyi.yunxin.config.YunxinProperties;
import com.ruoyi.yunxin.req.Option;
import com.ruoyi.yunxin.req.SendAttachMsgReq;
import com.ruoyi.yunxin.req.SendBatchMsgReq;
import com.ruoyi.yunxin.req.SendMsgReq;
import com.ruoyi.yunxin.req.type.YxTextData;
@@ -25,7 +26,6 @@ public class Yunxin {
@Resource
private ImMessageClient messageClient;
@Deprecated
public YxDataR<SendMsgResp> sendTo(Long toUid,Long fromUid,Object data){
SendMsgReq req = new SendMsgReq();
req.setFrom(fromUid == null ? yunxinProperties.getDefaultFromUid() : fromUid+"");
@@ -44,4 +44,13 @@ public class Yunxin {
return messageClient.sendBatchMsg(req);
}
public YxDataR<YxCommonR> sendAttachMsg(Long fromUid, Long toUid, Object data){
SendAttachMsgReq sendAttachMsgReq = new SendAttachMsgReq();
sendAttachMsgReq.setFrom(fromUid+"");
sendAttachMsgReq.setTo(toUid+"");
sendAttachMsgReq.setAttach(JSON.toJSONString(data));
sendAttachMsgReq.setOption(JSON.toJSONString(new Option()));
return messageClient.sendAttachMsg(sendAttachMsgReq);
}
}