Files
cunkebao_v3/Cunkebao/src/pages/pc/ckbox/data.ts
超级老白兔 bc7cc6810d feat(db): 添加Dexie数据库支持并重构数据存储结构
添加Dexie作为IndexedDB封装库,实现本地数据存储功能
重构数据接口定义和存储模块结构,优化类型定义
统一数据接口文件位置,增强代码可维护性
2025-08-29 15:13:31 +08:00

251 lines
4.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//终端用户数据接口
export interface KfUserListData {
id: number;
tenantId: number;
wechatId: string;
nickname: string;
alias: string;
avatar: string;
gender: number;
region: string;
signature: string;
bindQQ: string;
bindEmail: string;
bindMobile: string;
createTime: string;
currentDeviceId: number;
isDeleted: boolean;
deleteTime: string;
groupId: number;
memo: string;
wechatVersion: string;
labels: string[];
lastUpdateTime: string;
isOnline?: boolean;
[key: string]: any;
}
// 账户信息接口
export interface CkAccount {
id: number;
realName: string;
nickname: string | null;
memo: string | null;
avatar: string;
userName: string;
secret: string;
accountType: number;
departmentId: number;
useGoogleSecretKey: boolean;
hasVerifyGoogleSecret: boolean;
}
//群聊数据接口
export interface GroupData {
id?: number;
wechatAccountId: number;
tenantId: number;
accountId: number;
chatroomId: string;
chatroomOwner: string;
conRemark: string;
nickname: string;
chatroomAvatar: string;
groupId: number;
config?: {
chat: boolean;
};
unreadCount: number;
notice: string;
selfDisplyName: string;
[key: string]: any;
}
// 联系人数据接口
export interface ContractData {
id?: number;
wechatAccountId: number;
wechatId: string;
alias: string;
conRemark: string;
nickname: string;
quanPin: string;
avatar?: string;
gender: number;
region: string;
addFrom: number;
phone: string;
labels: string[];
signature: string;
accountId: number;
extendFields: null;
city?: string;
lastUpdateTime: string;
isPassed: boolean;
tenantId: number;
groupId: number;
thirdParty: null;
additionalPicture: string;
desc: string;
config?: {
chat: boolean;
};
lastMessageTime: number;
unreadCount: number;
duplicate: boolean;
[key: string]: any;
}
//聊天记录接口
export interface ChatRecord {
id: number;
wechatFriendId: number;
wechatAccountId: number;
tenantId: number;
accountId: number;
synergyAccountId: number;
content: string;
msgType: number;
msgSubType: number;
msgSvrId: string;
isSend: boolean;
createTime: string;
isDeleted: boolean;
deleteTime: string;
sendStatus: number;
wechatTime: number;
origin: number;
msgId: number;
recalled: boolean;
[key: string]: any;
}
/**
* 微信好友基本信息接口
* 包含主要字段和兼容性字段
*/
export interface WechatFriend {
// 主要字段
id: number; // 好友ID
wechatAccountId: number; // 微信账号ID
wechatId: string; // 微信ID
nickname: string; // 昵称
conRemark: string; // 备注名
avatar: string; // 头像URL
gender: number; // 性别1-男2-女0-未知
region: string; // 地区
phone: string; // 电话
labels: string[]; // 标签列表
[key: string]: any;
}
// 消息类型枚举
export enum MessageType {
TEXT = "text",
IMAGE = "image",
VOICE = "voice",
VIDEO = "video",
FILE = "file",
LOCATION = "location",
}
// 消息数据接口
export interface MessageData {
id: string;
senderId: string;
senderName: string;
content: string;
type: MessageType;
timestamp: string;
isRead: boolean;
replyTo?: string;
forwardFrom?: string;
}
// 聊天会话类型
export type ChatType = "private" | "group";
// 聊天会话接口
export interface ChatSession {
id: string;
type: ChatType;
name: string;
avatar?: string;
lastMessage: string;
lastTime: string;
unreadCount: number;
online: boolean;
members?: string[];
pinned?: boolean;
muted?: boolean;
}
// 聊天历史响应接口
export interface ChatHistoryResponse {
messages: MessageData[];
hasMore: boolean;
total: number;
}
// 发送消息请求接口
export interface SendMessageRequest {
chatId: string;
content: string;
type: MessageType;
replyTo?: string;
}
// 搜索联系人请求接口
export interface SearchContactRequest {
keyword: string;
limit?: number;
}
// 在线状态接口
export interface OnlineStatus {
userId: string;
online: boolean;
lastSeen: string;
}
// 消息状态接口
export interface MessageStatus {
messageId: string;
status: "sending" | "sent" | "delivered" | "read" | "failed";
timestamp: string;
}
// 文件上传响应接口
export interface FileUploadResponse {
url: string;
filename: string;
size: number;
type: string;
}
// 表情包接口
export interface EmojiData {
id: string;
name: string;
url: string;
category: string;
}
// 快捷回复接口
export interface QuickReply {
id: string;
content: string;
category: string;
useCount: number;
}
// 聊天设置接口
export interface ChatSettings {
autoReply: boolean;
autoReplyMessage: string;
notification: boolean;
sound: boolean;
theme: "light" | "dark";
fontSize: "small" | "medium" | "large";
}