mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Merge branch 'main' into pr/734
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,7 +4,7 @@ package-lock.json
|
|||||||
out/
|
out/
|
||||||
dist/
|
dist/
|
||||||
/src/core.lib/common/
|
/src/core.lib/common/
|
||||||
/localdebug/
|
devconfig/*
|
||||||
|
|
||||||
# Editor
|
# Editor
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
@@ -10,14 +10,21 @@ export interface NodeIKernelProfileLikeService {
|
|||||||
getBuddyProfileLike(req: BuddyProfileLikeReq): Promise<GeneralCallResult & {
|
getBuddyProfileLike(req: BuddyProfileLikeReq): Promise<GeneralCallResult & {
|
||||||
info: {
|
info: {
|
||||||
userLikeInfos: Array<{
|
userLikeInfos: Array<{
|
||||||
|
uid: string,
|
||||||
|
time: string,
|
||||||
|
favoriteInfo: {
|
||||||
|
userInfos: Array<NTVoteInfo>,//哪些人点我
|
||||||
|
total_count: number,
|
||||||
|
last_time: number,
|
||||||
|
today_count: number
|
||||||
|
},
|
||||||
voteInfo: {
|
voteInfo: {
|
||||||
total_count: number,
|
total_count: number,
|
||||||
new_count: number,
|
new_count: number,
|
||||||
new_nearby_count: number,
|
new_nearby_count: number,
|
||||||
last_visit_time: number,
|
last_visit_time: number,
|
||||||
userInfos: Array<NTVoteInfo>
|
userInfos: Array<NTVoteInfo>,//点过哪些人
|
||||||
}
|
}
|
||||||
|
|
||||||
}>,
|
}>,
|
||||||
friendMaxVotes: number,
|
friendMaxVotes: number,
|
||||||
start: number
|
start: number
|
||||||
|
@@ -5,8 +5,7 @@ import { Type, Static } from '@sinclair/typebox';
|
|||||||
const SchemaData = Type.Object({
|
const SchemaData = Type.Object({
|
||||||
user_id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
user_id: Type.Optional(Type.Union([Type.Number(), Type.String()])),
|
||||||
start: Type.Union([Type.Number(), Type.String()], { default: 0 }),
|
start: Type.Union([Type.Number(), Type.String()], { default: 0 }),
|
||||||
count: Type.Union([Type.Number(), Type.String()], { default: 10 }),
|
count: Type.Union([Type.Number(), Type.String()], { default: 10 })
|
||||||
type: Type.Union([Type.Number(), Type.String()], { default: 2 }),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
type Payload = Static<typeof SchemaData>;
|
type Payload = Static<typeof SchemaData>;
|
||||||
@@ -15,15 +14,20 @@ export class GetProfileLike extends OneBotAction<Payload, any> {
|
|||||||
actionName = ActionName.GetProfileLike;
|
actionName = ActionName.GetProfileLike;
|
||||||
payloadSchema = SchemaData;
|
payloadSchema = SchemaData;
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
const user_uid =
|
const isSelf = this.core.selfInfo.uin === payload.user_id || !payload.user_id;
|
||||||
this.core.selfInfo.uin === payload.user_id || !payload.user_id ?
|
const userUid = isSelf || !payload.user_id ? this.core.selfInfo.uid : await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
this.core.selfInfo.uid :
|
const type = isSelf ? 2 : 1;
|
||||||
await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
const ret = await this.core.apis.UserApi.getProfileLike(userUid ?? this.core.selfInfo.uid, +payload.start, +payload.count, type);
|
||||||
const ret = await this.core.apis.UserApi.getProfileLike(user_uid ?? this.core.selfInfo.uid, +payload.start, +payload.count, +payload.type);
|
const data = ret.info.userLikeInfos[0];
|
||||||
const listdata = ret.info.userLikeInfos[0].voteInfo.userInfos;
|
if (!data) {
|
||||||
for (const item of listdata) {
|
throw new Error('get info error');
|
||||||
|
}
|
||||||
|
for (const item of data.voteInfo.userInfos) {
|
||||||
item.uin = +((await this.core.apis.UserApi.getUinByUidV2(item.uid)) ?? '');
|
item.uin = +((await this.core.apis.UserApi.getUinByUidV2(item.uid)) ?? '');
|
||||||
}
|
}
|
||||||
return ret.info.userLikeInfos[0].voteInfo;
|
for (const item of data.favoriteInfo.userInfos) {
|
||||||
|
item.uin = +((await this.core.apis.UserApi.getUinByUidV2(item.uid)) ?? '');
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user