feat(smzdm): 🚀 优化风控对抗逻辑并完善签到/任务流程

* **风控对抗增强**:
    * 更新 `APP_VERSION` 至 `11.1.98`。
    * 引入 `device_id` 确定性派生机制,通过 `userId` 结合 `DEVICE_SALT` 生成固定的设备串,解决跨运行设备不一致问题。
    * 优化 `sk` (设备签名) 生成逻辑,支持基于派生设备串自动计算。
    * 增加 `Cookie` 完整性检查,自动检测并提示缺失 `device_id`、`device_rid`、`z_dr` 等关键字段。
* **签到流程优化**:
    * 引入 `getCheckinCard` 接口,先渲染签到卡片以获取最新的连签状态,确保奖励判断准确。
    * 移除硬编码的 `IS_INSTALL_ZHANGDAMA` 参数。
* **任务处理优化**:
    * 增加 `getCaptchaType` 逻辑,在领取任务失败时识别验证码类型(滑块/图形),并友好提示用户手动操作。
    * 完善 `getArticleDetail` 接口,支持传递 `hashcode` 以匹配 APP 端跳转逻辑。
* **文档更新**:
    * 更新 `README.md`,详细说明 `SMZDM_SK` 的使用逻辑、设备字段缺失的影响以及如何正确抓包。
This commit is contained in:
Hex
2026-10-22 01:20:56 +08:00
parent 9aa6d3dbae
commit 0b71d792b8
5 changed files with 273 additions and 59 deletions

View File

@@ -12,6 +12,7 @@ const {
getEnvCookies,
wait,
waitHuman,
CREATE_CENTER_VIEW,
IS_INSTALL_ZHANGDAMA
} = require('./bot');
const notify = require('./sendNotify');
@@ -135,11 +136,14 @@ class SmzdmNormalTaskBot extends SmzdmTaskBot {
if (robotToken === false) {
return {
isSuccess,
isSuccess: false,
msg: '领取任务奖励失败!'
};
}
// 客户端初始化验证码组件时就会查一次,用来说明被要求的是哪种验证码
const captchaType = await this.getCaptchaType();
const { isSuccess, data, response } = await requestApi('https://user-api.smzdm.com/task/activity_task_receive', {
method: 'post',
headers: this.getHeaders(),
@@ -163,14 +167,45 @@ class SmzdmNormalTaskBot extends SmzdmTaskBot {
msg
};
}
else {
$.log(`领取任务奖励失败!${response}`);
// 110202 = 服务端要求人机验证,空验证码一定过不了
if (data.error_code == '110202') {
const type = captchaType === 'geetest' ? '滑块' : '图形';
$.log(`🟡[${taskId}] 领取需要${type}验证码,脚本无法通过,请到 APP 内手动领取`);
return {
isSuccess,
msg: '领取任务奖励失败!'
isSuccess: false,
msg: '需要验证码'
};
}
$.log(`领取任务奖励失败!${response}`);
return {
isSuccess,
msg: '领取任务奖励失败!'
};
}
// 验证码类型:geetest 走滑块,其余走图形
async getCaptchaType() {
const { isSuccess, data, response } = await requestApi('https://user-api.smzdm.com/getcaptcha/switch', {
method: 'post',
headers: this.getHeaders(),
data: {
token: this.token,
create_center_view: CREATE_CENTER_VIEW
}
});
if (isSuccess && data.data) {
return data.data.type || '';
}
$.log(`获取验证码配置失败!${response}`);
return '';
}
}