MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / request

Method request

wxapp/wx_xlxyh.js:98–161  ·  view source on GitHub ↗
(method, path, data = null, extraHeaders = {}, skipSign = false)

Source from the content-addressed store, hash-verified

96 }
97
98 async request(method, path, data = null, extraHeaders = {}, skipSign = false) {
99 if (!this.valid) {
100 return { code: 400, message: "CK无效" };
101 }
102
103 const timestamp = Date.now().toString();
104 const requestId = this.uuid().replace(/-/g, "");
105 const sign = skipSign ? "" : this.generateSign(timestamp, requestId, data || "");
106
107 const headers = {
108 "Host": "qualcomm.boysup.cn",
109 "Connection": "keep-alive",
110 "Content-Type": "application/x-www-form-urlencoded",
111 "timestamp": timestamp,
112 "sign": sign,
113 "xweb_xhr": "1",
114 "openId": this.openId,
115 "requestId": requestId,
116 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) UnifiedPCWindowsWechat(0xf254162e) XWEB/18151",
117 "userId": this.userId,
118 "sessionKey": this.ck,
119 "Referer": "https://servicewechat.com/wx026c06df6adc5d06/644/page-frame.html",
120 "Accept": "*/*",
121 "Sec-Fetch-Site": "cross-site",
122 "Sec-Fetch-Mode": "cors",
123 "Sec-Fetch-Dest": "empty",
124 ...extraHeaders
125 };
126
127 if (skipSign) {
128 delete headers.sign;
129 }
130
131 try {
132 const config = {
133 url: `https://qualcomm.boysup.cn${path}`,
134 method,
135 headers
136 };
137
138 if (data && method !== "GET") {
139 config.data = data;
140 }
141
142 const resp = await $.httpRequest(config);
143
144 if (typeof resp.data === "object") {
145 return resp.data;
146 } else {
147 return JSON.parse(resp.data);
148 }
149 } catch (e) {
150 const msg = e.response?.data?.message || e.message || "网络错误";
151 $.log(`❌ 请求失败: ${msg} (路径: ${path})`);
152 if (e.response) {
153 $.log(`📄 响应数据: ${JSON.stringify(e.response.data)}`);
154 }
155 return {

Callers 6

getOpenIdMethod · 0.95
runMethod · 0.95
handleDrawTaskMethod · 0.95
handleReadTaskMethod · 0.95
handleVlogTaskMethod · 0.95
batchHandleVlogsMethod · 0.95

Calls 4

uuidMethod · 0.95
generateSignMethod · 0.95
httpRequestMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected