websocket 整合

This commit is contained in:
张良(004796)
2023-12-29 18:17:27 +08:00
parent 3888da346c
commit 0ee961e550
46 changed files with 366 additions and 223 deletions

View File

@@ -26,7 +26,7 @@ public class Agora {
}
public List<String> getChannelUsers(String roomId){
public List<String> getChannelUsers(Long roomId){
String url = "http://api.sd-rtn.com/dev/v1/channel/user/%s/%s";
url = String.format(url, agoraProperties.getAppId(), roomId);
HttpHeaders headers = new HttpHeaders();
@@ -42,7 +42,7 @@ public class Agora {
return jsonArray.toJavaList(String.class);
}
public void closeChannel(String roomId){
public void closeChannel(Long roomId){
String url = "http://api.sd-rtn.com/dev/v1/kicking-rule";
Map<String,Object> bodyData = new HashMap<>();
bodyData.put("appid",agoraProperties.getAppId());

View File

@@ -11,8 +11,8 @@ public class ImDataRes {
public static class ImData {
private Integer callType;
private Integer status;
private String fromUid;
private String toUid;
private Integer callTime;
private Long fromUid;
private Long toUid;
private Long callTime;
}
}

View File

@@ -9,7 +9,7 @@ public class ImMsgGen {
* @param to
* @param callTime
*/
public static ImDataRes callNotice(int status,String from,String to,int callTime){
public static ImDataRes callNotice(int status,Long from,Long to,long callTime){
ImDataRes imDataRes = new ImDataRes();
imDataRes.setType(15);
ImDataRes.ImData imData = new ImDataRes.ImData();

View File

@@ -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);