This commit is contained in:
手瓜一十雪 2024-04-16 13:38:00 +08:00
commit b670c546b9
2 changed files with 14 additions and 9 deletions

@ -1 +1 @@
Subproject commit 0e7c9d43c4c401a2b34f4b5637d566a2ff27b7b7
Subproject commit e8dee74e8dcb1ed73dd3017d6759f14f68348173

View File

@ -3,19 +3,24 @@ import { OB11Constructor } from '../../constructor';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { groups } from '@/common/data';
import {NTQQGroupApi} from "@/core/qqnt/apis";
import { NTQQGroupApi } from '@/core/qqnt/apis';
import { Group } from '@/core/qqnt/entities';
import { log } from '@/common/utils/log';
interface Payload {
no_cache: boolean;
}
class GetGroupList extends BaseAction<null, OB11Group[]> {
class GetGroupList extends BaseAction<Payload, OB11Group[]> {
actionName = ActionName.GetGroupList;
protected async _handle(payload: null) {
if (groups.size === 0) {
//todo: get groups
// const groups = await NTQQGroupApi.getGroups(true)
// log("get groups", groups)
protected async _handle(payload: Payload) {
let groupList: Group[] = Array.from(groups.values());
if (groupList.length === 0) {
groupList = await NTQQGroupApi.getGroups(payload.no_cache === true);
// log('get groups', groups);
}
return OB11Constructor.groups(Array.from(groups.values()));
return OB11Constructor.groups(groupList);
}
}