mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
build: 1.3.5-beta32
This commit is contained in:
parent
d6175acd38
commit
44974034ec
@ -2,16 +2,24 @@ import BaseAction from '../BaseAction';
|
|||||||
import { getGroupMember } from '@/core/data';
|
import { getGroupMember } from '@/core/data';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
|
||||||
group_id: number,
|
const SchemaData = {
|
||||||
user_id: number,
|
type: 'object',
|
||||||
reject_add_request: boolean
|
properties: {
|
||||||
}
|
group_id: { type: 'number' },
|
||||||
|
user_id: { type: 'number' },
|
||||||
|
reject_add_request: { type: 'boolean' }
|
||||||
|
},
|
||||||
|
required: ['group_id', 'user_id', 'reject_add_request']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export default class SetGroupKick extends BaseAction<Payload, null> {
|
export default class SetGroupKick extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SetGroupKick;
|
actionName = ActionName.SetGroupKick;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const member = await getGroupMember(payload.group_id, payload.user_id);
|
const member = await getGroupMember(payload.group_id, payload.user_id);
|
||||||
if (!member) {
|
if (!member) {
|
||||||
|
@ -2,15 +2,20 @@ import BaseAction from '../BaseAction';
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
import { log, logError } from '@/common/utils/log';
|
import { log, logError } from '@/common/utils/log';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
group_id: { type: 'number' },
|
||||||
|
is_dismiss: { type: 'boolean' }
|
||||||
|
},
|
||||||
|
required: ['group_id', 'is_dismiss']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
interface Payload {
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
group_id: number,
|
|
||||||
is_dismiss: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class SetGroupLeave extends BaseAction<Payload, any> {
|
export default class SetGroupLeave extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.SetGroupLeave;
|
actionName = ActionName.SetGroupLeave;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<any> {
|
protected async _handle(payload: Payload): Promise<any> {
|
||||||
try {
|
try {
|
||||||
await NTQQGroupApi.quitGroup(payload.group_id.toString());
|
await NTQQGroupApi.quitGroup(payload.group_id.toString());
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
group_id: number,
|
type: 'object',
|
||||||
group_name: string
|
properties: {
|
||||||
}
|
group_id: { type: 'number' },
|
||||||
|
group_name: { type: 'string' }
|
||||||
|
},
|
||||||
|
required: ['group_id', 'group_name']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
export default class SetGroupName extends BaseAction<Payload, null> {
|
export default class SetGroupName extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SetGroupName;
|
actionName = ActionName.SetGroupName;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
|
|
||||||
await NTQQGroupApi.setGroupName(payload.group_id.toString(), payload.group_name);
|
await NTQQGroupApi.setGroupName(payload.group_id.toString(), payload.group_name);
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQGroupApi } from '@/core/apis/group';
|
import { NTQQGroupApi } from '@/core/apis/group';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
group_id: number,
|
type: 'object',
|
||||||
enable: boolean
|
properties: {
|
||||||
}
|
group_id: { type: 'number' },
|
||||||
|
enable: { type: 'boolean' }
|
||||||
|
},
|
||||||
|
required: ['group_id', 'enable']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export default class SetGroupWholeBan extends BaseAction<Payload, null> {
|
export default class SetGroupWholeBan extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SetGroupWholeBan;
|
actionName = ActionName.SetGroupWholeBan;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const enable = payload.enable.toString() === 'true';
|
const enable = payload.enable.toString() === 'true';
|
||||||
await NTQQGroupApi.banGroup(payload.group_id.toString(), enable);
|
await NTQQGroupApi.banGroup(payload.group_id.toString(), enable);
|
||||||
|
@ -2,15 +2,21 @@ import { NTQQMsgApi } from '@/core/apis';
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { dbUtil } from '@/core/utils/db';
|
import { dbUtil } from '@/core/utils/db';
|
||||||
import { napCatCore } from '@/core';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
message_id: number
|
type: 'object',
|
||||||
}
|
properties: {
|
||||||
|
message_id: { type: 'number' },
|
||||||
|
},
|
||||||
|
required: ['message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
class DeleteMsg extends BaseAction<Payload, void> {
|
class DeleteMsg extends BaseAction<Payload, void> {
|
||||||
actionName = ActionName.DeleteMsg;
|
actionName = ActionName.DeleteMsg;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
||||||
if (msg) {
|
if (msg) {
|
||||||
|
@ -4,12 +4,19 @@ import { ChatType, Peer } from '@/core/entities';
|
|||||||
import { dbUtil } from '@/core/utils/db';
|
import { dbUtil } from '@/core/utils/db';
|
||||||
import { getUidByUin } from '@/core/data';
|
import { getUidByUin } from '@/core/data';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
message_id: number
|
type: 'object',
|
||||||
group_id: number
|
properties: {
|
||||||
user_id?: number
|
message_id: { type: 'number' },
|
||||||
}
|
group_id: { type: 'number' },
|
||||||
|
user_id: { type: 'number' }
|
||||||
|
},
|
||||||
|
required: ['message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
class ForwardSingleMsg extends BaseAction<Payload, null> {
|
class ForwardSingleMsg extends BaseAction<Payload, null> {
|
||||||
protected async getTargetPeer(payload: Payload): Promise<Peer> {
|
protected async getTargetPeer(payload: Payload): Promise<Peer> {
|
||||||
@ -20,7 +27,7 @@ class ForwardSingleMsg extends BaseAction<Payload, null> {
|
|||||||
}
|
}
|
||||||
return { chatType: ChatType.friend, peerUid };
|
return { chatType: ChatType.friend, peerUid };
|
||||||
}
|
}
|
||||||
return { chatType: ChatType.group, peerUid: payload.group_id.toString() };
|
return { chatType: ChatType.group, peerUid: payload.group_id!.toString() };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
@ -45,9 +52,11 @@ class ForwardSingleMsg extends BaseAction<Payload, null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ForwardFriendSingleMsg extends ForwardSingleMsg {
|
export class ForwardFriendSingleMsg extends ForwardSingleMsg {
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
actionName = ActionName.ForwardFriendSingleMsg;
|
actionName = ActionName.ForwardFriendSingleMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ForwardGroupSingleMsg extends ForwardSingleMsg {
|
export class ForwardGroupSingleMsg extends ForwardSingleMsg {
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
actionName = ActionName.ForwardGroupSingleMsg;
|
actionName = ActionName.ForwardGroupSingleMsg;
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,25 @@ import { OB11Constructor } from '../../constructor';
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { dbUtil } from '@/core/utils/db';
|
import { dbUtil } from '@/core/utils/db';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
|
|
||||||
export interface PayloadType {
|
|
||||||
message_id: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ReturnDataType = OB11Message
|
export type ReturnDataType = OB11Message
|
||||||
|
|
||||||
class GetMsg extends BaseAction<PayloadType, OB11Message> {
|
const SchemaData = {
|
||||||
actionName = ActionName.GetMsg;
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
message_id: { type: 'number' },
|
||||||
|
},
|
||||||
|
required: ['message_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
protected async _handle(payload: PayloadType) {
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
|
class GetMsg extends BaseAction<Payload, OB11Message> {
|
||||||
|
actionName = ActionName.GetMsg;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
|
protected async _handle(payload: Payload) {
|
||||||
// log("history msg ids", Object.keys(msgHistory));
|
// log("history msg ids", Object.keys(msgHistory));
|
||||||
if (!payload.message_id) {
|
if (!payload.message_id) {
|
||||||
throw Error('参数message_id不能为空');
|
throw Error('参数message_id不能为空');
|
||||||
|
@ -3,15 +3,20 @@ import BaseAction from '../BaseAction';
|
|||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQMsgApi } from '@/core/apis';
|
import { NTQQMsgApi } from '@/core/apis';
|
||||||
import { getFriend, getUidByUin } from '@/core/data';
|
import { getFriend, getUidByUin } from '@/core/data';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
user_id: number;
|
type: 'object',
|
||||||
group_id?: number;
|
properties: {
|
||||||
|
user_id: { type: 'number' },
|
||||||
|
group_id: { type: 'number' }
|
||||||
}
|
}
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
class MarkMsgAsRead extends BaseAction<Payload, null> {
|
type PlayloadType = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
async getPeer(payload: Payload): Promise<Peer> {
|
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
||||||
|
async getPeer(payload: PlayloadType): Promise<Peer> {
|
||||||
if (payload.user_id) {
|
if (payload.user_id) {
|
||||||
const peerUid = getUidByUin(payload.user_id.toString());
|
const peerUid = getUidByUin(payload.user_id.toString());
|
||||||
if (!peerUid) {
|
if (!peerUid) {
|
||||||
@ -25,7 +30,7 @@ class MarkMsgAsRead extends BaseAction<Payload, null> {
|
|||||||
}
|
}
|
||||||
return { chatType: ChatType.group, peerUid: payload.group_id.toString() };
|
return { chatType: ChatType.group, peerUid: payload.group_id.toString() };
|
||||||
}
|
}
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: PlayloadType): Promise<null> {
|
||||||
// 调用API
|
// 调用API
|
||||||
const ret = await NTQQMsgApi.setMsgRead(await this.getPeer(payload));
|
const ret = await NTQQMsgApi.setMsgRead(await this.getPeer(payload));
|
||||||
if (ret.result != 0) {
|
if (ret.result != 0) {
|
||||||
@ -36,9 +41,11 @@ class MarkMsgAsRead extends BaseAction<Payload, null> {
|
|||||||
}
|
}
|
||||||
// 以下为非标准实现
|
// 以下为非标准实现
|
||||||
export class MarkPrivateMsgAsRead extends MarkMsgAsRead {
|
export class MarkPrivateMsgAsRead extends MarkMsgAsRead {
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
actionName = ActionName.MarkPrivateMsgAsRead;
|
actionName = ActionName.MarkPrivateMsgAsRead;
|
||||||
}
|
}
|
||||||
export class MarkGroupMsgAsRead extends MarkMsgAsRead {
|
export class MarkGroupMsgAsRead extends MarkMsgAsRead {
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
actionName = ActionName.MarkGroupMsgAsRead;
|
actionName = ActionName.MarkGroupMsgAsRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import SendMsg from './SendMsg';
|
import SendMsg from './SendMsg';
|
||||||
import { ActionName, BaseCheckResult } from '../types';
|
import { ActionName, BaseCheckResult } from '../types';
|
||||||
import { OB11PostSendMsg } from '../../types';
|
import { OB11PostSendMsg } from '../../types';
|
||||||
|
// 未检测参数
|
||||||
class SendPrivateMsg extends SendMsg {
|
class SendPrivateMsg extends SendMsg {
|
||||||
actionName = ActionName.SendPrivateMsg;
|
actionName = ActionName.SendPrivateMsg;
|
||||||
|
|
||||||
|
@ -2,15 +2,22 @@ import { ActionName } from '../types';
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { dbUtil } from '@/core/utils/db';
|
import { dbUtil } from '@/core/utils/db';
|
||||||
import { NTQQMsgApi } from '@/core/apis';
|
import { NTQQMsgApi } from '@/core/apis';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
message_id: number,
|
type: 'object',
|
||||||
emoji_id: string
|
properties: {
|
||||||
}
|
message_id: { type: 'number' },
|
||||||
|
emoji_id: { type: 'string' }
|
||||||
|
},
|
||||||
|
required: ['message_id', 'emoji_id']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
||||||
actionName = ActionName.SetMsgEmojiLike;
|
actionName = ActionName.SetMsgEmojiLike;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
|
@ -2,10 +2,17 @@ import { rebootWithNormolLogin, rebootWithQuickLogin } from '@/common/utils/rebo
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { selfInfo } from '@/core/data';
|
import { selfInfo } from '@/core/data';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
delay: number
|
type: 'object',
|
||||||
}
|
properties: {
|
||||||
|
delay: { type: 'number' }
|
||||||
|
},
|
||||||
|
required: ['delay']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export class Reboot extends BaseAction<Payload, null> {
|
export class Reboot extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.Reboot;
|
actionName = ActionName.Reboot;
|
||||||
|
@ -4,15 +4,23 @@ import { friends, selfInfo } from '@/core/data';
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQUserApi } from '@/core/apis';
|
import { NTQQUserApi } from '@/core/apis';
|
||||||
interface Payload {
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
domain: string
|
|
||||||
}
|
|
||||||
interface Response {
|
interface Response {
|
||||||
cookies: string
|
cookies: string
|
||||||
}
|
}
|
||||||
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
domain: { type: 'string' }
|
||||||
|
},
|
||||||
|
required: ['domain']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export class GetCookies extends BaseAction<Payload, Response> {
|
export class GetCookies extends BaseAction<Payload, Response> {
|
||||||
actionName = ActionName.GetCookies;
|
actionName = ActionName.GetCookies;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
if (!payload.domain){
|
if (!payload.domain){
|
||||||
throw new Error('缺少参数 domain');
|
throw new Error('缺少参数 domain');
|
||||||
|
@ -4,17 +4,23 @@ import { friends } from '@/core/data';
|
|||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQFriendApi } from '@/core';
|
import { NTQQFriendApi } from '@/core';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
|
|
||||||
interface Payload{
|
// no_cache get时传字符串
|
||||||
no_cache: boolean | string
|
const SchemaData = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
no_cache: { type: 'boolean' },
|
||||||
}
|
}
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
export default class GetFriendList extends BaseAction<Payload, OB11User[]> {
|
||||||
actionName = ActionName.GetFriendList;
|
actionName = ActionName.GetFriendList;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
if (friends.size === 0 || payload?.no_cache === true || payload?.no_cache === 'true') {
|
if (friends.size === 0 || payload?.no_cache === true /*|| payload?.no_cache === 'true'*/) {
|
||||||
const _friends = await NTQQFriendApi.getFriends(true);
|
const _friends = await NTQQFriendApi.getFriends(true);
|
||||||
// log('强制刷新好友列表,结果: ', _friends)
|
// log('强制刷新好友列表,结果: ', _friends)
|
||||||
if (_friends.length > 0) {
|
if (_friends.length > 0) {
|
||||||
|
@ -3,15 +3,22 @@ import BaseAction from '../BaseAction';
|
|||||||
import { getFriend, getUidByUin, uid2UinMap } from '@/core/data';
|
import { getFriend, getUidByUin, uid2UinMap } from '@/core/data';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { log, logDebug } from '@/common/utils/log';
|
import { log, logDebug } from '@/common/utils/log';
|
||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
user_id: number,
|
type: 'object',
|
||||||
times: number
|
properties: {
|
||||||
}
|
user_id: { type: 'number' },
|
||||||
|
times: { type: 'number' }
|
||||||
|
},
|
||||||
|
required: ['user_id', 'times']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export default class SendLike extends BaseAction<Payload, null> {
|
export default class SendLike extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SendLike;
|
actionName = ActionName.SendLike;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
logDebug('点赞参数', payload);
|
logDebug('点赞参数', payload);
|
||||||
try {
|
try {
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { NTQQFriendApi } from '@/core/apis/friend';
|
import { NTQQFriendApi } from '@/core/apis/friend';
|
||||||
import { friendRequests } from '@/core/data';
|
import { friendRequests } from '@/core/data';
|
||||||
|
|
||||||
interface Payload {
|
const SchemaData = {
|
||||||
flag: string,
|
type: 'object',
|
||||||
approve: boolean,
|
properties: {
|
||||||
remark?: string,
|
flag: { type: 'string' },
|
||||||
}
|
approve: { type: 'boolean' },
|
||||||
|
remark: { type: 'string' }
|
||||||
|
},
|
||||||
|
required: ['flag','approve']
|
||||||
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
export default class SetFriendAddRequest extends BaseAction<Payload, null> {
|
||||||
actionName = ActionName.SetFriendAddRequest;
|
actionName = ActionName.SetFriendAddRequest;
|
||||||
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload): Promise<null> {
|
protected async _handle(payload: Payload): Promise<null> {
|
||||||
const approve = payload.approve.toString() === 'true';
|
const approve = payload.approve.toString() === 'true';
|
||||||
const request = friendRequests[payload.flag];
|
const request = friendRequests[payload.flag];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user