refactor(wechat): 优化消息接收处理和数据库结构

- 移除未使用的kfUserService导入
- 为weChatGroup和ContractData接口添加serverId字段
- 重构receivedMsg方法,根据消息类型从数据库获取会话信息
- 简化数据库表结构,移除冗余的WithServerId接口
This commit is contained in:
2025-09-05 14:53:09 +08:00
parent 66241f32af
commit e7c109eab1
5 changed files with 23 additions and 23 deletions

View File

@@ -39,16 +39,6 @@ export interface KfUserWithServerId extends Omit<KfUserListData, "id"> {
id?: number; // 接口数据的原始ID字段
}
export interface weChatGroupServerId extends Omit<weChatGroup, "id"> {
serverId: number | string; // 服务器ID作为主键
id?: number; // 接口数据的原始ID字段
}
export interface ContractWithServerId extends Omit<ContractData, "id"> {
serverId: number | string; // 服务器ID作为主键
id?: number; // 接口数据的原始ID字段
}
// 新联系人列表数据接口
export interface NewContactListData {
serverId: number | string; // 服务器ID作为主键
@@ -61,8 +51,8 @@ export interface NewContactListData {
// 数据库类
class CunkebaoDatabase extends Dexie {
kfUsers!: Table<KfUserWithServerId>;
weChatGroup!: Table<weChatGroupServerId>;
contracts!: Table<ContractWithServerId>;
weChatGroup!: Table<weChatGroup>;
contracts!: Table<ContractData>;
newContractList!: Table<NewContactListData>;
messageList!: Table<MessageListData>;
@@ -74,7 +64,7 @@ class CunkebaoDatabase extends Dexie {
kfUsers:
"serverId, id, tenantId, wechatId, nickname, alias, avatar, gender, region, signature, bindQQ, bindEmail, bindMobile, createTime, currentDeviceId, isDeleted, deleteTime, groupId, memo, wechatVersion, lastUpdateTime, isOnline",
weChatGroup:
"serverId, id, wechatAccountId, tenantId, accountId, chatroomId, chatroomOwner, conRemark, nickname, chatroomAvatar, groupId, config, unreadCount, notice, selfDisplyName",
"serverId, id, wechatAccountId, tenantId, accountId, chatroomId, chatroomOwner, conRemark, nickname, chatroomAvatar,wechatChatroomId, groupId, config, unreadCount, notice, selfDisplyName",
contracts:
"serverId, id, wechatAccountId, wechatId, alias, conRemark, nickname, quanPin, avatar, gender, region, addFrom, phone, signature, accountId, extendFields, city, lastUpdateTime, isPassed, tenantId, groupId, thirdParty, additionalPicture, desc, config, lastMessageTime, unreadCount, duplicate",
newContractList: "serverId, id, groupName, contacts",