* 小程序点赞 *
(likeUserId, timeout = 2 * 1000)
| 379 | * |
| 380 | */ |
| 381 | function like (likeUserId, timeout = 2 * 1000) { |
| 382 | let isCompleted = false; |
| 383 | return new Promise((resolve) => { |
| 384 | let url = { |
| 385 | url: `https://zm.t7a.cn/api/subrank.php?safe=${zmnlxq}&id=${likeUserId}&type=1`, |
| 386 | headers: { |
| 387 | 'Host': 'zm.t7a.cn', |
| 388 | 'user-agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram/wx532ecb3bdaaf92f9' |
| 389 | }, |
| 390 | // body: '', |
| 391 | |
| 392 | } |
| 393 | $.get(url, async (error, response, data) => { |
| 394 | try { |
| 395 | result = JSON.parse(data) |
| 396 | if (result.status == 1) { |
| 397 | console.log('点赞成功!'); |
| 398 | } else { |
| 399 | console.log('点赞失败:', result.msg) |
| 400 | isCompleted = result?.msg?.includes('您今天的互动已到上限'); |
| 401 | } |
| 402 | |
| 403 | } catch (e) { |
| 404 | console.log(e) |
| 405 | } finally { |
| 406 | resolve(isCompleted); |
| 407 | } |
| 408 | }, timeout) |
| 409 | }) |
| 410 | } |
| 411 | |
| 412 | /** |
| 413 | * 小程序分享任务 |
no test coverage detected