mirror of
https://github.com/smallfawn/QLScriptPublic.git
synced 2026-11-05 22:36:53 +08:00
fix(wxapp): 修复白马智选登录误判与社服益寿证书过期拒连(#303)
baimazhixuan: 服务端对已注册用户返回 status:200 + '登录成功',但 isOk 只认 status 1/true/code 0,导致报「登录失败: 登录成功」。isOk 增加 200 判定。 实测:修复后 登录成功 -> 签到成功。 shefuyishou: 该站 TLS 证书已过期,Node 默认直接以 certificate has expired 拒连 (脚本完全跑不起来)。新增仅作用于本脚本的 https.Agent 放宽证书校验。 实测:证书阻塞解除,请求可达;剩余「获取openID2失败」为对方服务端 code2session 失败(疑似其 appid/密钥配置变更),非脚本问题。 #303 另两项实测结论:一汽丰田(fxh) 积分接口 404 已做非致命跳过、签到正常; 中粮(yuexihui) 为对方服务端 HTTP 503。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
71f70e35ee
commit
af1e7587b7
2 files changed
+6
-1
No files matched your search
@@ -79,7 +79,7 @@ function form(obj) {
|
||||
}
|
||||
|
||||
/** 该后端的成功判定 */
|
||||
const isOk = (res) => Number(res?.status) === 1 || res?.status === true || Number(res?.code) === 0;
|
||||
const isOk = (res) => Number(res?.status) === 1 || Number(res?.status) === 200 || res?.status === true || Number(res?.code) === 0 || Number(res?.code) === 200;
|
||||
const msgOf = (res) => res?.msg || res?.message || res?.msg || short(res);
|
||||
/** 每天跑一次,「已签到」必须当成成功而不是失败 */
|
||||
const isAlreadyDone = (t) => /已签|已经签|签到过|重复|已完成|already/i.test(String(t || ""));
|
||||
|
||||
@@ -24,11 +24,15 @@ const $ = new Env("社服益寿活动");
|
||||
const axios = require("axios");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const https = require("https");
|
||||
const WeChatServer = require("./wcs.js");
|
||||
|
||||
const ckName = "shefuyishou";
|
||||
const MINI_APP_ID = "wx8ac1f54b8fc39c6c";
|
||||
const BASE = "https://ylapi.luckystarpay.com";
|
||||
// 该站 TLS 证书已过期(服务端问题),Node 默认会以 certificate has expired 直接拒连。
|
||||
// 小程序端照常访问,这里仅对本站放宽证书校验以恢复可用性(不影响其它请求)。
|
||||
const httpsAgent = new https.Agent({ keepAlive: true, rejectUnauthorized: false });
|
||||
const TOKEN_CACHE_FILE = path.join(__dirname, "shefuyishou_token_cache.json");
|
||||
const USER_AGENT =
|
||||
"Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||
@@ -117,6 +121,7 @@ class Task {
|
||||
headers: this.headers(),
|
||||
timeout: 20000,
|
||||
validateStatus: () => true,
|
||||
httpsAgent,
|
||||
});
|
||||
if (res.status !== 200) throw new Error(`${apiPath} HTTP ${res.status}: ${short(res.data)}`);
|
||||
return res.data;
|
||||
|
||||
Reference in new issue
Block a user