From 09be7131c3f49f2f46e4bdb89210e14a9fd7dc93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 7 Sep 2024 23:07:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=95=B4=E7=90=86Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/entities/msg.ts | 27 +++- src/core/entities/user.ts | 12 ++ src/core/services/NodeIKernelMsgService.ts | 116 ++---------------- .../services/NodeIKernelNodeMiscService.ts | 4 - .../services/NodeIKernelProfileService.ts | 45 +------ 5 files changed, 53 insertions(+), 151 deletions(-) diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index 9e62e3fa..0f05abca 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -1,4 +1,4 @@ -import { GroupMemberRole } from '@/core'; +import { GroupMemberRole, Peer } from '@/core'; export interface Peer { chatType: ChatType; @@ -934,3 +934,28 @@ export interface RawMessage { elements: MessageElement[]; } +export interface QueryMsgsParams { + chatInfo: Peer; + filterMsgType: []; + filterSendersUid: string[]; + filterMsgFromTime: string; + filterMsgToTime: string; + pageLimit: number; + isReverseOrder: boolean; + isIncludeCurrent: boolean; +} + +export interface TmpChatInfoApi { + errMsg: string; + result: number; + tmpChatInfo?: TmpChatInfo; +} + +export interface TmpChatInfo { + chatType: number; + fromNick: string; + groupCode: string; + peerUid: string; + sessionType: number; + sig: string; +} diff --git a/src/core/entities/user.ts b/src/core/entities/user.ts index 3eb5a966..70197a49 100644 --- a/src/core/entities/user.ts +++ b/src/core/entities/user.ts @@ -364,3 +364,15 @@ export interface UserDetailInfoByUin { vipNameColorId: string } } +export enum UserDetailSource { + KDB, + KSERVER +} + +export enum ProfileBizType { + KALL, + KBASEEXTEND, + KVAS, + KQZONE, + KOTHER +} diff --git a/src/core/services/NodeIKernelMsgService.ts b/src/core/services/NodeIKernelMsgService.ts index 8992f191..a0498f62 100644 --- a/src/core/services/NodeIKernelMsgService.ts +++ b/src/core/services/NodeIKernelMsgService.ts @@ -1,32 +1,7 @@ import { ElementType, MessageElement, Peer, RawMessage, SendMessageElement } from '@/core/entities'; import { NodeIKernelMsgListener } from '@/core/listeners/NodeIKernelMsgListener'; import { GeneralCallResult } from '@/core/services/common'; - -export interface QueryMsgsParams { - chatInfo: Peer, - filterMsgType: [], - filterSendersUid: string[], - filterMsgFromTime: string, - filterMsgToTime: string, - pageLimit: number, - isReverseOrder: boolean, - isIncludeCurrent: boolean -} - -export interface TmpChatInfoApi { - errMsg: string; - result: number; - tmpChatInfo?: TmpChatInfo; -} - -export interface TmpChatInfo { - chatType: number; - fromNick: string; - groupCode: string; - peerUid: string; - sessionType: number; - sig: string; -} +import { QueryMsgsParams, TmpChatInfoApi } from '../entities/msg'; export interface NodeIKernelMsgService { @@ -76,18 +51,12 @@ export interface NodeIKernelMsgService { downloadOnlineStatusCommonByUrl(arg0: string, arg1: string): unknown; - // this.tokenType = i2; - // this.apnsToken = bArr; - // this.voipToken = bArr2; - // this.profileId = str; - setToken(arg: unknown): unknown; switchForeGround(): unknown; switchBackGround(arg: unknown): unknown; - //hex setTokenForMqq(token: string): unknown; switchForeGroundForMqq(...args: unknown[]): unknown; @@ -124,7 +93,6 @@ export interface NodeIKernelMsgService { forwardFile(...args: unknown[]): unknown; - //Array, Peer from, Peer to multiForwardMsg(...args: unknown[]): unknown; multiForwardMsgWithComment(...args: unknown[]): unknown; @@ -185,11 +153,6 @@ export interface NodeIKernelMsgService { msgList: RawMessage[] }>; - // this.$peer = contact; - // this.$msgTime = j2; - // this.$clientSeq = j3; - // this.$cnt = i2; - getMsgsWithMsgTimeAndClientSeqForC2C(...args: unknown[]): Promise; getMsgsWithStatus(params: { @@ -226,7 +189,6 @@ export interface NodeIKernelMsgService { getSourceOfReplyMsgByClientSeqAndTime(peer: Peer, clientSeq: string, time: string): unknown; - //cnt clientSeq?并不是吧 getMsgsByTypeFilter(peer: Peer, msgId: string, cnt: unknown, queryOrder: boolean, typeFilter: { type: number, subtype: Array @@ -241,49 +203,15 @@ export interface NodeIKernelMsgService { queryMsgsWithFilter(...args: unknown[]): unknown; - /** - * @deprecated 该函数已被标记为废弃,请使用新的替代方法。 - * 使用过滤条件查询消息列表的版本2接口。 - * - * 该函数通过一系列过滤条件来查询特定聊天中的消息列表。这些条件包括消息类型、发送者、时间范围等。 - * 函数返回一个Promise,解析为查询结果的未知类型对象。 - * - * @param MsgId 消息ID,用于特定消息的查询。 - * @param MsgTime 消息时间,用于指定消息的时间范围。 - * @param param 查询参数对象,包含详细的过滤条件和分页信息。 - * @param param.chatInfo 聊天信息,包括聊天类型和对方用户ID。 - * @param param.filterMsgType 需要过滤的消息类型数组,留空表示不过滤。 - * @param param.filterSendersUid 需要过滤的发送者用户ID数组。 - * @param param.filterMsgFromTime 查询消息的起始时间。 - * @param param.filterMsgToTime 查询消息的结束时间。 - * @param param.pageLimit 每页的消息数量限制。 - * @param param.isReverseOrder 是否按时间顺序倒序返回消息。 - * @param param.isIncludeCurrent 是否包含当前页码。 - * @returns 返回一个Promise,解析为查询结果的未知类型对象。 - */ - queryMsgsWithFilterVer2(MsgId: string, MsgTime: string, param: QueryMsgsParams): Promise; + //queryMsgsWithFilterVer2(MsgId: string, MsgTime: string, param: QueryMsgsParams): Promise; - // this.chatType = i2; - // this.peerUid = str; - - // this.chatInfo = new ChatInfo(); - // this.filterMsgType = new ArrayList<>(); - // this.filterSendersUid = new ArrayList<>(); - // this.chatInfo = chatInfo; - // this.filterMsgType = arrayList; - // this.filterSendersUid = arrayList2; - // this.filterMsgFromTime = j2; - // this.filterMsgToTime = j3; - // this.pageLimit = i2; - // this.isReverseOrder = z; - // this.isIncludeCurrent = z2; - //queryMsgsWithFilterEx(0L, 0L, 0L, new QueryMsgsParams(new ChatInfo(2, str), new ArrayList(), new ArrayList(), 0L, 0L, 250, false, true)) queryMsgsWithFilterEx(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): Promise; - //queryMsgsWithFilterEx(this.$msgId, this.$msgTime, this.$msgSeq, this.$param) - queryFileMsgsDesktop(...args: unknown[]): unknown; + queryFileMsgsDesktop(msgId: string, msgTime: string, msgSeq: string, param: QueryMsgsParams): Promise; setMsgRichInfoFlag(...args: unknown[]): unknown; @@ -390,17 +318,11 @@ export interface NodeIKernelMsgService { getFileThumbSavePath(...args: unknown[]): unknown; - //猜测居多 - translatePtt2Text(MsgId: string, Peer: Peer, MsgElement: unknown): unknown; + translatePtt2Text(msgId: string, peer: Peer, msgElement: unknown): unknown; setPttPlayedState(...args: unknown[]): unknown; - // NodeIQQNTWrapperSession fetchFavEmojiList [ - // "", - // 48, - // true, - // true - // ] + //uk1 uk2 true fetchFavEmojiList(str: string, num: number, uk1: boolean, uk2: boolean): Promise; getFirstUnreadCommonMsg(...args: unknown[]): unknown; @@ -590,7 +512,7 @@ export interface NodeIKernelMsgService { getFirstUnreadAtMsg(peer: Peer): unknown; - clearMsgRecords(...args: unknown[]): unknown;//设置已读后调用我觉得比较好 清理记录 现在别了 + clearMsgRecords(...args: unknown[]): unknown; IsExistOldDb(...args: unknown[]): unknown; @@ -626,25 +548,10 @@ export interface NodeIKernelMsgService { enterOrExitAio(...args: unknown[]): unknown; - // this.peerUid = ""; - // this.peerNickname = ""; - // this.fromGroupCode = ""; - // this.sig = new byte[0]; - // this.selfUid = ""; - // this.selfPhone = ""; - // this.chatType = i2; - // this.peerUid = str; - // this.peerNickname = str2; - // this.fromGroupCode = str3; - // this.sig = bArr; - // this.selfUid = str4; - // this.selfPhone = str5; - // this.gameSession = tempChatGameSession; - prepareTempChat(args: unknown): unknown;//主动临时消息 不做 + prepareTempChat(args: unknown): unknown; sendSsoCmdReqByContend(cmd: string, param: string): Promise; - //chattype,uid->Promise getTempChatInfo(ChatType: number, Uid: string): Promise; setContactLocalTop(...args: unknown[]): unknown; @@ -708,7 +615,6 @@ export interface NodeIKernelMsgService { dataMigrationStopOperation(...args: unknown[]): unknown; - //新的希望 dataMigrationImportMsgPbRecord(DataMigrationMsgInfo: Array<{ extensionData: string//"Hex" extraData: string //"" @@ -760,6 +666,6 @@ export interface NodeIKernelMsgService { getGuildMsgAbFlag(...args: unknown[]): unknown; - getGroupMsgStorageTime(): unknown;//这是嘛啊 + getGroupMsgStorageTime(): unknown; } diff --git a/src/core/services/NodeIKernelNodeMiscService.ts b/src/core/services/NodeIKernelNodeMiscService.ts index 9e07cf78..21b75d06 100644 --- a/src/core/services/NodeIKernelNodeMiscService.ts +++ b/src/core/services/NodeIKernelNodeMiscService.ts @@ -1,6 +1,5 @@ import { GeneralCallResult } from './common'; -//没扒干净 因为用不着 export interface NodeIKernelNodeMiscService { getMiniAppPath(): unknown; @@ -11,7 +10,4 @@ export interface NodeIKernelNodeMiscService { SendMiniAppMsg(arg1: string, arg2: string, arg3: string): unknown; startNewMiniApp(appfile: string, params: string): unknown; - - // 我的计划是转发给一个新程序避免吃掉Electron_AS_Node的环境 然后重写启动MiniApp 挂载相应JS脚本 这样有个问题 - // 需要自己转发ipc参数 然后必须处在gui环境 且完成校验破解 才能实现发包 有点抽象了 } diff --git a/src/core/services/NodeIKernelProfileService.ts b/src/core/services/NodeIKernelProfileService.ts index 9987aa7e..c16ad740 100644 --- a/src/core/services/NodeIKernelProfileService.ts +++ b/src/core/services/NodeIKernelProfileService.ts @@ -2,34 +2,12 @@ import { AnyCnameRecord } from 'node:dns'; import { BizKey, ModifyProfileParams, NodeIKernelProfileListener, SimpleInfo, UserDetailInfoByUinV2 } from '@/core'; import { GeneralCallResult } from '@/core/services/common'; -export enum UserDetailSource { - KDB, - KSERVER -} - -export enum ProfileBizType { - KALL, - KBASEEXTEND, - KVAS, - KQZONE, - KOTHER -} - export interface NodeIKernelProfileService { - getUidByUin(callfrom: string, uin: Array): Promise>;//uin->uid + getUidByUin(callfrom: string, uin: Array): Promise>; getUinByUid(callfrom: string, uid: Array): Promise>; - // { - // coreInfo: CoreInfo, - // baseInfo: BaseInfo, - // status: null, - // vasInfo: null, - // relationFlags: null, - // otherFlags: null, - // intimate: null - // } getCoreAndBaseInfo(callfrom: string, uids: string[]): Promise>; fetchUserDetailInfo(trace: string, uids: string[], arg2: number, arg3: number[]): Promise; @@ -50,24 +28,11 @@ export interface NodeIKernelProfileService { enumAreaOptions(...args: unknown[]): unknown; - //SimpleInfo - // this.uid = ""; - // this.uid = str; - // this.uin = j2; - // this.isBuddy = z; - // this.coreInfo = coreInfo; - // this.baseInfo = baseInfo; - // this.status = statusInfo; - // this.vasInfo = vasInfo; - // this.relationFlags = relationFlag; - // this.otherFlags = otherFlag; - // this.intimate = intimate; - modifySelfProfile(...args: unknown[]): Promise; modifyDesktopMiniProfile(param: ModifyProfileParams): Promise; - setNickName(NickName: string): Promise; + setNickName(nickName: string): Promise; setLongNick(longNick: string): Promise; @@ -95,14 +60,12 @@ export interface NodeIKernelProfileService { getSelfStatus(): Promise; - // setdisableEmojiShortCuts(...args: unknown[]): unknown; getProfileQzonePicInfo(uid: string, type: number, force: boolean): Promise; - //profileService.getCoreInfo("UserRemarkServiceImpl::getStrangerRemarkByUid", arrayList); - getCoreInfo(name: string, arg: any[]): unknown; + // UserRemarkServiceImpl::getStrangerRemarkByUid [] + getCoreInfo(sceneId: string, arg: any[]): unknown; - //m429253e12.getOtherFlag("FriendListInfoCache_getKernelDataAndPutCache", new ArrayList<>()); isNull(): boolean; }