This commit is contained in:
dute7liang
2024-01-27 19:46:21 +08:00
parent 63b2d1f238
commit d0a53c31a5
15 changed files with 290 additions and 22 deletions

View File

@@ -3,10 +3,7 @@ package com.ruoyi.yunxin;
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.*;
import com.ruoyi.yunxin.req.type.YxTextData;
import com.ruoyi.yunxin.resp.SendMsgResp;
import com.ruoyi.yunxin.resp.YxCommonR;
@@ -90,4 +87,22 @@ public class Yunxin {
return messageClient.sendAttachMsg(sendAttachMsgReq);
}
public YxDataR<YxCommonR> sendBatchAttachMsgNotice(List<Long> toUid, Object data){
SendBatchAttachMsgReq req = new SendBatchAttachMsgReq();
req.setFromAccid(SYS_NOTICE_ID);
req.setToAccids(toUid.stream().map(i -> String.valueOf(toUid)).collect(Collectors.toList()));
req.setAttach(JSON.toJSONString(data));
return messageClient.sendBatchAttachMsg(req);
}
public YxDataR<YxCommonR> sendAttachMsgNotice(Long toUid, Object data){
SendAttachMsgReq sendAttachMsgReq = new SendAttachMsgReq();
sendAttachMsgReq.setFrom(SYS_NOTICE_ID);
sendAttachMsgReq.setTo(toUid+"");
sendAttachMsgReq.setAttach(JSON.toJSONString(data));
sendAttachMsgReq.setOption(JSON.toJSONString(new Option()));
return messageClient.sendAttachMsg(sendAttachMsgReq);
}
}