fix: adapter api
This commit is contained in:
1 parent
d9a67de683
commit
a1b199fcde
4 files changed
+17
-8
No files matched your search
@@ -15,13 +15,16 @@ export default class GetRecentContact extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.GetRecentContact;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
async _handle(payload: Payload, adapter: string) {
|
||||
const ret = await this.core.apis.UserApi.getRecentContactListSnapShot(+(payload.count || 10));
|
||||
let network = Object.values(this.obContext.configLoader.configData.network) as Array<typeof this.obContext.configLoader.configData.network[keyof typeof this.obContext.configLoader.configData.network]>;
|
||||
//烘焙消息
|
||||
let msgFormat = network.flat().find(e => e.name === adapter)?.messagePostFormat ?? 'array';
|
||||
return await Promise.all(ret.info.changedList.map(async (t) => {
|
||||
const FastMsg = await this.core.apis.MsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]);
|
||||
if (FastMsg.msgList.length > 0) {
|
||||
//扩展ret.info.changedList
|
||||
const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0]);
|
||||
const lastestMsg = await this.obContext.apis.MsgApi.parseMessage(FastMsg.msgList[0], msgFormat);
|
||||
return {
|
||||
lastestMsg: lastestMsg,
|
||||
peerUin: t.peerUin,
|
||||
|
||||
Reference in new issue
Block a user