根据messageKey查询message信息接口
This commit is contained in:
@@ -6,6 +6,8 @@ import com.lld.im.common.model.SyncReq;
|
|||||||
import com.lld.im.common.model.message.CheckSendMessageReq;
|
import com.lld.im.common.model.message.CheckSendMessageReq;
|
||||||
import com.lld.im.service.message.model.req.SendMessageReq;
|
import com.lld.im.service.message.model.req.SendMessageReq;
|
||||||
import com.lld.im.service.message.model.resp.ImMessageHistoryVo;
|
import com.lld.im.service.message.model.resp.ImMessageHistoryVo;
|
||||||
|
import com.lld.im.service.message.model.resp.SendMessageResp;
|
||||||
|
import com.lld.im.service.message.service.MessageService;
|
||||||
import com.lld.im.service.message.service.MessageSyncService;
|
import com.lld.im.service.message.service.MessageSyncService;
|
||||||
import com.lld.im.service.message.service.P2PMessageService;
|
import com.lld.im.service.message.service.P2PMessageService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -33,6 +35,15 @@ public class MessageController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
MessageSyncService messageSyncService;
|
MessageSyncService messageSyncService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MessageService messageService;
|
||||||
|
|
||||||
|
@RequestMapping("/queryMsgDetailsByMessageKey")
|
||||||
|
public ResponseVO queryMsgDetailsByMessageKey(@RequestBody @Validated SendMessageResp req, Integer appId) {
|
||||||
|
req.setAppId(appId);
|
||||||
|
return ResponseVO.successResponse(messageService.queryMsgDetailsByMessageKey(req.getMessageKey()));
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/send")
|
@RequestMapping("/send")
|
||||||
public ResponseVO send(@RequestBody @Validated SendMessageReq req, Integer appId) {
|
public ResponseVO send(@RequestBody @Validated SendMessageReq req, Integer appId) {
|
||||||
req.setAppId(appId);
|
req.setAppId(appId);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.lld.im.service.message.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.lld.im.common.model.message.MessageContent;
|
||||||
|
import com.lld.im.service.call.dao.ImCallHistoryEntity;
|
||||||
|
import com.lld.im.service.message.dao.ImMessageHistoryEntity;
|
||||||
|
import com.lld.im.service.message.dao.mapper.ImMessageBodyMapper;
|
||||||
|
import com.lld.im.service.message.dao.mapper.ImMessageHistoryMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MessageService {
|
||||||
|
@Autowired
|
||||||
|
ImMessageHistoryMapper imMessageHistoryMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ImMessageBodyMapper imMessageBodyMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public ImMessageHistoryEntity queryMsgDetailsByMessageKey(Long messageKey){
|
||||||
|
QueryWrapper<ImMessageHistoryEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("message_key",messageKey);
|
||||||
|
|
||||||
|
List<ImMessageHistoryEntity> imCallHistoryEntityList = imMessageHistoryMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
return imCallHistoryEntityList.get(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -492,6 +492,7 @@ export default {
|
|||||||
if (same) {
|
if (same) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//离线消息体
|
//离线消息体
|
||||||
var msgOffline = {
|
var msgOffline = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -515,7 +516,7 @@ export default {
|
|||||||
nickName: fromInfo.nickName,
|
nickName: fromInfo.nickName,
|
||||||
portrait: fromInfo.portrait,
|
portrait: fromInfo.portrait,
|
||||||
content: msgTypeLabel,
|
content: msgTypeLabel,
|
||||||
time: dayjs().format("YYYY/MM/DD HH:mm:ss"),
|
time: dayjs(time).format("YYYY/MM/DD HH:mm:ss"),
|
||||||
num: disturb == 'Y' ? 'dot' : (chatListInfo.num ? chatListInfo.num + 1 : 1),
|
num: disturb == 'Y' ? 'dot' : (chatListInfo.num ? chatListInfo.num + 1 : 1),
|
||||||
windowType: windowType,
|
windowType: windowType,
|
||||||
disturb: "N", //是否静默消息
|
disturb: "N", //是否静默消息
|
||||||
@@ -538,6 +539,7 @@ export default {
|
|||||||
userType: 'GROUP'
|
userType: 'GROUP'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//TODO 需要请求接口获取真实的消息时间
|
||||||
chatWindowData.push(msgOffline)
|
chatWindowData.push(msgOffline)
|
||||||
store.dispatch('updateChatById', {
|
store.dispatch('updateChatById', {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
@@ -1022,6 +1024,9 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
const _data = JSON.parse(msg.messageBody)
|
const _data = JSON.parse(msg.messageBody)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// try{
|
// try{
|
||||||
// console.log("=======================formatMessage")
|
// console.log("=======================formatMessage")
|
||||||
// console.log(_data)
|
// console.log(_data)
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ const store = new Vuex.Store({
|
|||||||
nickName: detail.nickName,
|
nickName: detail.nickName,
|
||||||
portrait: _userId == _obj.fromId ? _userInfo
|
portrait: _userId == _obj.fromId ? _userInfo
|
||||||
.photo : detail.photo,
|
.photo : detail.photo,
|
||||||
time: dayjs(_obj.createTime).format(
|
time: dayjs(_obj.time).format(
|
||||||
"YYYY/MM/DD HH:mm:ss"),
|
"YYYY/MM/DD HH:mm:ss"),
|
||||||
num: 0,
|
num: 0,
|
||||||
windowType: 'SINGLE',
|
windowType: 'SINGLE',
|
||||||
@@ -320,6 +320,7 @@ const store = new Vuex.Store({
|
|||||||
}
|
}
|
||||||
//判断头像是谁的
|
//判断头像是谁的
|
||||||
|
|
||||||
|
|
||||||
context.dispatch('updateChatListInfoById', {
|
context.dispatch('updateChatListInfoById', {
|
||||||
userId: data.userId,
|
userId: data.userId,
|
||||||
data: {
|
data: {
|
||||||
@@ -329,7 +330,7 @@ const store = new Vuex.Store({
|
|||||||
nickName: detail.nickName,
|
nickName: detail.nickName,
|
||||||
portrait: _userId == _obj.fromId ? _userInfo
|
portrait: _userId == _obj.fromId ? _userInfo
|
||||||
.photo : detail.photo,
|
.photo : detail.photo,
|
||||||
time: dayjs(_obj.createTime).format(
|
time: dayjs(_obj.time).format(
|
||||||
"YYYY/MM/DD HH:mm:ss"),
|
"YYYY/MM/DD HH:mm:ss"),
|
||||||
num: 0,
|
num: 0,
|
||||||
windowType: 'SINGLE',
|
windowType: 'SINGLE',
|
||||||
|
|||||||
@@ -333,6 +333,15 @@ export class ImClient {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public queryMsgDetailsByMessageKey(messageKey:Long): Promise<any> {
|
||||||
|
return new Promise((resolve, _) => {
|
||||||
|
let api = new HttpApi(this.httpUrl);
|
||||||
|
let resp = api.call("/message/queryMsgDetailsByMessageKey", this.getRequestParams(), { appId:this.appId, messageKey:messageKey,operater:this.userId })
|
||||||
|
resolve(resp);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public getChatMessageHistoryList(uid:String,offset:Long,limit:Long): Promise<any> {
|
public getChatMessageHistoryList(uid:String,offset:Long,limit:Long): Promise<any> {
|
||||||
return new Promise((resolve, _) => {
|
return new Promise((resolve, _) => {
|
||||||
let api = new HttpApi(this.httpUrl);
|
let api = new HttpApi(this.httpUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user