build: 1.3.5-beta32

This commit is contained in:
手瓜一十雪
2024-05-18 12:56:03 +08:00
parent b5fba09f0d
commit 3e8d8817bb
15 changed files with 176 additions and 79 deletions

View File

@@ -4,15 +4,23 @@ import { friends, selfInfo } from '@/core/data';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { NTQQUserApi } from '@/core/apis';
interface Payload {
domain: string
}
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
interface Response {
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> {
actionName = ActionName.GetCookies;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload) {
if (!payload.domain){
throw new Error('缺少参数 domain');

View File

@@ -4,17 +4,23 @@ import { friends } from '@/core/data';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { NTQQFriendApi } from '@/core';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
interface Payload{
no_cache: boolean | string
}
// no_cache get时传字符串
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[]> {
actionName = ActionName.GetFriendList;
PayloadSchema = SchemaData;
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);
// log('强制刷新好友列表,结果: ', _friends)
if (_friends.length > 0) {

View File

@@ -3,15 +3,22 @@ import BaseAction from '../BaseAction';
import { getFriend, getUidByUin, uid2UinMap } from '@/core/data';
import { ActionName } from '../types';
import { log, logDebug } from '@/common/utils/log';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
interface Payload {
user_id: number,
times: number
}
const SchemaData = {
type: 'object',
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> {
actionName = ActionName.SendLike;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
logDebug('点赞参数', payload);
try {

View File

@@ -1,17 +1,24 @@
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { NTQQFriendApi } from '@/core/apis/friend';
import { friendRequests } from '@/core/data';
interface Payload {
flag: string,
approve: boolean,
remark?: string,
}
const SchemaData = {
type: 'object',
properties: {
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> {
actionName = ActionName.SetFriendAddRequest;
PayloadSchema = SchemaData;
protected async _handle(payload: Payload): Promise<null> {
const approve = payload.approve.toString() === 'true';
const request = friendRequests[payload.flag];