聊天会话记录
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@
|
||||
|
||||
**/node_modules/**
|
||||
hs-im-server/.vs/
|
||||
hs-im-server/hs-im-server.7z
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
@@ -10,101 +10,4 @@
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.13" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.13" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.1.5.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.51" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
12
hs-im-app-server/logs/mylog.log.2023-09-28.log
Normal file
12
hs-im-app-server/logs/mylog.log.2023-09-28.log
Normal file
@@ -0,0 +1,12 @@
|
||||
2023-09-28 20:24:40 -Starting AppServiceApplication on luojie with PID 13672 (E:\workplace\huashi_project\im-system\hs-im-app-server\target\classes started by coolp in E:\workplace\huashi_project\im-system\hs-im-app-server)
|
||||
2023-09-28 20:24:40 -The following profiles are active: dev
|
||||
2023-09-28 20:24:40 -Tomcat initialized with port(s): 8989 (http)
|
||||
2023-09-28 20:24:40 -Initializing ProtocolHandler ["http-nio-8989"]
|
||||
2023-09-28 20:24:40 -Starting service [Tomcat]
|
||||
2023-09-28 20:24:40 -Starting Servlet engine: [Apache Tomcat/9.0.37]
|
||||
2023-09-28 20:24:40 -Initializing Spring embedded WebApplicationContext
|
||||
2023-09-28 20:24:40 -Root WebApplicationContext: initialization completed in 594 ms
|
||||
2023-09-28 20:24:42 -Initializing ExecutorService 'applicationTaskExecutor'
|
||||
2023-09-28 20:24:42 -Starting ProtocolHandler ["http-nio-8989"]
|
||||
2023-09-28 20:24:42 -Tomcat started on port(s): 8989 (http) with context path ''
|
||||
2023-09-28 20:24:42 -Started AppServiceApplication in 2.762 seconds (JVM running for 3.545)
|
||||
@@ -17,7 +17,6 @@ import java.util.List;
|
||||
public class WebSocketMessageDecoder extends MessageToMessageDecoder<BinaryWebSocketFrame> {
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, BinaryWebSocketFrame msg, List<Object> out) throws Exception {
|
||||
System.out.println("ws解码器收到信息");
|
||||
|
||||
ByteBuf content = msg.content();
|
||||
if (content.readableBytes() < 28) {
|
||||
|
||||
@@ -37,8 +37,10 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -49,4 +51,4 @@
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -2,13 +2,16 @@ package com.lld.im.common.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: lld
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class RequestBase {
|
||||
public class RequestBase implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer appId;
|
||||
|
||||
private String operater;
|
||||
|
||||
@@ -8,10 +8,12 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class SyncReq extends RequestBase {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//客户端最大seq
|
||||
private Long lastSequence;
|
||||
//一次拉取多少
|
||||
private Integer maxLimit;
|
||||
|
||||
private String operater;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ import com.lld.im.service.group.model.req.ImportGroupReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
@@ -43,12 +41,8 @@ public class ConversationController {
|
||||
}
|
||||
|
||||
@RequestMapping("/syncConversationList")
|
||||
public ResponseVO syncFriendShipList(@RequestBody @Validated SyncReq req, Integer appId) {
|
||||
public ResponseVO syncFriendShipList(@RequestBody @Validated SyncReq req,Integer appId) {
|
||||
req.setAppId(appId);
|
||||
log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&");
|
||||
log.info(req.toString());
|
||||
log.info(appId.toString());
|
||||
log.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&");
|
||||
return conversationService.syncConversationSet(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.lld.im.service.friendship.dao.ImFriendShipEntity;
|
||||
import com.lld.im.service.seq.RedisSeq;
|
||||
import com.lld.im.service.utils.MessageProducer;
|
||||
import com.lld.im.service.utils.WriteUserSeq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -33,6 +34,7 @@ import java.util.List;
|
||||
* @author: lld
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ConversationService {
|
||||
|
||||
@@ -178,6 +180,12 @@ public class ConversationService {
|
||||
queryWrapper.eq("app_id",req.getAppId());
|
||||
queryWrapper.last(" limit " + req.getMaxLimit());
|
||||
queryWrapper.orderByAsc("sequence");
|
||||
|
||||
log.info("============================= syncConversationSet ========================");
|
||||
log.info("============================= syncConversationSet ========================");
|
||||
log.info("============================= syncConversationSet ========================");
|
||||
log.info(req.toString());
|
||||
|
||||
List<ImConversationSetEntity> list = imConversationSetMapper
|
||||
.selectList(queryWrapper);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lld.im.service.friendship.controller;
|
||||
|
||||
import com.lld.im.common.ResponseVO;
|
||||
import com.lld.im.common.model.SyncReq;
|
||||
import com.lld.im.service.friendship.model.req.*;
|
||||
import com.lld.im.service.friendship.service.ImFriendService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -85,5 +86,11 @@ public class ImFriendShipController {
|
||||
return imFriendShipService.checkBlck(req);
|
||||
}
|
||||
|
||||
@RequestMapping("/syncFriendshipList")
|
||||
public ResponseVO syncFriendshipList(@RequestBody @Validated
|
||||
SyncReq req, Integer appId){
|
||||
req.setAppId(appId);
|
||||
return imFriendShipService.syncFriendshipList(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.lld.im.service.interceptor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lld.im.common.BaseErrorCode;
|
||||
import com.lld.im.common.ResponseVO;
|
||||
import com.lld.im.common.enums.GateWayErrorCode;
|
||||
import com.lld.im.common.exception.ApplicationExceptionEnum;
|
||||
import com.lld.im.common.model.RequestBase;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,7 +15,10 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.ws.RequestWrapper;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
@@ -34,9 +39,7 @@ public class GateWayInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
// if (1 == 1){
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
//获取appId 操作人 userSign
|
||||
String appIdStr = request.getParameter("appId");
|
||||
@@ -71,6 +74,7 @@ public class GateWayInterceptor implements HandlerInterceptor {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.lld.im.service.interceptor;
|
||||
|
||||
/**
|
||||
* @author: Chackylee
|
||||
* @author: rowger
|
||||
* @description:
|
||||
**/
|
||||
public class RequestHolder {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -600,7 +600,6 @@ export default {
|
||||
var msgOnlie = {}
|
||||
//聊天记录
|
||||
var msgList = {}
|
||||
debugger
|
||||
var url = ''
|
||||
if (windowType == 'SINGLE') {
|
||||
msgOnlie = {
|
||||
@@ -666,7 +665,6 @@ export default {
|
||||
type: 3
|
||||
};
|
||||
var msgSendType = 'wating';
|
||||
debugger
|
||||
//开始发送消息
|
||||
store.dispatch('sendMsg', {
|
||||
userId: userId,
|
||||
|
||||
@@ -28,6 +28,10 @@ export default {
|
||||
onSocketReConnectSuccessEvent: () => {
|
||||
console.log("重连成功");
|
||||
},
|
||||
onOfflineMessage:(e)=>{
|
||||
console.log("====================拉取到离线消息")
|
||||
console.log(e)
|
||||
},
|
||||
onTestMessage: (e) => {
|
||||
console.log("onTestMessage :" + e);
|
||||
store.dispatch('onP2PMessage',e)
|
||||
|
||||
@@ -12,5 +12,6 @@
|
||||
"author": "zmm2113@qq.com",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"localforage": "^1.10.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ import { createStore } from 'vuex'
|
||||
console.log("========================")
|
||||
console.log("========================")
|
||||
console.error(data)
|
||||
debugger
|
||||
_im.sendP2PMessage(_im.createP2PTextMessage(data.userId,data.data.content))
|
||||
},
|
||||
updateChatDataState(context,data){
|
||||
@@ -147,6 +146,7 @@ import { createStore } from 'vuex'
|
||||
console.log("data.userId:",data.userId)
|
||||
var userId=data.userId
|
||||
var windowType=data.windowType
|
||||
|
||||
//初始化聊天记录
|
||||
var data2=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatlistData')
|
||||
if(!data2[userId]){
|
||||
@@ -166,6 +166,10 @@ import { createStore } from 'vuex'
|
||||
// })
|
||||
|
||||
_im.getSingleUserInfo(userId).then((res)=>{
|
||||
console.log(res.data)
|
||||
console.log(res.data)
|
||||
console.log(res.data)
|
||||
console.log(res.data)
|
||||
if (res.code == 200) {
|
||||
var detail=res.data
|
||||
data1[userId]={
|
||||
|
||||
@@ -26,15 +26,25 @@ export default class HttpApi {
|
||||
|
||||
let requestMethod = "POST";
|
||||
|
||||
// 讲appid等参数写入body
|
||||
body=this.setQueryToBody(params,body);
|
||||
|
||||
const headers = {
|
||||
'Content-Type':'application/json',
|
||||
};
|
||||
|
||||
|
||||
const request: any = {method: requestMethod,headers:headers, mode: 'cors', body: Beans.json(body)};
|
||||
return this.httpFetch(reqUrl, request);
|
||||
|
||||
}
|
||||
|
||||
setQueryToBody(params:any,body:any){
|
||||
for(const o in params){
|
||||
body[o] = params[o];
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
setQueryConfig(params:any){
|
||||
var _str = "?";
|
||||
for(const o in params){
|
||||
|
||||
@@ -69,8 +69,8 @@ export class ImClient {
|
||||
userSign!: string;
|
||||
imeiLength?: number
|
||||
state = State.INIT
|
||||
// lastOfflineMessageSequence: number = 0;
|
||||
// offlineMessageList: Array<any> = new Array<any>()
|
||||
lastOfflineMessageSequence: number = 0;
|
||||
offlineMessageList: Array<any> = new Array<any>()
|
||||
httpUrl: string = ""//http://127.0.0.1:8000/v1
|
||||
|
||||
private conn?: w3cwebsocket
|
||||
@@ -171,7 +171,7 @@ export class ImClient {
|
||||
this.conn = conn;
|
||||
this.state = State.CONNECTED
|
||||
//拉取离线消息
|
||||
// this.loadOfflineMessage();
|
||||
this.loadOfflineMessage();
|
||||
//心跳包
|
||||
this.heartbeatLoop(this.conn);
|
||||
|
||||
@@ -292,7 +292,7 @@ export class ImClient {
|
||||
public getUserConversationList(lastSequence:Long): Promise<any> {
|
||||
return new Promise((resolve, _) => {
|
||||
let api = new HttpApi(this.httpUrl);
|
||||
let resp = api.call("/conversation/syncConversationList", this.getRequestParams(), { userId: this.userId,appId:this.appId,maxLimit:100, lastSequence:lastSequence })
|
||||
let resp = api.call("/conversation/syncConversationList", this.getRequestParams(), { userId: this.userId,appId:this.appId,maxLimit:100, lastSequence:lastSequence,operater:this.userId })
|
||||
resolve(resp);
|
||||
})
|
||||
}
|
||||
@@ -336,25 +336,26 @@ export class ImClient {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
// private async loadOfflineMessage() {
|
||||
// log.info("loadOfflineMessage start")
|
||||
// let api = new HttpApi(this.httpUrl);
|
||||
// let resp = await api.call("/message/syncOfflineMessage",this.getRequestParams(),{clientType : this.clientType,appId : this.appId,lastSequence:this.lastOfflineMessageSequence,maxLimit:100})
|
||||
// if(resp.isSucceed()){
|
||||
// this.lastOfflineMessageSequence = resp.data.maxSequence;
|
||||
// let offmessages = resp.data.dataList;
|
||||
// this.offlineMessageList.push(offmessages)
|
||||
// if(offmessages.length > 0 && typeof imClient.listeners.onOfflineMessage === 'function'){
|
||||
// imClient.listeners.onOfflineMessage(offmessages);
|
||||
// }
|
||||
// console.log(resp.data.completed)
|
||||
// if(!resp.data.completed){
|
||||
// this.loadOfflineMessage();
|
||||
// }
|
||||
// }else{
|
||||
// log.error("loadOfflineMessage - error")
|
||||
// }
|
||||
// }
|
||||
//拉取离线信息记录
|
||||
private async loadOfflineMessage() {
|
||||
log.info("loadOfflineMessage start")
|
||||
let api = new HttpApi(this.httpUrl);
|
||||
let resp = await api.call("/message/syncOfflineMessage",this.getRequestParams(),{clientType : this.clientType,operater:this.userId, appId : this.appId,lastSequence:this.lastOfflineMessageSequence,maxLimit:100})
|
||||
if(resp.isSucceed()){
|
||||
this.lastOfflineMessageSequence = resp.data.maxSequence;
|
||||
let offmessages = resp.data.dataList;
|
||||
this.offlineMessageList.push(offmessages)
|
||||
if(offmessages.length > 0 && typeof imClient.listeners.onOfflineMessage === 'function'){
|
||||
imClient.listeners.onOfflineMessage(offmessages);
|
||||
}
|
||||
console.log(resp.data.completed)
|
||||
if(!resp.data.completed){
|
||||
this.loadOfflineMessage();
|
||||
}
|
||||
}else{
|
||||
log.error("loadOfflineMessage - error")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user