refactor(db): 移除测试相关代码并优化消息列表数据结构

移除数据库测试页面和示例代码,清理测试路由配置
新增MessageListData接口支持微信群组和联系人两种数据类型
优化数据库表结构和服务导出
This commit is contained in:
2025-09-01 10:36:16 +08:00
parent 64c75772bb
commit 52430d6466
5 changed files with 56 additions and 1147 deletions

View File

@@ -30,6 +30,7 @@ import {
KfUserListData,
weChatGroup,
ContractData,
MessageListData,
} from "@/pages/pc/ckbox/data";
// 数据类型定义使用serverId作为主键
@@ -57,17 +58,6 @@ export interface NewContactListData {
weChatGroup: weChatGroup[];
}
// 消息列表数据接口
export interface MessageListData extends Omit<ContractData, "id"> {
serverId: number | string; // 服务器ID作为主键
id?: number; // 接口数据的原始ID字段
wechatAccountId: number; // 微信账号ID
chatroomAvatar?: string; // 群头像
chatroomName?: string; // 群名称
chatroomId?: number; // 群ID
[key: string]: any;
}
// 数据库类
class CunkebaoDatabase extends Dexie {
kfUsers!: Table<KfUserWithServerId>;
@@ -88,6 +78,8 @@ class CunkebaoDatabase extends Dexie {
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",
messageList:
"serverId, id, dataType, wechatAccountId, tenantId, accountId, nickname, avatar, groupId, config, labels, unreadCount, wechatId, alias, conRemark, quanPin, gender, region, addFrom, phone, signature, extendFields, city, lastUpdateTime, isPassed, thirdParty, additionalPicture, desc, lastMessageTime, duplicate, chatroomId, chatroomOwner, chatroomAvatar, notice, selfDisplyName",
});
}
}
@@ -330,6 +322,8 @@ export class DatabaseService<T> {
export const kfUserService = new DatabaseService(db.kfUsers);
export const weChatGroupService = new DatabaseService(db.weChatGroup);
export const contractService = new DatabaseService(db.contracts);
export const newContactListService = new DatabaseService(db.newContractList);
export const messageListService = new DatabaseService(db.messageList);
// 默认导出数据库实例
export default db;