diff --git a/src/core/apis/webapi.ts b/src/core/apis/webapi.ts index 1a49e675..30dfda7e 100644 --- a/src/core/apis/webapi.ts +++ b/src/core/apis/webapi.ts @@ -27,7 +27,7 @@ export class NTQQWebApi { msg_random: msgRandom, target_group_code: targetGroupCode, }).toString() - }`; + }`; try { return RequestUtil.HttpGetText(url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) }); } catch (e) { @@ -38,8 +38,13 @@ export class NTQQWebApi { let ret: GroupEssenceMsgRet[] = []; for (let i = 0; i < 4; i++) { let data = await this.getGroupEssenceMsg(GroupCode, i, 50); - if (!data || data?.data.is_end) break; + if (!data) break; + if (data.data.is_end) { + ret.push(data); + break; + } ret.push(data); + } return ret; } @@ -51,11 +56,11 @@ export class NTQQWebApi { page_limit: page_limit.toString(), group_code: GroupCode, }).toString() - }`; + }`; let ret; try { ret = await RequestUtil.HttpGetJson - (url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) }); + (url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) }); } catch { return undefined; } @@ -71,14 +76,14 @@ export class NTQQWebApi { const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com'); const retList: Promise[] = []; const fastRet = await RequestUtil.HttpGetJson - (`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({ - st: '0', - end: '40', - sort: '1', - gc: GroupCode, - bkn: this.getBknFromCookie(cookieObject), - }).toString() - }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); + (`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({ + st: '0', + end: '40', + sort: '1', + gc: GroupCode, + bkn: this.getBknFromCookie(cookieObject), + }).toString() + }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); if (!fastRet?.count || fastRet?.errcode !== 0 || !fastRet?.mems) { return []; } else { @@ -91,14 +96,14 @@ export class NTQQWebApi { //遍历批量请求 for (let i = 2; i <= PageNum; i++) { const ret = RequestUtil.HttpGetJson - (`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({ - st: ((i - 1) * 40).toString(), - end: (i * 40).toString(), - sort: '1', - gc: GroupCode, - bkn: this.getBknFromCookie(cookieObject), - }).toString() - }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); + (`https://qun.qq.com/cgi-bin/qun_mgr/search_group_members?${new URLSearchParams({ + st: ((i - 1) * 40).toString(), + end: (i * 40).toString(), + sort: '1', + gc: GroupCode, + bkn: this.getBknFromCookie(cookieObject), + }).toString() + }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); retList.push(ret); } //批量等待 @@ -131,15 +136,15 @@ export class NTQQWebApi { let ret: any = undefined; try { ret = await RequestUtil.HttpGetJson - (`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${new URLSearchParams({ - bkn: this.getBknFromCookie(cookieObject), - qid: GroupCode, - text: Content, - pinned: '0', - type: '1', - settings: '{"is_show_edit_card":1,"tip_window_type":1,"confirm_required":1}', - }).toString() - }`, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) }); + (`https://web.qun.qq.com/cgi-bin/announce/add_qun_notice${new URLSearchParams({ + bkn: this.getBknFromCookie(cookieObject), + qid: GroupCode, + text: Content, + pinned: '0', + type: '1', + settings: '{"is_show_edit_card":1,"tip_window_type":1,"confirm_required":1}', + }).toString() + }`, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) }); return ret; } catch (e) { return undefined; @@ -170,7 +175,7 @@ export class NTQQWebApi { gc: Internal_groupCode, type: Internal_type.toString(), }).toString() - }`; + }`; let resJson; try { const res = await RequestUtil.HttpGetText(url, 'GET', '', { 'Cookie': this.cookieToString(cookieObject) });