mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
Merge branch 'main' of https://github.com/NapNeko/NapCatQQ
This commit is contained in:
commit
b670c546b9
2
src/core
2
src/core
@ -1 +1 @@
|
||||
Subproject commit 0e7c9d43c4c401a2b34f4b5637d566a2ff27b7b7
|
||||
Subproject commit e8dee74e8dcb1ed73dd3017d6759f14f68348173
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user