2024-11-20 01:17:47 +00:00
|
|
|
import request from '@/service/index.js'
|
2024-12-06 08:55:15 +00:00
|
|
|
import qs from 'qs'
|
2025-03-26 06:30:20 +00:00
|
|
|
import {
|
|
|
|
useTalkStore,
|
|
|
|
useDialogueStore
|
|
|
|
} from '@/store'
|
2024-11-20 01:17:47 +00:00
|
|
|
|
|
|
|
// 获取聊天列表服务接口
|
|
|
|
export const ServeGetTalkList = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/list',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 聊天列表创建服务接口
|
|
|
|
export const ServeCreateTalkList = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/create',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 删除聊天列表服务接口
|
|
|
|
export const ServeDeleteTalkList = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/delete',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 对话列表置顶服务接口
|
|
|
|
export const ServeTopTalkList = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/topping',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 清除聊天消息未读数服务接口
|
2025-03-24 12:03:52 +00:00
|
|
|
export const ServeClearTalkUnreadNum = (data, unReadNum) => {
|
2025-03-25 05:12:06 +00:00
|
|
|
console.log('=======chatApp==UnreadNum', unReadNum)
|
2025-03-26 06:30:20 +00:00
|
|
|
if(!useTalkStore().items[useTalkStore().findTalkIndex(useDialogueStore().index_name)].is_disturb){
|
|
|
|
if (typeof plus !== 'undefined') {
|
2025-03-24 12:03:52 +00:00
|
|
|
let OAWebView = plus.webview.all()
|
2025-03-25 05:12:06 +00:00
|
|
|
OAWebView.forEach((webview) => {
|
|
|
|
if (webview.id === 'webviewId1') {
|
|
|
|
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
|
|
|
|
}
|
|
|
|
})
|
2025-03-26 06:30:20 +00:00
|
|
|
} else {
|
|
|
|
document.addEventListener('plusready', () => {
|
|
|
|
let OAWebView = plus.webview.all()
|
|
|
|
OAWebView.forEach((webview) => {
|
|
|
|
if (webview.id === 'webviewId1') {
|
|
|
|
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2025-03-24 12:03:52 +00:00
|
|
|
}
|
2024-11-20 01:17:47 +00:00
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/unread/clear',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取聊天记录服务接口
|
|
|
|
export const ServeTalkRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/records',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取转发会话记录详情列表服务接口
|
|
|
|
export const ServeGetForwardRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/records/forward',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 对话列表置顶服务接口
|
|
|
|
export const ServeSetNotDisturb = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/disturb',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查找用户聊天记录服务接口
|
|
|
|
export const ServeFindTalkRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/records/history',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 搜索用户聊天记录服务接口
|
|
|
|
export const ServeSearchTalkRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/search-chat-records',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ServeGetRecordsContext = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/get-records-context',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 发送代码块消息服务接口
|
|
|
|
export const ServePublishMessage = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/publish',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 发送聊天文件服务接口
|
|
|
|
export const ServeSendTalkFile = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/file',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 撤回消息服务接口
|
|
|
|
export const ServeRevokeRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/revoke',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// 删除消息服务接口
|
|
|
|
export const ServeRemoveRecords = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/delete',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2025-02-05 08:22:32 +00:00
|
|
|
//清空聊天记录
|
|
|
|
export const ServeEmptyMessage = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/empty',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-11-20 01:17:47 +00:00
|
|
|
// 收藏表情包服务接口
|
|
|
|
export const ServeCollectEmoticon = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/collect',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ServeSendVote = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/vote',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const ServeConfirmVoteHandle = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/message/vote/handle',
|
|
|
|
method: 'POST',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
2024-12-06 08:55:15 +00:00
|
|
|
|
2025-03-25 05:12:06 +00:00
|
|
|
export const uploadImg = (data, onProgressFn) => {
|
2024-12-06 08:55:15 +00:00
|
|
|
return request({
|
|
|
|
url: '/upload/img',
|
|
|
|
method: 'POST',
|
2025-03-25 05:12:06 +00:00
|
|
|
data: data,
|
|
|
|
baseURL: import.meta.env.VITE_EPR_BASEURL,
|
|
|
|
isFormData: true,
|
|
|
|
onUploadProgress: (progressEvent) =>
|
|
|
|
onProgressFn(progressEvent, data.get('file')),
|
2024-12-06 08:55:15 +00:00
|
|
|
})
|
|
|
|
}
|
2025-03-14 01:46:03 +00:00
|
|
|
// 根据msg_id获取消息
|
|
|
|
export const detailGetRecordsContext = (data) => {
|
|
|
|
return request({
|
|
|
|
url: '/api/v1/talk/record/detail',
|
|
|
|
method: 'GET',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|