websocket 整合
This commit is contained in:
@@ -5,7 +5,6 @@ import cn.hutool.core.lang.UUID;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.cai.util.RestTemplateUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -23,7 +22,7 @@ public class Yunxin {
|
||||
private final static String SEND_URL = "https://api.netease.im/nimserver/msg/sendMsg.action";
|
||||
private final static String SEND_ATTR_URL = "https://api.netease.im/nimserver/msg/sendAttachMsg.action";
|
||||
|
||||
public void sendTo(String toUid,Object data,String fromUid){
|
||||
public void sendTo(Long toUid,Object data,Long fromUid){
|
||||
Map<String,Object> option = new HashMap<>();
|
||||
option.put("push",true); // 该消息是否需要APNS推送或安卓系统通知栏推送
|
||||
option.put("roam",false); // 该消息是否需要漫游(需要app开通漫游消息功能)
|
||||
@@ -32,7 +31,7 @@ public class Yunxin {
|
||||
option.put("route",false); // 该消息是否需要抄送第三方 (需要app开通消息抄送功能)
|
||||
|
||||
Map<String,Object> bodyData = new HashMap<>();
|
||||
bodyData.put("from", StringUtils.isBlank(fromUid) ? yunxinProperties.getDefaultFromUid() :fromUid);
|
||||
bodyData.put("from", fromUid == null ? yunxinProperties.getDefaultFromUid() :fromUid);
|
||||
bodyData.put("ope", 0);
|
||||
bodyData.put("to", toUid);
|
||||
bodyData.put("type", 100);
|
||||
@@ -49,7 +48,7 @@ public class Yunxin {
|
||||
RestTemplateUtil.restTemplate.postForObject(SEND_URL,httpEntity, JSONObject.class);
|
||||
}
|
||||
|
||||
public void sendAttachMsg(String toUid,Object data,String fromUid){
|
||||
public void sendAttachMsg(Long toUid,Object data,Long fromUid){
|
||||
Map<String,Object> option = new HashMap<>();
|
||||
option.put("push",true); // 该消息是否需要APNS推送或安卓系统通知栏推送
|
||||
option.put("roam",false); // 该消息是否需要漫游(需要app开通漫游消息功能)
|
||||
@@ -58,7 +57,7 @@ public class Yunxin {
|
||||
option.put("route",false); // 该消息是否需要抄送第三方 (需要app开通消息抄送功能)
|
||||
|
||||
Map<String,Object> bodyData = new HashMap<>();
|
||||
bodyData.put("from", StringUtils.isBlank(fromUid) ? yunxinProperties.getDefaultFromUid() :fromUid);
|
||||
bodyData.put("from", fromUid == null ? yunxinProperties.getDefaultFromUid() :fromUid);
|
||||
bodyData.put("ope", 0);
|
||||
bodyData.put("to", toUid);
|
||||
bodyData.put("type", 100);
|
||||
|
||||
Reference in New Issue
Block a user