fix
This commit is contained in:
1 parent
5f6bada66c
commit
d35598a798
1 file changed
+29
-5
@@ -1,12 +1,23 @@
|
|||||||
import { WebApi, WebApiGroupNoticeRet } from '@/core/apis/webapi';
|
import { WebApi, WebApiGroupNoticeFeed, WebApiGroupNoticeRet } from '@/core/apis/webapi';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
|
|
||||||
interface PayloadType {
|
interface PayloadType {
|
||||||
group_id: number
|
group_id: number
|
||||||
}
|
}
|
||||||
|
interface GroupNotice {
|
||||||
export class GetGroupNotice extends BaseAction<PayloadType, WebApiGroupNoticeRet> {
|
sender_id: number
|
||||||
|
publish_time: number
|
||||||
|
message: {
|
||||||
|
text: string
|
||||||
|
image: Array<{
|
||||||
|
height: string
|
||||||
|
width: string
|
||||||
|
id: string
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class GetGroupNotice extends BaseAction<PayloadType, GroupNotice[]> {
|
||||||
actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
||||||
|
|
||||||
protected async _handle(payload: PayloadType) {
|
protected async _handle(payload: PayloadType) {
|
||||||
@@ -15,6 +26,19 @@ export class GetGroupNotice extends BaseAction<PayloadType, WebApiGroupNoticeRet
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
throw new Error('获取公告失败');
|
throw new Error('获取公告失败');
|
||||||
}
|
}
|
||||||
return ret;
|
let retNotices: GroupNotice[] = new Array<GroupNotice>();
|
||||||
|
for (let key in ret.feeds) {
|
||||||
|
let retNotice: GroupNotice = {
|
||||||
|
sender_id: ret.feeds[key].u,
|
||||||
|
publish_time: ret.feeds[key].pubt,
|
||||||
|
message: {
|
||||||
|
text: ret.feeds[key].msg.text,
|
||||||
|
image: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retNotices.push(retNotice);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retNotices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user