一些参数命名的修改

This commit is contained in:
CrescentLeaf
2025-12-28 00:22:27 +08:00
parent d4d28c2760
commit d944401691
2 changed files with 7 additions and 7 deletions

View File

@@ -125,7 +125,7 @@ export default class UserMySelf extends User {
async addFavouriteChatsOrThrow(chat_ids: string[]) { async addFavouriteChatsOrThrow(chat_ids: string[]) {
const re = await this.client.invoke("User.addFavouriteChats", { const re = await this.client.invoke("User.addFavouriteChats", {
token: this.client.access_token, token: this.client.access_token,
targets: chat_ids, chat_ids,
}) })
if (re.code != 200) throw new CallbackError(re) if (re.code != 200) throw new CallbackError(re)
} }
@@ -140,7 +140,7 @@ export default class UserMySelf extends User {
async removeFavouriteChatsOrThrow(chat_ids: string[]) { async removeFavouriteChatsOrThrow(chat_ids: string[]) {
const re = await this.client.invoke("User.removeFavouriteChats", { const re = await this.client.invoke("User.removeFavouriteChats", {
token: this.client.access_token, token: this.client.access_token,
targets: chat_ids, chat_ids,
}) })
if (re.code != 200) throw new CallbackError(re) if (re.code != 200) throw new CallbackError(re)
} }
@@ -156,7 +156,7 @@ export default class UserMySelf extends User {
token: this.client.access_token token: this.client.access_token
}) })
if (re.code == 200) if (re.code == 200)
return (re.data!.favourite_chats || re.data!.contacts_list) as ChatBean[] return (re.data!.favourite_chats) as ChatBean[]
throw new CallbackError(re) throw new CallbackError(re)
} }
async getMyFavouriteChats() { async getMyFavouriteChats() {

View File

@@ -371,7 +371,7 @@ export default class UserApi extends BaseApi {
}) })
// 添加聯絡人 // 添加聯絡人
this.registerEvent("User.addFavouriteChats", (args, { deviceId }) => { this.registerEvent("User.addFavouriteChats", (args, { deviceId }) => {
if (this.checkArgsMissing(args, ['token', 'targets'])) return { if (this.checkArgsMissing(args, ['token', 'chat_ids'])) return {
msg: "参数缺失", msg: "参数缺失",
code: 400, code: 400,
} }
@@ -384,7 +384,7 @@ export default class UserApi extends BaseApi {
let fail = 0 let fail = 0
const user = User.findById(token.author) as User const user = User.findById(token.author) as User
for (const target of (args.targets as string[])) { for (const target of (args.chat_ids as string[])) {
const chat = Chat.findById(target) || Chat.findByName(target) const chat = Chat.findById(target) || Chat.findByName(target)
const targetUser = User.findByAccount(target) as User const targetUser = User.findByAccount(target) as User
if (chat) if (chat)
@@ -404,7 +404,7 @@ export default class UserApi extends BaseApi {
}) })
// 添加聯絡人 // 添加聯絡人
this.registerEvent("User.removeFavouriteChats", (args, { deviceId }) => { this.registerEvent("User.removeFavouriteChats", (args, { deviceId }) => {
if (this.checkArgsMissing(args, ['token', 'targets'])) return { if (this.checkArgsMissing(args, ['token', 'chat_ids'])) return {
msg: "参数缺失", msg: "参数缺失",
code: 400, code: 400,
} }
@@ -416,7 +416,7 @@ export default class UserApi extends BaseApi {
} }
const user = User.findById(token.author) as User const user = User.findById(token.author) as User
user.removeFavouriteChats(args.targets as string[]) user.removeFavouriteChats(args.chat_ids as string[])
return { return {
msg: "成功", msg: "成功",