mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-10-30 04:05:07 +08:00
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:
@@ -191,6 +191,11 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
return article.article_hash_id || article.article_id;
|
||||
}
|
||||
|
||||
// 打开文章时 APP 会把任务 redirect 里的 hashcode 一起带上
|
||||
getRedirectHashcode(task) {
|
||||
return (task.task_redirect_url && task.task_redirect_url.hashcode) || '';
|
||||
}
|
||||
|
||||
// 随机取一条评论文案,多条时用换行或 | 分隔
|
||||
getCommentContent() {
|
||||
const words = String(process.env.SMZDM_COMMENT || '')
|
||||
@@ -438,7 +443,7 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
articleId = task.task_redirect_url.link_val;
|
||||
|
||||
// 获取文章信息
|
||||
const articleDetail = await this.getArticleDetail(articleId);
|
||||
const articleDetail = await this.getArticleDetail(articleId, this.getRedirectHashcode(task));
|
||||
|
||||
if (articleDetail === false) {
|
||||
return {
|
||||
@@ -803,7 +808,7 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
await this.getHaojiaDetail(article.article_id);
|
||||
}
|
||||
else {
|
||||
await this.getArticleDetail(article.article_id);
|
||||
await this.getArticleDetail(article.article_id, this.getRedirectHashcode(task));
|
||||
}
|
||||
|
||||
await wait(8, 20);
|
||||
@@ -868,7 +873,7 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
await this.getHaojiaDetail(article.article_id);
|
||||
}
|
||||
else {
|
||||
await this.getArticleDetail(article.article_id);
|
||||
await this.getArticleDetail(article.article_id, this.getRedirectHashcode(task));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1337,15 +1342,12 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
async getArticleDetail(id) {
|
||||
async getArticleDetail(id, hashcode = '') {
|
||||
const { isSuccess, data, response } = await requestApi(`https://article-api.smzdm.com/article_detail/${id}`, {
|
||||
headers: this.getHeaders(),
|
||||
data: {
|
||||
comment_flow: '',
|
||||
lastest_update_time: '',
|
||||
uhome: 0,
|
||||
imgmode: 0,
|
||||
article_channel_id: 0
|
||||
hashcode,
|
||||
h5hash: ''
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user