Add styles for web UI and create batch script for launching Web GUI
- Introduced a comprehensive CSS file for styling the web interface, including variables for colors, layout styles, and responsive design adjustments. - Added a batch script to automate the process of stopping any existing instances of the web GUI and launching the new instance, along with opening the browser to the appropriate URL.
This commit is contained in:
commit
02b2930639
30 files changed
+12065
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# Virtual env
|
||||
.venv/
|
||||
|
||||
# Runtime artifacts
|
||||
*.log
|
||||
pic/
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -0,0 +1 @@
|
||||
{"ts": 1765641063.2151546, "counters": {"fudai_seen": 1, "fudai_open_detail": 1, "fudai_click_attend": 1, "fudai_attend_ok": 1, "fudai_result_win": 1}, "fudai_last": {"content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0, "updated_ts": 1765641063.1966858}, "events": [{"ts": 1765641063.1946857, "type": "fudai_seen", "meta": {"content": "测试内容A", "countdown": "", "participants": null, "copies": null, "prize_value_yuan": null}}, {"ts": 1765641063.1966858, "type": "fudai_open_detail", "meta": {"content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0}}, {"ts": 1765641063.1966858, "type": "fudai_click_attend", "meta": {"content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0}}, {"ts": 1765641063.1966858, "type": "fudai_attend_ok", "meta": {"content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0}}, {"ts": 1765641063.1966858, "type": "fudai_result_win", "meta": {"content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0}}], "wins": [{"ts": 1765641063.1966858, "content": "测试内容A", "countdown": "10:00后开奖", "participants": 123, "copies": 5, "prize_value_yuan": 199.0}]}
|
||||
@@ -0,0 +1 @@
|
||||
21948
|
||||
@@ -0,0 +1 @@
|
||||
{"ts": 1765685532.6116447, "counters": {"fudai_open_detail": 74, "fudai_seen": 80, "fudai_skip_value_low": 28, "fudai_open_error": 8, "switch_room": 40, "switch_room_no_fudai": 28, "fudai_skip_countdown_short": 3, "switch_room_countdown": 3, "switch_room_value": 8, "fudai_click_attend": 2, "fudai_result_no_win": 2}, "fudai_last": {"content": "【粉丝专属】iPhone17手机256G颜色随机", "countdown": "14:29后开奖", "participants": 2132, "copies": 1, "prize_value_yuan": 5999.0, "updated_ts": 1765684579.3024325}, "events": [{"ts": 1765641806.1646142, "type": "fudai_open_detail", "meta": {"content": "", "countdown": "", "participants": null, "copies": null, "prize_value_yuan": null}}, {"ts": 1765641813.7004516, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "", "participants": null, "copies": null, "prize_value_yuan": null}}, {"ts": 1765641815.2687662, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "07:19后开奖", "participants": 32, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641819.8364112, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "07:19后开奖", "participants": 32, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641826.9612343, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "07:19后开奖", "participants": 32, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641829.2069504, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "04:07", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641833.980556, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "04:07", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641841.1970615, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "04:07", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641842.785327, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:50后开奖", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641848.7064586, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:50后开奖", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641857.2592785, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:50后开奖", "participants": 34, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641858.9027817, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:35后开奖", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641863.3506944, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:35后开奖", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641869.6957817, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:35后开奖", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641871.0666997, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:21", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641875.5607815, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:21", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641882.6100206, "type": "fudai_seen", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:21", "participants": 35, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641883.8911793, "type": "fudai_skip", "meta": {"reason": "value_low", "content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:09", "participants": 36, "copies": 1, "prize_value_yuan": 199.0}}, {"ts": 1765641888.1028545, "type": "fudai_open_detail", "meta": {"content": "【懒猫nono专属】海蓝之谜精萃水沁润15ml补水保湿...", "countdown": "06:09", "participants": 36, "copies": 1, "prize_value_yuan": 1Line truncated
|
||||
@@ -0,0 +1,17 @@
|
||||
# 更新记录(Changelog)
|
||||
|
||||
本项目采用“版本号 + 日期 + 变更点”的方式记录。
|
||||
|
||||
## V3.3.1 (2025-12-14)
|
||||
|
||||
- 高价值福袋:预约从单个 reserved 改为 reservations 队列(按开奖时间排序),支持队列上限与溢出淘汰最低价值。
|
||||
- 高价值福袋:队列满时回退到“开奖时间最早”的预约项等待,临近开奖前 N 秒回退参与。
|
||||
- 预约回退:修复参与窗口内等待不及时(remain<=0 时不再长时间等待,改为 1 秒促发回退参与)。
|
||||
- 回退定位:回退校验失败不再清空整个队列;增加上下微调搜索以提升回退命中率。
|
||||
- 回退校验:加入直播间名 OCR 辅助判断(用于更快识别是否回到目标直播间),并更新识别坐标。
|
||||
- OCR:倒计时识别更稳健(按框坐标排序拼接;默认前两位为分、后两位为秒;详情倒计时分割 OCR 纠错与兜底)。
|
||||
- Web GUI:统一日志落盘到 logs/unified.log,并增加实时截图卡片轮询 pic/screenshot.png。
|
||||
- 工具:tools/pick_coords.py 支持手动打开图片(文件选择对话框、菜单“文件→打开…”,Ctrl+O)。
|
||||
- 工程化:新增 version.py;多个入口脚本启动时打印版本号。
|
||||
|
||||
> 注:如果你需要更细颗粒度的提交级记录,可以在此版本下继续追加子条目。
|
||||
@@ -0,0 +1,230 @@
|
||||
# 功能展示
|
||||
用于在抖音直播间自动挂机领取福袋,只要手机不关机就能24小时无限刷福袋
|
||||
一个月即使运气非常差,中10来个奖品还是很轻松的!
|
||||
部分奖品:
|
||||
<img width="1065" height="871" alt="image" src="https://github.com/user-attachments/assets/1603ed0b-16ec-4087-8c8b-e9c09484a0f3" />
|
||||
|
||||
# 使用方法
|
||||
1.手机打开“手势导航”,开启【屏幕内三键导航】,把3个按键显示出来
|
||||
2.手机连接电脑,开启开发者选项,usb调试打开,电脑上CMD命令提示行中输入adb devices命令能找到设备ID
|
||||
3.手机页面初始化位置,打开抖音->个人中心->关注->直播中->随意进一个直播间
|
||||
4.然后执行douyin_guaji.py文件即可
|
||||
5.要是完全不知道咋弄或者运行后有什么问题,你都可以到B站找到叼哥,会帮你答疑或者私有化部署
|
||||
|
||||
## 可视化界面(推荐)
|
||||
新增了一个可视化控制台,方便你改配置、选择设备、一键运行/停止,并实时看日志。
|
||||
|
||||
GUI 里可以直接调:最低奖品价值、参与人数范围、倒计时太短(秒)自动跳过、粉丝团门槛策略等。
|
||||
|
||||
另外也支持:
|
||||
1) 切换直播间达到 N 次后,自动在当前直播间页下滑回退到本轮第一个直播间;
|
||||
|
||||
界面里带「截图预览」页,可以直接查看 `pic/fudai_value.png` 等截图,方便确认奖品价值/倒计时是否被完整截取。
|
||||
|
||||
1. 安装 GUI 依赖(更美观):
|
||||
|
||||
```bash
|
||||
pip install ttkbootstrap
|
||||
```
|
||||
|
||||
2. 运行 GUI:
|
||||
|
||||
```bash
|
||||
python gui_app.py
|
||||
```
|
||||
|
||||
GUI 会读写 `config.json`,并通过 `run_cli.py` 启动挂机进程。
|
||||
|
||||
## 日志(便于排错)
|
||||
默认会把所有运行日志追加写入统一文件:`logs/unified.log`(不设行数上限,按磁盘容量为准)。
|
||||
|
||||
相关配置在 `config.json`:
|
||||
- `log_unified_enabled`: 是否启用统一日志文件
|
||||
- `log_unified_path`: 统一日志文件路径(相对项目目录或绝对路径)
|
||||
- `webgui_log_capacity`: Web GUI 内存里保留多少行日志(`0` 表示不限制;建议长时间运行时设为 `2000` 左右,避免占用过多内存)
|
||||
## 注意
|
||||
6.缺少各种python三方库文件的需要自己安装一下,运行下面的命令:
|
||||
pip install pillow paddlepaddle paddleocr numpy
|
||||
从粉丝反馈来看,最新版的paddlepaddle可能会有问题
|
||||
7.根据自己设备的情况,修改douyin_guaji.py文件中y轴的像素偏移值,可正可负,通常调整区间在【-50,50】
|
||||
默认手机分辨率是1080*2400的像素,即使是相同的分辨率,可能也会因为手机顶部的刘海不一样,以及是否使用了底部导航按钮,导致存在Y轴的偏移
|
||||

|
||||
8.将会在4.0版本自动识别偏移值,后续不再需要调整任何参数,全自动识别、运行(叼哥B站达到1.5W粉发布)
|
||||
9.基本上大部分问题,都能从这篇文章找到答案和建议:https://www.bilibili.com/opus/1104972369516036117
|
||||
|
||||
# 版本更新&预更新内容
|
||||
V1.0
|
||||
支持无限循环挂机直播间
|
||||
1.判断直播间福袋内容是否是想要的,如果不想要则切换直播间
|
||||
2.直播间倒计时是否还有很久,太久则切换直播间
|
||||
3.当直播间开奖后,立马切换直播间去别的直播间挂机
|
||||
|
||||
V1.1
|
||||
1.对人机弹窗做判定,适当滑动解锁
|
||||
2.对截图函数做优化,处理无法截图的情况
|
||||
3.优化不切换直播间时的逻辑
|
||||
|
||||
V1.2
|
||||
1.判定划动图片验证的人机校验,自动滑动一定距离处理人机验证
|
||||
2.优化直播间判定逻辑,增加直播停留时间减少被人机的概率
|
||||
3.增加直播间等待时间的参数,控制直播停留时间减少被人机的概率
|
||||
4.增加对当前时间的判定,不同时间段对抽奖的内容做不同的处理
|
||||
|
||||
V1.3
|
||||
1.增加直播已结束的判定
|
||||
2.增加是否在直播列表页面的判定
|
||||
3.增加回到直播列表重新进入直播的逻辑
|
||||
4.增加点亮粉丝团抽奖的特殊处理
|
||||
5.直播提早开奖补充截图内容获取,用于debug
|
||||
|
||||
V1.4
|
||||
1.兼容了一下直播间忽然弹出来618红包弹窗导致页面一直卡在直播间的问题
|
||||
2.修复进入直播间列表的功能异常的问题
|
||||
3.优化挂机的时候直播间关闭的判定
|
||||
4.兼容 同时存在参与条件+参与任务的抽奖
|
||||
5.增加判断是否在个人中心的关注页面
|
||||
6.修复领完奖后回到直播间判断不在直播间的问题
|
||||
7.增加上划切换到直播间直播间已关闭的判断
|
||||
8.兼容福袋参与抽奖的文案为:参与抽奖
|
||||
|
||||
V1.5
|
||||
1.优化设备未识别的处理逻辑
|
||||
2.优化图片文件夹不存在创建文件夹的逻辑
|
||||
|
||||
V1.6
|
||||
1.增加日志内容同步输出到log文件中,方便问题排查
|
||||
2.修复了到凌晨个别直播间提早关闭会导致直播判定卡住的问题
|
||||
3.调整不切换直播间挂机的逻辑,现在会一直等待到直播间关闭才会切换
|
||||
|
||||
V1.7
|
||||
1.修复单独挂一个直播间,判定直播间已关闭后,不切换直播间的问题
|
||||
2.增加全局的监控,无论发生什么情况,只要长时间判定为没有福袋,则重置整个挂机流程
|
||||
|
||||
V2.0
|
||||
1.做了不同分辨率手机的兼容,现在不是1080*2400的手机也能挂机了
|
||||
2.优化了从直播间列表进直播间连刷新2次的问题
|
||||
3.优化了领奖完成后返回直播间领奖界面依旧没关闭的情况
|
||||
4.修复了过了凌晨之后直播间一直没有福袋的判定问题
|
||||
|
||||
V2.1
|
||||
1.修复节假日出现的直播红包弹窗一直无法被退出关闭的问题
|
||||
2.兼容操控通过wifi直连到笔记本电脑上的手机
|
||||
3.优化弹窗人机验证后,点击返回无法退出验证的情况
|
||||
4.加入手机电量验证逻辑
|
||||
5.增加手机电量不足时进入待机模式的逻辑,避免手机直接关机
|
||||
6.兼容领奖完成后,判定关闭中奖弹窗后还有一个提醒领奖窗口的情况
|
||||
7.优化凌晨后整个直播列表无直播间导致无法刷新的问题
|
||||
|
||||
V2.2
|
||||
1.优化日志打印逻辑
|
||||
2.增加点击福袋无法打开,被系统限制参与抽奖的判定逻辑
|
||||
3.修复在固定直播间挂机会忽然切换直播间的问题
|
||||
4.修复:没有抽中,点击:我知道了,关闭弹窗,弹窗未关闭的问题
|
||||
5.修复进入没有加入粉丝团的直播间,无法抽奖但没有切换直播间的问题
|
||||
6.增加一个抽奖按钮的判定:活动已结束
|
||||
7.增加了切换到未加入店铺的直播间的抽奖判定
|
||||
8.修复:中奖后下单,回到直播间依旧存在中奖弹窗提醒关不掉的问题
|
||||
|
||||
V2.3
|
||||
1.兼容任意分辨率的手机,增加横轴对应的分辨率设置
|
||||
2.优化代码,抽象一部分方法,去除冗余代码
|
||||
3.修复当直播间列表为空时,点击返回退出到关注中心,判定页面失效,无法回到直播间列表的问题
|
||||
4.开奖结束后增加一个随机时长等待,减小风控风险
|
||||
5.补充逻辑处理:直播间因为状态栏高度的不同,导致关闭的判定不同
|
||||
6.调整挂机逻辑,到后半夜固定时间区间时,不再参与抽奖
|
||||
|
||||
V2.4
|
||||
1.调整偏移值逻辑,填任意正负数都会进行双重匹配,自动确认适宜的偏移值
|
||||
2.调整长时间无法识别到福袋的逻辑,避免重复打开都是无福袋的直播间导致被风控
|
||||
3.优化代码,抽象剩余部分方法,去除冗余代码
|
||||
4.修复偶尔出现中奖后,领奖完成返回到直播间,结果页面退回到了视频首页的问题
|
||||
5.补充下完单后,在购买成功页面的验证逻辑
|
||||
|
||||
V3.0
|
||||
1.引入百度PaddleOCR图像识别库,替换掉pytesseract,大幅提升文字识别准确度
|
||||
2.优化代码,拆分基础操作函数到单独库做引用
|
||||
3.执行脚本,不再需要手动设置手机分辨率参数,会自动设置手机对应的值
|
||||
4.兼容人脸检测的人机验证弹窗的判定
|
||||
|
||||
V3.1
|
||||
1.修复新账号中奖后,下完单返回到直播间,因为弹出一个'添加抖音商城到桌面'的弹窗,导致页面还卡在'购买成功'页面的问题
|
||||
2.修复偶尔退出直播间,直接退到了个人中心,进而没有正确打开关注列表的问题
|
||||
3.补充部分操作后的随机时长等待,规避被监控风险
|
||||
|
||||
V3.2
|
||||
1.调整开奖后弹窗的点击判定,避免没有成功关闭弹窗的情况
|
||||
2.兼容开奖后没有中奖,但是给了会员专属优惠券的情况
|
||||
3.优化开奖后判定是否中奖及后续的逻辑
|
||||
|
||||
V3.3
|
||||
1.将哪些福袋想要、不想要的配置移动到json文件中进行
|
||||
2.在关注列表页面补充一个vivo手机断开充电的判定
|
||||
3.调整开奖后未中奖,但发了一张优惠券的处理逻辑
|
||||
4.适当调大关键截图的区间,方便判定
|
||||
|
||||
|
||||
# 以下为预更新版本内容
|
||||
|
||||
V4.0(叼哥B站到1.5W粉丝发布 或 第三档充电提早获取)
|
||||
1.不再需要填写偏移值等任何参数,直接运行,会自动找到合适的偏移值进行后续操作
|
||||
2.调整页面判断逻辑,实时记录当前所在页面的类型(直接间、直播列表、个人中心、订单页等)
|
||||
3.优化是否有福袋的判定逻辑
|
||||
4.重做福袋详情弹窗内容判定逻辑
|
||||
5.大幅调整代码逻辑,优化代码结构和性能
|
||||
6.增加参与抽奖文案为'不满足参与条件'的情况的处理
|
||||
7.补充刷新直播间列表逻辑,避免过于频繁刷新直播间导致被风控
|
||||
|
||||
V4.1
|
||||
1.调整打开福袋详情判定异常后的关闭福袋弹窗位置,避免关闭弹窗实则是打开
|
||||
2.调整参与抽奖内容为加入粉丝团(1钻石)的判定和处理逻辑
|
||||
3.增加文件关闭机制,降低内存泄漏风险
|
||||
4.修复在直播间判定是否存在福袋次数减少的问题
|
||||
|
||||
V4.2(最高档充电提早获取)
|
||||
1.模拟用户操作,在抖音商城中进行浏览、下单流程(创建订单但不付钱)
|
||||
2.模拟用户操作,到停止挂机时间段退出抖音,到开始挂机时间再启动抖音
|
||||
3.模拟用户操作,在视频首页刷一会视频,并随机加评论、点赞
|
||||
4.优化是否存在福袋的逻辑,只检测固定间隔的位置
|
||||
5.调整了凌晨关闭抖音后等待时长的逻辑,统一等待到8点继续挂机
|
||||
6.修复了福袋内容不想要多次切换直播间后,后续无法参与新福袋抽奖的问题
|
||||
|
||||
V4.3
|
||||
1.调整对极速版的直播列表的判定
|
||||
2.兼容部分直播间,在评论完后还要再点击‘观看直播’才能参与抽奖的情况
|
||||
3.兼容开奖后,点击‘知道了’偶发弹窗未成功关闭的情况
|
||||
4.将设备初次识别成功的偏移值存下来,后续运行改成直接读取保存的值
|
||||
|
||||
V4.4
|
||||
1.重写判定福袋详情高度的逻辑
|
||||
2.重写判定福袋详情和倒计时的方法,做到可以适配任意分辨率的手机
|
||||
3.修复报错:UnicodeEncodeError: 'gbk' codec can't encode character
|
||||
|
||||
V4.5
|
||||
1.修复开局挂机的直播间没有福袋,导致执行报错的问题
|
||||
2.调整参与福袋抽奖图标的截取逻辑,做到可以适配任意分辨率的手机
|
||||
3.调整开奖结果弹窗内容的截取逻辑,做到可以适配任意分辨率的手机
|
||||
3.增加对顶部状态栏高度的判定
|
||||
4.调整是否在某些指定页面的判定逻辑,做到可以适配任意分辨率的手机
|
||||
5.修复连续切换N个直播间,退出返回直播列表,多次循环后判定不到直播间的问题
|
||||
6.增加抽奖次数统计
|
||||
|
||||
V4.6
|
||||
1.移除偏移值的设定,改为动态自动查询
|
||||
2.将设备初次识别成功的顶部状态栏高度存下来,后续运行改成直接读取保存的值
|
||||
3.优化福袋参与抽奖按钮文字的二次判定逻辑
|
||||
4.调整人机验证弹窗的判定
|
||||
5.优化到凌晨时段,无法关闭抖音,卡在了直播关注列表的情况
|
||||
|
||||
未来更新
|
||||
1.获取直播间名字,关联奖品和倒计时,加入判定队列
|
||||
2.完全自动处理防沉迷验证
|
||||
3.兼容挂机过程中弹出的:开通特惠省钱卡的弹窗
|
||||
4.增加钻石福袋挂机模式,在直播列表刷钻石
|
||||
5.处理异常操作导致弹窗:账号存在风险的验证
|
||||
6.兼容IOS系统,苹果手机也能挂机
|
||||
7.增加直播间瞎逛模式,无限切换,发现想要的福袋就抽一下
|
||||
8.其他来自充电粉丝们的建议,额外需要的功能
|
||||
9.支持个性化定制操作时间,模拟你的个人使用习惯,让操作更像真人(规避风控)
|
||||
10.兼容最新版本的paddleOCR
|
||||
|
||||
# 看到最后了,白嫖成功记得点个星,或者B站找叼哥进QQ群!
|
||||
@@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
cd /d "c:\Users\12742\Desktop\douyin_guaji-main"
|
||||
|
||||
:: 可修改为你需要的端口,例如 8001
|
||||
set PORT=8000
|
||||
set PYTHONIOENCODING=utf-8
|
||||
set PYTHONUNBUFFERED=1
|
||||
|
||||
call .venv\Scripts\activate.bat
|
||||
python web_gui.py
|
||||
|
||||
pause
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
把“爱心/点赞”与“收藏/五角星”两个图标的小图片分别保存为:
|
||||
- assets/like.png
|
||||
- assets/fav.png
|
||||
|
||||
脚本会在养号动作时:
|
||||
1) 按 config.json 里的坐标截取附近 180x180 的 ROI,保存到 pic/action_like_roi/latest.png、pic/action_fav_roi/latest.png
|
||||
2) 用 OpenCV 模板匹配判断 ROI 是否包含对应图标;检测到才会点击
|
||||
|
||||
提示:模板图片尽量是纯图标(透明背景也可以),大小不要超过 ROI 太多。
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
+150
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"log_unified_enabled": true,
|
||||
"log_unified_path": "logs/unified.log",
|
||||
"webgui_log_capacity": 0,
|
||||
"contains_want": [],
|
||||
"contains_not_want": [
|
||||
"袜子1"
|
||||
],
|
||||
"min_prize_value_yuan": 199.7,
|
||||
"min_participants": 0,
|
||||
"max_participants": 0,
|
||||
"skip_if_countdown_lt_seconds": 5,
|
||||
"auto_join_fansclub": true,
|
||||
"fansclub_fail_action": "switch",
|
||||
"high_value_fudai_enabled": true,
|
||||
"high_value_fudai_threshold_yuan": 500,
|
||||
"high_value_fudai_join_ahead_seconds": 90,
|
||||
"high_value_fudai_max_swipe_back": 0,
|
||||
"high_value_fudai_max_reservations": 5,
|
||||
"high_value_fudai_after_action": "continue",
|
||||
"fudai_abnormal_reopen_delay_seconds": 1.2,
|
||||
"fudai_quiet_hours_enabled": true,
|
||||
"fudai_quiet_start_hour": 2,
|
||||
"fudai_quiet_end_hour": 7,
|
||||
"no_fudai_watchdog_enabled": false,
|
||||
"reset_after_swipes": 0,
|
||||
"yanghao_enabled": false,
|
||||
"yanghao_recommend_duration_seconds": 216,
|
||||
"yanghao_recommend_interval_seconds": 600,
|
||||
"yanghao_enable_actions": false,
|
||||
"yanghao_like_prob": 0.0,
|
||||
"yanghao_fav_prob": 0.0,
|
||||
"yanghao_like_icon_x": 988,
|
||||
"yanghao_like_icon_y": 1290,
|
||||
"yanghao_fav_icon_x": 985,
|
||||
"yanghao_fav_icon_y": 1637,
|
||||
"yanghao_like_roi_offset_x": 0,
|
||||
"yanghao_like_roi_offset_y": -50,
|
||||
"yanghao_fav_roi_offset_x": 40,
|
||||
"yanghao_fav_roi_offset_y": 0,
|
||||
"yanghao_icon_roi_size": 240,
|
||||
"yanghao_icon_match_threshold": 0.72,
|
||||
"yanghao_like_template_path": "assets/like.png",
|
||||
"yanghao_fav_template_path": "assets/fav.png",
|
||||
"yanghao_step_screenshot": false,
|
||||
"yanghao_comment_prob": 0.0,
|
||||
"yanghao_comment_btn_x": 981,
|
||||
"yanghao_comment_btn_y": 1399,
|
||||
"yanghao_comment_input_x": 250,
|
||||
"yanghao_comment_input_y": 2218,
|
||||
"yanghao_comment_send_x": 906,
|
||||
"yanghao_comment_send_y": 1298,
|
||||
"yanghao_comment_close_x": 586,
|
||||
"yanghao_comment_close_y": 385,
|
||||
"yanghao_comment_texts": [
|
||||
"????????????",
|
||||
"??????????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"???????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"??????????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"?????????????????????",
|
||||
"??????????????????",
|
||||
"????????????????????????",
|
||||
"????????????????????????",
|
||||
"???????????????????????????",
|
||||
"????????????????????????????????????",
|
||||
"????????????????????????",
|
||||
"????????????????????????",
|
||||
"????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"?????????????????????",
|
||||
"????????????-1",
|
||||
"????????????",
|
||||
"??????????????????????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"??????????????????????????????????????????????????????????????????????????????????????????",
|
||||
"????????????????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"?????????????????????????????????????????????????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"??????????????????????????????????????????",
|
||||
"????????????????????????????????????????????????",
|
||||
"???????????????????????????????????????",
|
||||
"????????????",
|
||||
"?????????????????????????????????",
|
||||
"????????????????????????",
|
||||
"???????????????????????????????????????",
|
||||
"??????????????????????????????????????????????????????????????????",
|
||||
"??????????????????",
|
||||
"???????????????????????????????????????",
|
||||
"????????????",
|
||||
"???????????????????????????",
|
||||
"????????????????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"?????????????????????????????????",
|
||||
"??????????????????",
|
||||
"????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"????????????????????????????????????",
|
||||
"????????????????????????",
|
||||
"?????????",
|
||||
"????????????",
|
||||
"????????????",
|
||||
"DJ???????????????????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"?????????????????????????????????????????????",
|
||||
"???????????????????????????????????????????????????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"??????????????????????????????",
|
||||
"???????????????????????????",
|
||||
"???????????????????????????",
|
||||
"?????????????????????????????????",
|
||||
"???XX???????????????",
|
||||
"???????????????????????????",
|
||||
"??????????????????",
|
||||
"??????????????????",
|
||||
"???????????????????????????",
|
||||
"???????????????????????????????????????",
|
||||
"????????????????????????",
|
||||
"??????????????????????????????",
|
||||
"??????????????????",
|
||||
"??????????????????????????????",
|
||||
"?????????????????????????????????"
|
||||
],
|
||||
"yanghao_after_dwell_swipe_direction": "up",
|
||||
"yanghao_after_dwell_swipe_distance_px": 900,
|
||||
"yanghao_like_keywords": [
|
||||
"???",
|
||||
"??????",
|
||||
"Like"
|
||||
],
|
||||
"yanghao_fav_keywords": [
|
||||
"??????",
|
||||
"????????????",
|
||||
"????????????",
|
||||
"Favorite"
|
||||
],
|
||||
"yanghao_fallback_close_x": 1030,
|
||||
"yanghao_fallback_close_y": 120,
|
||||
"yanghao_fallback_live_x": 718,
|
||||
"yanghao_fallback_live_y": 169,
|
||||
"yanghao_fallback_enter_live_x": 119,
|
||||
"yanghao_fallback_enter_live_y": 345,
|
||||
"reset_after_swipes_enabled": false,
|
||||
"high_value_room_revisit_enabled": false,
|
||||
"high_value_room_revisit_only_current_run": false,
|
||||
"reservation_back_verify_enabled": false
|
||||
}
|
||||
+5423
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,25 @@
|
||||
from douyin_fudai import fudai_analyse
|
||||
|
||||
try:
|
||||
from version import print_version_banner
|
||||
except Exception:
|
||||
print_version_banner = None
|
||||
|
||||
class fudai_guaji:
|
||||
def __init__(self):
|
||||
self.analyser = fudai_analyse()
|
||||
|
||||
def guaji(self, y_pianyi=0):
|
||||
"""y_pianyi 对应y轴高度的偏移值"""
|
||||
device_id = self.analyser.operation.select_device()
|
||||
if device_id:
|
||||
self.analyser.fudai_choujiang(device_id, y_pianyi, True, 5)
|
||||
return True
|
||||
self.analyser.operation.delay(10)
|
||||
self.guaji(y_pianyi)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if callable(print_version_banner):
|
||||
print_version_banner("douyin_guaji")
|
||||
choujiang = fudai_guaji()
|
||||
choujiang.guaji(0) # 运行只需改这里的0,对应是你手机纵轴y的偏移值
|
||||
+708
@@ -0,0 +1,708 @@
|
||||
import json
|
||||
import os
|
||||
import queue
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
|
||||
|
||||
CONFIG_PATH = os.path.join(os.path.dirname(__file__), "config.json")
|
||||
|
||||
|
||||
def find_adb_executable() -> str:
|
||||
"""返回可用的 adb 可执行文件路径(优先 PATH,其次默认安装目录)。"""
|
||||
adb = shutil.which("adb")
|
||||
if adb:
|
||||
return adb
|
||||
|
||||
# 默认安装目录(我们之前下载的 platform-tools)
|
||||
localapp = os.environ.get("LOCALAPPDATA") or ""
|
||||
candidates = []
|
||||
if localapp:
|
||||
candidates.append(os.path.join(localapp, "platform-tools", "adb.exe"))
|
||||
|
||||
# 兼容某些人手动放到用户目录的情况
|
||||
userprofile = os.environ.get("USERPROFILE") or ""
|
||||
if userprofile:
|
||||
candidates.append(os.path.join(userprofile, "AppData", "Local", "platform-tools", "adb.exe"))
|
||||
|
||||
for p in candidates:
|
||||
if os.path.exists(p):
|
||||
return p
|
||||
return ""
|
||||
|
||||
|
||||
def list_adb_devices(adb_exe: str) -> list[str]:
|
||||
try:
|
||||
if not adb_exe:
|
||||
return []
|
||||
proc = subprocess.run([adb_exe, "devices", "-l"], capture_output=True, text=True, encoding="utf-8", errors="replace")
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
text = (proc.stdout or "") + "\n" + (proc.stderr or "")
|
||||
pattern = r"(\b(?:[0-9]{1,3}(?:\.[0-9]{1,3}){3}(?::[0-9]+)?|[A-Za-z0-9]{8,})\b)\s*device\b"
|
||||
return re.findall(pattern, text)
|
||||
|
||||
|
||||
def read_config() -> dict:
|
||||
if not os.path.exists(CONFIG_PATH):
|
||||
return {}
|
||||
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def write_config(cfg: dict) -> None:
|
||||
with open(CONFIG_PATH, "w", encoding="utf-8") as f:
|
||||
json.dump(cfg, f, ensure_ascii=False, indent=4)
|
||||
f.write("\n")
|
||||
|
||||
|
||||
@dataclass
|
||||
class RunParams:
|
||||
device_id: str
|
||||
y_pianyi: int
|
||||
needswitch: bool
|
||||
wait_minutes: int
|
||||
skip_if_countdown_lt_seconds: int
|
||||
reset_after_swipes: int
|
||||
min_prize_value_yuan: float
|
||||
min_participants: int
|
||||
max_participants: int
|
||||
auto_join_fansclub: bool
|
||||
fansclub_fail_action: str
|
||||
|
||||
|
||||
class Runner:
|
||||
def __init__(self, on_line):
|
||||
self._proc: Optional[subprocess.Popen] = None
|
||||
self._on_line = on_line
|
||||
self._reader_thread: Optional[threading.Thread] = None
|
||||
|
||||
def is_running(self) -> bool:
|
||||
return self._proc is not None and self._proc.poll() is None
|
||||
|
||||
def start(self, params: RunParams) -> None:
|
||||
if self.is_running():
|
||||
raise RuntimeError("已经在运行")
|
||||
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(os.path.dirname(__file__), "run_cli.py"),
|
||||
"--y-pianyi",
|
||||
str(params.y_pianyi),
|
||||
"--wait-minutes",
|
||||
str(params.wait_minutes),
|
||||
]
|
||||
if params.device_id:
|
||||
cmd += ["--device-id", params.device_id]
|
||||
if params.needswitch:
|
||||
cmd.append("--needswitch")
|
||||
|
||||
cmd += ["--min-prize-value-yuan", str(params.min_prize_value_yuan)]
|
||||
|
||||
# 这些参数是新增可调节项:倒计时太短跳过、参与人数范围
|
||||
cmd += ["--skip-if-countdown-lt-seconds", str(int(params.skip_if_countdown_lt_seconds or 15))]
|
||||
if int(params.reset_after_swipes or 0) > 0:
|
||||
cmd += ["--reset-after-swipes", str(int(params.reset_after_swipes))]
|
||||
else:
|
||||
cmd += ["--reset-after-swipes", "0"]
|
||||
if int(params.min_participants or 0) > 0:
|
||||
cmd += ["--min-participants", str(int(params.min_participants))]
|
||||
if int(params.max_participants or 0) > 0:
|
||||
cmd += ["--max-participants", str(int(params.max_participants))]
|
||||
|
||||
if params.auto_join_fansclub:
|
||||
cmd.append("--auto-join-fansclub")
|
||||
if params.fansclub_fail_action:
|
||||
cmd += ["--fansclub-fail-action", params.fansclub_fail_action]
|
||||
|
||||
# 继承当前环境,并确保 adb 在 PATH(即使用户没手动刷新 PATH)
|
||||
env = os.environ.copy()
|
||||
env.setdefault("PYTHONIOENCODING", "utf-8")
|
||||
|
||||
adb_exe = find_adb_executable()
|
||||
if adb_exe:
|
||||
adb_dir = os.path.dirname(adb_exe)
|
||||
env["PATH"] = adb_dir + os.pathsep + env.get("PATH", "")
|
||||
env["ADB_EXECUTABLE"] = adb_exe
|
||||
else:
|
||||
self._on_line("[警告] 未找到 adb.exe:请安装 platform-tools 或将 adb 加入 PATH")
|
||||
|
||||
self._proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
errors="replace",
|
||||
env=env,
|
||||
cwd=os.path.dirname(__file__),
|
||||
)
|
||||
|
||||
def _reader():
|
||||
assert self._proc is not None
|
||||
out = self._proc.stdout
|
||||
if out is None:
|
||||
return
|
||||
for line in out:
|
||||
self._on_line(line.rstrip("\n"))
|
||||
rc = self._proc.wait()
|
||||
self._on_line(f"[进程结束] exit_code={rc}")
|
||||
|
||||
self._reader_thread = threading.Thread(target=_reader, daemon=True)
|
||||
self._reader_thread.start()
|
||||
|
||||
def start_test_yanghao_flow(self, device_id: str, seconds: int) -> None:
|
||||
if self.is_running():
|
||||
raise RuntimeError("已经在运行")
|
||||
|
||||
seconds = int(seconds or 0)
|
||||
if seconds <= 0:
|
||||
seconds = 90
|
||||
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(os.path.dirname(__file__), "run_cli.py"),
|
||||
"--test-yanghao-flow",
|
||||
"--test-yanghao-flow-seconds",
|
||||
str(seconds),
|
||||
]
|
||||
if device_id:
|
||||
cmd += ["--device-id", device_id]
|
||||
|
||||
env = os.environ.copy()
|
||||
env.setdefault("PYTHONIOENCODING", "utf-8")
|
||||
|
||||
adb_exe = find_adb_executable()
|
||||
if adb_exe:
|
||||
adb_dir = os.path.dirname(adb_exe)
|
||||
env["PATH"] = adb_dir + os.pathsep + env.get("PATH", "")
|
||||
env["ADB_EXECUTABLE"] = adb_exe
|
||||
else:
|
||||
self._on_line("[警告] 未找到 adb.exe:请安装 platform-tools 或将 adb 加入 PATH")
|
||||
|
||||
self._proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
errors="replace",
|
||||
env=env,
|
||||
cwd=os.path.dirname(__file__),
|
||||
)
|
||||
|
||||
def _reader():
|
||||
assert self._proc is not None
|
||||
out = self._proc.stdout
|
||||
if out is None:
|
||||
return
|
||||
for line in out:
|
||||
self._on_line(line.rstrip("\n"))
|
||||
rc = self._proc.wait()
|
||||
self._on_line(f"[进程结束] exit_code={rc}")
|
||||
|
||||
self._reader_thread = threading.Thread(target=_reader, daemon=True)
|
||||
self._reader_thread.start()
|
||||
|
||||
def stop(self) -> None:
|
||||
if not self.is_running():
|
||||
return
|
||||
assert self._proc is not None
|
||||
self._on_line("[停止] 正在终止进程...")
|
||||
self._proc.terminate()
|
||||
try:
|
||||
self._proc.wait(timeout=5)
|
||||
except subprocess.TimeoutExpired:
|
||||
self._on_line("[停止] 进程未退出,强制结束...")
|
||||
self._proc.kill()
|
||||
|
||||
|
||||
def main():
|
||||
# ttkbootstrap 优先(更美观);没装则回退到原生 tkinter
|
||||
try:
|
||||
import ttkbootstrap as tb
|
||||
from ttkbootstrap.scrolled import ScrolledText
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from ttkbootstrap.constants import LEFT, RIGHT, BOTH, X, Y
|
||||
|
||||
root = tb.Window(themename="darkly")
|
||||
except Exception:
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from tkinter.constants import LEFT, RIGHT, BOTH, X, Y
|
||||
from tkinter.scrolledtext import ScrolledText
|
||||
|
||||
root = tk.Tk()
|
||||
|
||||
root.title("抖音福袋挂机 - 可视化控制台")
|
||||
root.geometry("1180x760")
|
||||
|
||||
q: queue.Queue[str] = queue.Queue()
|
||||
|
||||
def on_line(line: str):
|
||||
q.put(line)
|
||||
|
||||
runner = Runner(on_line=on_line)
|
||||
|
||||
# 顶部:设备选择 + Y偏移(其余运行参数放到左侧分组,避免重复)
|
||||
top = ttk.Frame(root)
|
||||
top.pack(fill=X, padx=12, pady=10)
|
||||
|
||||
adb_exe = find_adb_executable()
|
||||
devices = list_adb_devices(adb_exe)
|
||||
device_var = tk.StringVar(value=(devices[0] if devices else ""))
|
||||
|
||||
ttk.Label(top, text="设备:").pack(side=LEFT)
|
||||
device_combo = ttk.Combobox(top, textvariable=device_var, values=devices, width=28)
|
||||
device_combo.pack(side=LEFT, padx=(0, 10))
|
||||
|
||||
def refresh_devices():
|
||||
nonlocal adb_exe
|
||||
adb_exe = find_adb_executable()
|
||||
devs = list_adb_devices(adb_exe)
|
||||
device_combo["values"] = devs
|
||||
if devs and not device_var.get():
|
||||
device_var.set(devs[0])
|
||||
if not adb_exe:
|
||||
on_line("[设备] 未找到 adb.exe(请确认已安装 platform-tools)")
|
||||
elif not devs:
|
||||
on_line("[设备] adb 可用,但未发现 device 状态设备(可能未授权/未连接)")
|
||||
|
||||
ttk.Button(top, text="刷新设备", command=refresh_devices).pack(side=LEFT, padx=(0, 20))
|
||||
|
||||
y_var = tk.IntVar(value=0)
|
||||
ttk.Label(top, text="Y偏移:").pack(side=LEFT)
|
||||
ttk.Spinbox(top, from_=-200, to=200, textvariable=y_var, width=6).pack(side=LEFT, padx=(0, 12))
|
||||
|
||||
# 中部:左侧配置 + 右侧日志/预览(支持拖拽调整宽度;左侧可滚动)
|
||||
mid = ttk.PanedWindow(root, orient="horizontal")
|
||||
mid.pack(fill=BOTH, expand=True, padx=12, pady=(0, 12))
|
||||
|
||||
left_wrap = ttk.Frame(mid)
|
||||
right = ttk.Frame(mid)
|
||||
mid.add(left_wrap, weight=0)
|
||||
mid.add(right, weight=1)
|
||||
|
||||
left_canvas = tk.Canvas(left_wrap, highlightthickness=0, borderwidth=0)
|
||||
left_scroll = ttk.Scrollbar(left_wrap, orient="vertical", command=left_canvas.yview)
|
||||
left_canvas.configure(yscrollcommand=left_scroll.set)
|
||||
left_scroll.pack(side=RIGHT, fill=Y)
|
||||
left_canvas.pack(side=LEFT, fill=BOTH, expand=True)
|
||||
|
||||
left = ttk.Frame(left_canvas)
|
||||
_left_win = left_canvas.create_window((0, 0), window=left, anchor="nw")
|
||||
|
||||
def _left_on_configure(_evt=None):
|
||||
left_canvas.configure(scrollregion=left_canvas.bbox("all"))
|
||||
|
||||
def _left_on_canvas_configure(evt):
|
||||
try:
|
||||
left_canvas.itemconfigure(_left_win, width=evt.width)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
left.bind("<Configure>", _left_on_configure)
|
||||
left_canvas.bind("<Configure>", _left_on_canvas_configure)
|
||||
|
||||
# 配置区
|
||||
cfg = read_config()
|
||||
needswitch_var = tk.BooleanVar(value=True)
|
||||
wait_minutes_var = tk.IntVar(value=5)
|
||||
|
||||
min_value_var = tk.DoubleVar(value=float(cfg.get("min_prize_value_yuan", 0) or 0))
|
||||
min_participants_var = tk.IntVar(value=int(cfg.get("min_participants", 0) or 0))
|
||||
max_participants_var = tk.IntVar(value=int(cfg.get("max_participants", 0) or 0))
|
||||
skip_lt_seconds_var = tk.IntVar(value=int(cfg.get("skip_if_countdown_lt_seconds", 15) or 15))
|
||||
reset_after_swipes_var = tk.IntVar(value=int(cfg.get("reset_after_swipes", 15) or 15))
|
||||
# 按需求:删除“自动养号/随机等待/轻微扰动/定时休息”等设置,仅保留“推荐页养号(爱心/收藏/评论)”配置。
|
||||
auto_join_var = tk.BooleanVar(value=bool(cfg.get("auto_join_fansclub", False)))
|
||||
fansclub_action_var = tk.StringVar(value=str(cfg.get("fansclub_fail_action", "stay") or "stay").lower())
|
||||
|
||||
# 推荐页养号:爱心/收藏/评论(基于图标模板匹配 + 坐标点击)
|
||||
yg_recommend_duration_var = tk.IntVar(value=int(cfg.get("yanghao_recommend_duration_seconds", 60) or 60))
|
||||
yg_recommend_interval_var = tk.IntVar(value=int(cfg.get("yanghao_recommend_interval_seconds", 0) or 0))
|
||||
yg_like_prob_var = tk.DoubleVar(value=float(cfg.get("yanghao_like_prob", 0.0) or 0.0))
|
||||
yg_fav_prob_var = tk.DoubleVar(value=float(cfg.get("yanghao_fav_prob", 0.0) or 0.0))
|
||||
yg_comment_prob_var = tk.DoubleVar(value=float(cfg.get("yanghao_comment_prob", 0.0) or 0.0))
|
||||
yg_icon_roi_size_var = tk.IntVar(value=int(cfg.get("yanghao_icon_roi_size", 240) or 240))
|
||||
yg_icon_match_threshold_var = tk.DoubleVar(value=float(cfg.get("yanghao_icon_match_threshold", 0.72) or 0.72))
|
||||
yg_step_screenshot_var = tk.BooleanVar(value=bool(cfg.get("yanghao_step_screenshot", False)))
|
||||
yg_like_roi_offset_x_var = tk.IntVar(value=int(cfg.get("yanghao_like_roi_offset_x", 0) or 0))
|
||||
yg_like_roi_offset_y_var = tk.IntVar(value=int(cfg.get("yanghao_like_roi_offset_y", 0) or 0))
|
||||
yg_fav_roi_offset_x_var = tk.IntVar(value=int(cfg.get("yanghao_fav_roi_offset_x", 0) or 0))
|
||||
yg_fav_roi_offset_y_var = tk.IntVar(value=int(cfg.get("yanghao_fav_roi_offset_y", 0) or 0))
|
||||
|
||||
run_box = ttk.LabelFrame(left, text="运行设置")
|
||||
run_box.pack(fill=X, pady=(0, 10))
|
||||
|
||||
r0 = ttk.Frame(run_box)
|
||||
r0.pack(fill=X, padx=10, pady=(10, 6))
|
||||
ttk.Checkbutton(r0, text="允许切换直播间", variable=needswitch_var).pack(side=LEFT)
|
||||
|
||||
r1 = ttk.Frame(run_box)
|
||||
r1.pack(fill=X, padx=10, pady=(0, 10))
|
||||
ttk.Label(r1, text="倒计时阈值(分钟):").pack(side=LEFT)
|
||||
ttk.Spinbox(r1, from_=1, to=60, textvariable=wait_minutes_var, width=6).pack(side=LEFT, padx=(0, 12))
|
||||
ttk.Label(r1, text="倒计时小于(秒)跳过:").pack(side=LEFT)
|
||||
ttk.Spinbox(r1, from_=0, to=120, textvariable=skip_lt_seconds_var, width=6).pack(side=LEFT)
|
||||
|
||||
r2 = ttk.Frame(run_box)
|
||||
r2.pack(fill=X, padx=10, pady=(0, 10))
|
||||
ttk.Label(r2, text="切换N次后回到第一个:").pack(side=LEFT)
|
||||
ttk.Spinbox(r2, from_=0, to=9999, textvariable=reset_after_swipes_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(r2, text="(0=不启用;触发后会下滑回退)").pack(side=LEFT)
|
||||
|
||||
# 说明:推荐页养号流程始终启用;具体养号动作请在下方“推荐页养号(爱心/收藏/评论)”配置。
|
||||
|
||||
yg_box = ttk.LabelFrame(left, text="推荐页养号(爱心/收藏/评论)")
|
||||
yg_box.pack(fill=X, pady=(0, 10))
|
||||
|
||||
yg0 = ttk.Frame(yg_box)
|
||||
yg0.pack(fill=X, padx=10, pady=(10, 8))
|
||||
ttk.Checkbutton(yg0, text="逐步截图(调试用,生成 pic/*/latest.png)", variable=yg_step_screenshot_var).pack(side=LEFT)
|
||||
|
||||
yg_time = ttk.Frame(yg_box)
|
||||
yg_time.pack(fill=X, padx=10, pady=(0, 8))
|
||||
ttk.Label(yg_time, text="养号时长(秒):").pack(side=LEFT)
|
||||
ttk.Spinbox(yg_time, from_=1, to=3600, increment=5, textvariable=yg_recommend_duration_var, width=8).pack(side=LEFT)
|
||||
ttk.Label(yg_time, text="养号间隔(秒):").pack(side=LEFT, padx=(12, 0))
|
||||
ttk.Spinbox(yg_time, from_=0, to=3600, increment=10, textvariable=yg_recommend_interval_var, width=8).pack(side=LEFT)
|
||||
ttk.Label(yg_time, text="(0=每次触发都执行)").pack(side=LEFT, padx=(6, 0))
|
||||
|
||||
yg1 = ttk.Frame(yg_box)
|
||||
yg1.pack(fill=X, padx=10, pady=(0, 8))
|
||||
ttk.Label(yg1, text="爱心概率:").pack(side=LEFT)
|
||||
ttk.Spinbox(yg1, from_=0.0, to=1.0, increment=0.05, textvariable=yg_like_prob_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg1, text="收藏概率:").pack(side=LEFT, padx=(10, 0))
|
||||
ttk.Spinbox(yg1, from_=0.0, to=1.0, increment=0.05, textvariable=yg_fav_prob_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg1, text="评论概率:").pack(side=LEFT, padx=(10, 0))
|
||||
ttk.Spinbox(yg1, from_=0.0, to=1.0, increment=0.05, textvariable=yg_comment_prob_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg1, text="(0~1)").pack(side=LEFT, padx=(6, 0))
|
||||
|
||||
yg2 = ttk.Frame(yg_box)
|
||||
yg2.pack(fill=X, padx=10, pady=(0, 8))
|
||||
ttk.Label(yg2, text="图标ROI大小(px):").pack(side=LEFT)
|
||||
ttk.Spinbox(yg2, from_=80, to=600, increment=10, textvariable=yg_icon_roi_size_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg2, text="匹配阈值:").pack(side=LEFT, padx=(10, 0))
|
||||
ttk.Spinbox(yg2, from_=0.0, to=1.0, increment=0.01, textvariable=yg_icon_match_threshold_var, width=6).pack(side=LEFT)
|
||||
|
||||
yg3 = ttk.Frame(yg_box)
|
||||
yg3.pack(fill=X, padx=10, pady=(0, 10))
|
||||
ttk.Label(yg3, text="爱心ROI偏移(x,y):").pack(side=LEFT)
|
||||
ttk.Spinbox(yg3, from_=-300, to=300, increment=5, textvariable=yg_like_roi_offset_x_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg3, text=",").pack(side=LEFT)
|
||||
ttk.Spinbox(yg3, from_=-300, to=300, increment=5, textvariable=yg_like_roi_offset_y_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg3, text=" 收藏ROI偏移(x,y):").pack(side=LEFT, padx=(10, 0))
|
||||
ttk.Spinbox(yg3, from_=-300, to=300, increment=5, textvariable=yg_fav_roi_offset_x_var, width=6).pack(side=LEFT)
|
||||
ttk.Label(yg3, text=",").pack(side=LEFT)
|
||||
ttk.Spinbox(yg3, from_=-300, to=300, increment=5, textvariable=yg_fav_roi_offset_y_var, width=6).pack(side=LEFT)
|
||||
|
||||
# 删除自动养号后,无需联动控件
|
||||
|
||||
cfg_box = ttk.LabelFrame(left, text="筛选设置")
|
||||
cfg_box.pack(fill=X, pady=(0, 10))
|
||||
|
||||
row = ttk.Frame(cfg_box)
|
||||
row.pack(fill=X, padx=10, pady=(10, 8))
|
||||
ttk.Label(row, text="最低价值(元):").pack(side=LEFT)
|
||||
ttk.Spinbox(row, from_=0, to=99999, increment=1, textvariable=min_value_var, width=10).pack(side=LEFT)
|
||||
|
||||
rowp = ttk.Frame(cfg_box)
|
||||
rowp.pack(fill=X, padx=10, pady=(0, 8))
|
||||
ttk.Label(rowp, text="参与人数范围:").pack(side=LEFT)
|
||||
ttk.Spinbox(rowp, from_=0, to=99999999, increment=1, textvariable=min_participants_var, width=10).pack(side=LEFT)
|
||||
ttk.Label(rowp, text=" ~ ").pack(side=LEFT)
|
||||
ttk.Spinbox(rowp, from_=0, to=99999999, increment=1, textvariable=max_participants_var, width=10).pack(side=LEFT)
|
||||
ttk.Label(rowp, text="(填0表示不限制)").pack(side=LEFT)
|
||||
|
||||
row2 = ttk.Frame(cfg_box)
|
||||
row2.pack(fill=X, padx=10, pady=(0, 8))
|
||||
ttk.Checkbutton(row2, text="自动加入粉丝团(谨慎:可能消耗钻石)", variable=auto_join_var).pack(side=LEFT)
|
||||
|
||||
row3 = ttk.Frame(cfg_box)
|
||||
row3.pack(fill=X, padx=10, pady=(0, 10))
|
||||
ttk.Label(row3, text="粉丝团失败策略:").pack(side=LEFT)
|
||||
ttk.Combobox(row3, textvariable=fansclub_action_var, values=["stay", "switch"], width=10, state="readonly").pack(side=LEFT)
|
||||
|
||||
kw_box = ttk.LabelFrame(left, text="关键词(每行一个)")
|
||||
kw_box.pack(fill=BOTH, expand=True)
|
||||
|
||||
ttk.Label(kw_box, text="想要 contains_want").pack(anchor="w", padx=10, pady=(8, 4))
|
||||
want_text = ScrolledText(kw_box, height=8)
|
||||
want_text.pack(fill=X, padx=10)
|
||||
|
||||
ttk.Label(kw_box, text="不想要 contains_not_want").pack(anchor="w", padx=10, pady=(10, 4))
|
||||
not_want_text = ScrolledText(kw_box, height=8)
|
||||
not_want_text.pack(fill=X, padx=10, pady=(0, 10))
|
||||
|
||||
def load_config_to_ui():
|
||||
nonlocal cfg
|
||||
cfg = read_config()
|
||||
yg_recommend_duration_var.set(int(cfg.get("yanghao_recommend_duration_seconds", 60) or 60))
|
||||
yg_recommend_interval_var.set(int(cfg.get("yanghao_recommend_interval_seconds", 0) or 0))
|
||||
min_value_var.set(float(cfg.get("min_prize_value_yuan", 0) or 0))
|
||||
min_participants_var.set(int(cfg.get("min_participants", 0) or 0))
|
||||
max_participants_var.set(int(cfg.get("max_participants", 0) or 0))
|
||||
skip_lt_seconds_var.set(int(cfg.get("skip_if_countdown_lt_seconds", 15) or 15))
|
||||
reset_after_swipes_var.set(int(cfg.get("reset_after_swipes", 15) or 15))
|
||||
# 自动养号相关配置已删除
|
||||
auto_join_var.set(bool(cfg.get("auto_join_fansclub", False)))
|
||||
fansclub_action_var.set(str(cfg.get("fansclub_fail_action", "stay") or "stay").lower())
|
||||
|
||||
yg_like_prob_var.set(float(cfg.get("yanghao_like_prob", 0.0) or 0.0))
|
||||
yg_fav_prob_var.set(float(cfg.get("yanghao_fav_prob", 0.0) or 0.0))
|
||||
yg_comment_prob_var.set(float(cfg.get("yanghao_comment_prob", 0.0) or 0.0))
|
||||
yg_icon_roi_size_var.set(int(cfg.get("yanghao_icon_roi_size", 240) or 240))
|
||||
yg_icon_match_threshold_var.set(float(cfg.get("yanghao_icon_match_threshold", 0.72) or 0.72))
|
||||
yg_step_screenshot_var.set(bool(cfg.get("yanghao_step_screenshot", False)))
|
||||
yg_like_roi_offset_x_var.set(int(cfg.get("yanghao_like_roi_offset_x", 0) or 0))
|
||||
yg_like_roi_offset_y_var.set(int(cfg.get("yanghao_like_roi_offset_y", 0) or 0))
|
||||
yg_fav_roi_offset_x_var.set(int(cfg.get("yanghao_fav_roi_offset_x", 0) or 0))
|
||||
yg_fav_roi_offset_y_var.set(int(cfg.get("yanghao_fav_roi_offset_y", 0) or 0))
|
||||
|
||||
want = cfg.get("contains_want", []) or []
|
||||
not_want = cfg.get("contains_not_want", []) or []
|
||||
want_text.delete("1.0", "end")
|
||||
want_text.insert("1.0", "\n".join(want))
|
||||
not_want_text.delete("1.0", "end")
|
||||
not_want_text.insert("1.0", "\n".join(not_want))
|
||||
|
||||
def save_ui_to_config():
|
||||
want_lines = [x.strip() for x in want_text.get("1.0", "end").splitlines() if x.strip()]
|
||||
not_want_lines = [x.strip() for x in not_want_text.get("1.0", "end").splitlines() if x.strip()]
|
||||
|
||||
cfg2 = read_config()
|
||||
cfg2["contains_want"] = want_lines
|
||||
cfg2["contains_not_want"] = not_want_lines
|
||||
cfg2["min_prize_value_yuan"] = float(min_value_var.get() or 0)
|
||||
cfg2["min_participants"] = int(min_participants_var.get() or 0)
|
||||
cfg2["max_participants"] = int(max_participants_var.get() or 0)
|
||||
cfg2["skip_if_countdown_lt_seconds"] = int(skip_lt_seconds_var.get() or 15)
|
||||
cfg2["reset_after_swipes"] = int(reset_after_swipes_var.get() or 0)
|
||||
# 自动养号相关配置已删除(推荐页养号流程在程序内固定启用)
|
||||
cfg2["auto_join_fansclub"] = bool(auto_join_var.get())
|
||||
cfg2["fansclub_fail_action"] = str(fansclub_action_var.get() or "stay").lower()
|
||||
|
||||
cfg2["yanghao_recommend_duration_seconds"] = int(yg_recommend_duration_var.get() or 60)
|
||||
cfg2["yanghao_recommend_interval_seconds"] = int(yg_recommend_interval_var.get() or 0)
|
||||
cfg2["yanghao_like_prob"] = float(yg_like_prob_var.get() or 0.0)
|
||||
cfg2["yanghao_fav_prob"] = float(yg_fav_prob_var.get() or 0.0)
|
||||
cfg2["yanghao_comment_prob"] = float(yg_comment_prob_var.get() or 0.0)
|
||||
cfg2["yanghao_icon_roi_size"] = int(yg_icon_roi_size_var.get() or 240)
|
||||
cfg2["yanghao_icon_match_threshold"] = float(yg_icon_match_threshold_var.get() or 0.72)
|
||||
cfg2["yanghao_step_screenshot"] = bool(yg_step_screenshot_var.get())
|
||||
cfg2["yanghao_like_roi_offset_x"] = int(yg_like_roi_offset_x_var.get() or 0)
|
||||
cfg2["yanghao_like_roi_offset_y"] = int(yg_like_roi_offset_y_var.get() or 0)
|
||||
cfg2["yanghao_fav_roi_offset_x"] = int(yg_fav_roi_offset_x_var.get() or 0)
|
||||
cfg2["yanghao_fav_roi_offset_y"] = int(yg_fav_roi_offset_y_var.get() or 0)
|
||||
write_config(cfg2)
|
||||
on_line("[配置] 已保存到 config.json")
|
||||
|
||||
load_config_to_ui()
|
||||
|
||||
btns = ttk.Frame(left)
|
||||
btns.pack(fill=X, pady=(10, 0))
|
||||
ttk.Button(btns, text="加载配置", command=load_config_to_ui).pack(side=LEFT, padx=(0, 8))
|
||||
ttk.Button(btns, text="保存配置", command=save_ui_to_config).pack(side=LEFT)
|
||||
|
||||
# 右侧:Notebook(日志 / 截图预览)
|
||||
notebook = ttk.Notebook(right)
|
||||
notebook.pack(fill=BOTH, expand=True)
|
||||
|
||||
log_tab = ttk.Frame(notebook)
|
||||
preview_tab = ttk.Frame(notebook)
|
||||
notebook.add(log_tab, text="运行日志")
|
||||
notebook.add(preview_tab, text="截图预览")
|
||||
|
||||
# 日志区
|
||||
log_box = ttk.Frame(log_tab)
|
||||
log_box.pack(fill=BOTH, expand=True)
|
||||
log_text = ScrolledText(log_box)
|
||||
try:
|
||||
log_text.configure(font=("Consolas", 10))
|
||||
except Exception:
|
||||
pass
|
||||
log_text.pack(fill=BOTH, expand=True, padx=10, pady=10)
|
||||
|
||||
# 截图预览
|
||||
preview_top = ttk.Frame(preview_tab)
|
||||
preview_top.pack(fill=X, padx=10, pady=10)
|
||||
|
||||
images_dir = os.path.join(os.path.dirname(__file__), "pic")
|
||||
image_choices = [
|
||||
"screenshot.png",
|
||||
"fudai_content.png",
|
||||
"fudai_countdown.png",
|
||||
"fudai_value.png",
|
||||
"zhibo_yanzheng.png",
|
||||
]
|
||||
image_var = tk.StringVar(value="fudai_value.png")
|
||||
|
||||
ttk.Label(preview_top, text="选择图片:").pack(side=LEFT)
|
||||
# 允许手工输入子路径(例如 start/latest.png),方便查看逐步截图
|
||||
ttk.Combobox(preview_top, textvariable=image_var, values=image_choices, width=24, state="normal").pack(
|
||||
side=LEFT, padx=(0, 10)
|
||||
)
|
||||
|
||||
preview_status = tk.StringVar(value="")
|
||||
ttk.Label(preview_top, textvariable=preview_status).pack(side=RIGHT)
|
||||
|
||||
preview_body = ttk.Frame(preview_tab)
|
||||
preview_body.pack(fill=BOTH, expand=True, padx=10, pady=(0, 10))
|
||||
|
||||
image_label = ttk.Label(preview_body)
|
||||
image_label.pack(fill=BOTH, expand=True)
|
||||
_img_ref = {"photo": None} # 防止 PhotoImage 被回收
|
||||
|
||||
def _load_and_fit_image(img_path: str):
|
||||
if not os.path.exists(img_path):
|
||||
preview_status.set(f"未找到:{os.path.basename(img_path)}")
|
||||
image_label.configure(image="")
|
||||
_img_ref["photo"] = None
|
||||
return
|
||||
|
||||
img = Image.open(img_path).convert("RGB")
|
||||
w = preview_body.winfo_width() or 900
|
||||
h = preview_body.winfo_height() or 520
|
||||
max_w = max(300, w - 20)
|
||||
max_h = max(200, h - 20)
|
||||
img.thumbnail((max_w, max_h), Image.LANCZOS)
|
||||
photo = ImageTk.PhotoImage(img)
|
||||
_img_ref["photo"] = photo
|
||||
image_label.configure(image=photo)
|
||||
preview_status.set(f"{os.path.basename(img_path)} {img.width}x{img.height}")
|
||||
|
||||
def refresh_preview():
|
||||
name = image_var.get().strip() or "fudai_value.png"
|
||||
path = os.path.join(images_dir, name)
|
||||
_load_and_fit_image(path)
|
||||
|
||||
ttk.Button(preview_top, text="刷新预览", command=refresh_preview).pack(side=LEFT)
|
||||
|
||||
def open_pic_folder():
|
||||
try:
|
||||
os.makedirs(images_dir, exist_ok=True)
|
||||
os.startfile(images_dir) # type: ignore[attr-defined]
|
||||
except Exception as e:
|
||||
on_line(f"[预览] 打开图片目录失败:{e}")
|
||||
|
||||
ttk.Button(preview_top, text="打开pic目录", command=open_pic_folder).pack(side=LEFT, padx=(10, 0))
|
||||
|
||||
status_var = tk.StringVar(value="就绪")
|
||||
|
||||
def get_params() -> RunParams:
|
||||
return RunParams(
|
||||
device_id=device_var.get().strip(),
|
||||
y_pianyi=int(y_var.get()),
|
||||
needswitch=bool(needswitch_var.get()),
|
||||
wait_minutes=int(wait_minutes_var.get()),
|
||||
skip_if_countdown_lt_seconds=int(skip_lt_seconds_var.get() or 15),
|
||||
reset_after_swipes=int(reset_after_swipes_var.get() or 0),
|
||||
min_prize_value_yuan=float(min_value_var.get() or 0),
|
||||
min_participants=int(min_participants_var.get() or 0),
|
||||
max_participants=int(max_participants_var.get() or 0),
|
||||
auto_join_fansclub=bool(auto_join_var.get()),
|
||||
fansclub_fail_action=str(fansclub_action_var.get() or "stay").lower(),
|
||||
)
|
||||
|
||||
def start_run():
|
||||
if runner.is_running():
|
||||
on_line("[运行] 已在运行中")
|
||||
return
|
||||
save_ui_to_config()
|
||||
params = get_params()
|
||||
on_line(
|
||||
f"[运行] 启动:device={params.device_id or '(auto)'} y={params.y_pianyi} "
|
||||
f"needswitch={params.needswitch} wait={params.wait_minutes}m "
|
||||
f"skip_lt={params.skip_if_countdown_lt_seconds}s reset_after={params.reset_after_swipes} "
|
||||
f"value>={params.min_prize_value_yuan} participants=[{params.min_participants},{params.max_participants}] "
|
||||
f"yanghao=recommend_flow_only"
|
||||
)
|
||||
status_var.set("运行中")
|
||||
try:
|
||||
runner.start(params)
|
||||
except Exception as e:
|
||||
status_var.set("启动失败")
|
||||
on_line(f"[错误] {e}")
|
||||
|
||||
def stop_run():
|
||||
runner.stop()
|
||||
status_var.set("已停止")
|
||||
|
||||
actions = ttk.Frame(right)
|
||||
actions.pack(fill=X, pady=(10, 0))
|
||||
|
||||
ttk.Button(actions, text="开始运行", command=start_run).pack(side=LEFT, padx=(0, 8))
|
||||
ttk.Button(actions, text="停止", command=stop_run).pack(side=LEFT)
|
||||
|
||||
ttk.Separator(actions, orient="vertical").pack(side=LEFT, fill=Y, padx=10, pady=3)
|
||||
test_seconds_var = tk.IntVar(value=int(cfg.get("yanghao_recommend_duration_seconds", 60) or 60))
|
||||
ttk.Label(actions, text="测试养号(秒):").pack(side=LEFT)
|
||||
ttk.Spinbox(actions, from_=10, to=3600, increment=10, textvariable=test_seconds_var, width=8).pack(side=LEFT, padx=(0, 8))
|
||||
|
||||
def start_test_yanghao():
|
||||
if runner.is_running():
|
||||
on_line("[运行] 已在运行中")
|
||||
return
|
||||
save_ui_to_config()
|
||||
secs = int(test_seconds_var.get() or 90)
|
||||
dev = device_var.get().strip()
|
||||
on_line(f"[测试] 启动养号流程:device={dev or '(auto)'} seconds={secs}")
|
||||
status_var.set("运行中")
|
||||
try:
|
||||
runner.start_test_yanghao_flow(dev, secs)
|
||||
except Exception as e:
|
||||
status_var.set("启动失败")
|
||||
on_line(f"[错误] {e}")
|
||||
|
||||
ttk.Button(actions, text="测试养号流程", command=start_test_yanghao).pack(side=LEFT)
|
||||
ttk.Label(actions, textvariable=status_var).pack(side=RIGHT)
|
||||
|
||||
def pump_logs():
|
||||
changed = False
|
||||
try:
|
||||
while True:
|
||||
line = q.get_nowait()
|
||||
log_text.insert("end", line + "\n")
|
||||
log_text.see("end")
|
||||
changed = True
|
||||
except queue.Empty:
|
||||
pass
|
||||
|
||||
if changed and not runner.is_running() and status_var.get() == "运行中":
|
||||
status_var.set("已结束")
|
||||
|
||||
root.after(100, pump_logs)
|
||||
|
||||
pump_logs()
|
||||
root.after(300, refresh_preview)
|
||||
|
||||
def on_close():
|
||||
try:
|
||||
runner.stop()
|
||||
except Exception:
|
||||
pass
|
||||
root.destroy()
|
||||
|
||||
root.protocol("WM_DELETE_WINDOW", on_close)
|
||||
refresh_devices()
|
||||
root.mainloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
from version import print_version_banner
|
||||
|
||||
print_version_banner("gui_app")
|
||||
except Exception:
|
||||
pass
|
||||
main()
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
# 在导入 PaddleOCR 之前设置,避免每次启动都做连通性检查提示并抑制底层 glog/oneDNN 等噪音
|
||||
# DISABLE_MODEL_SOURCE_CHECK: 跳过 PaddleOCR 的主机连通性检查(国内网络环境常卡)
|
||||
# GLOG_minloglevel: 2 -> ERROR 及以上,屏蔽 INFO/WARNING
|
||||
# OMP_NUM_THREADS: 设为 1,避免 oneDNN 打印线程信息
|
||||
os.environ.setdefault("DISABLE_MODEL_SOURCE_CHECK", "True")
|
||||
os.environ.setdefault("GLOG_minloglevel", "2")
|
||||
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
||||
|
||||
from douyin_fudai import fudai_analyse
|
||||
|
||||
|
||||
def ensure_adb_in_path() -> None:
|
||||
if shutil.which("adb"):
|
||||
return
|
||||
localapp = os.environ.get("LOCALAPPDATA") or ""
|
||||
candidates = []
|
||||
if localapp:
|
||||
candidates.append(os.path.join(localapp, "platform-tools"))
|
||||
userprofile = os.environ.get("USERPROFILE") or ""
|
||||
if userprofile:
|
||||
candidates.append(os.path.join(userprofile, "AppData", "Local", "platform-tools"))
|
||||
for d in candidates:
|
||||
adb_exe = os.path.join(d, "adb.exe")
|
||||
if os.path.exists(adb_exe):
|
||||
os.environ["PATH"] = d + os.pathsep + os.environ.get("PATH", "")
|
||||
os.environ.setdefault("ADB_EXECUTABLE", adb_exe)
|
||||
return
|
||||
|
||||
|
||||
def parse_args(argv: list[str]) -> argparse.Namespace:
|
||||
p = argparse.ArgumentParser(description="Douyin 福袋挂机运行器(供 GUI 调用)")
|
||||
p.add_argument("--device-id", default="", help="ADB 设备 ID(为空则自动选择)")
|
||||
p.add_argument("--y-pianyi", type=int, default=0, help="y 轴偏移(通常 -50~50)")
|
||||
p.add_argument("--needswitch", action="store_true", help="是否允许上划切换直播间")
|
||||
p.add_argument("--wait-minutes", type=int, default=5, help="倒计时超过该分钟则切换(needswitch 生效)")
|
||||
p.add_argument("--test-yanghao-flow", action="store_true", help="测试:只执行一次推荐页养号流程并退出")
|
||||
p.add_argument("--test-yanghao-flow-seconds", type=int, default=10, help="测试:推荐页养号停留秒数")
|
||||
|
||||
p.add_argument("--test-comment", action="store_true", help="测试:按配置坐标执行一次评论输入+键盘确认发送并退出")
|
||||
p.add_argument("--test-comment-text", default="测试评论123", help="测试评论内容")
|
||||
|
||||
# 允许从 GUI 覆盖关键配置(不改动 config.json 也能生效)
|
||||
p.add_argument("--min-prize-value-yuan", type=float, default=None, help="最低奖品价值(元),低于则不参与")
|
||||
p.add_argument("--min-participants", type=int, default=None, help="最少参与人数(0/空表示不启用)")
|
||||
p.add_argument("--max-participants", type=int, default=None, help="最多参与人数(0/空表示不启用)")
|
||||
p.add_argument("--skip-if-countdown-lt-seconds", type=int, default=None, help="倒计时小于该秒数则不参与(needswitch 生效)")
|
||||
p.add_argument(
|
||||
"--reset-after-swipes",
|
||||
type=int,
|
||||
default=None,
|
||||
help="切换直播间达到该次数后,在直播间页面下滑回退到本轮第一个直播间(需配合 --reset-after-swipes-enabled)",
|
||||
)
|
||||
p.add_argument("--reset-after-swipes-enabled", action="store_true", help="开启切换次数阈值回退到第一个直播间")
|
||||
p.add_argument("--reset-after-swipes-disabled", action="store_true", help="关闭切换次数阈值回退到第一个直播间")
|
||||
|
||||
# 高价值直播间回访运行时开关(GUI 可在启动时传参覆盖)
|
||||
p.add_argument("--high-value-room-revisit-enabled", action="store_true", help="启用高价值直播间定时回访")
|
||||
p.add_argument("--high-value-room-revisit-disabled", action="store_true", help="禁用高价值直播间定时回访")
|
||||
p.add_argument("--high-value-room-revisit-only-current-run", action="store_true", help="仅回访本次运行记录的高价值直播间")
|
||||
p.add_argument("--reservation-back-verify-enabled", action="store_true", help="启用回退后预约校验(默认启用)")
|
||||
p.add_argument("--reservation-back-verify-disabled", action="store_true", help="禁用回退后预约校验")
|
||||
|
||||
# 按需求:删除“自动养号/随机等待/轻微扰动”等参数,仅保留“推荐页养号流程”。
|
||||
# 推荐页养号的动作/概率/阈值等由 config.json 控制(GUI 会保存)。
|
||||
p.add_argument("--auto-join-fansclub", action="store_true", help="自动尝试加入粉丝团(可能消耗钻石)")
|
||||
p.add_argument("--fansclub-fail-action", choices=["stay", "switch"], default=None,
|
||||
help="粉丝团门槛无法处理时:stay=停留当前直播间;switch=切换下一个")
|
||||
|
||||
return p.parse_args(argv)
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
ensure_adb_in_path()
|
||||
args = parse_args(argv)
|
||||
|
||||
# 让命令行输出更稳定(实时刷新 + UTF-8)
|
||||
try:
|
||||
sys.stdout.reconfigure(encoding="utf-8", line_buffering=True)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
sys.stderr.reconfigure(encoding="utf-8", line_buffering=True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if bool(getattr(args, "test_yanghao_flow", False)) or bool(getattr(args, "test_comment", False)):
|
||||
os.environ.setdefault("SKIP_OCR_INIT", "1")
|
||||
os.environ.setdefault("NO_TEE_STDOUT", "1")
|
||||
os.environ.setdefault("FAST_UI", "1")
|
||||
os.environ.setdefault("YANGHAO_STEP_SCREENSHOT", "1")
|
||||
|
||||
analyser = fudai_analyse()
|
||||
|
||||
# 测试模式:直接执行一次“评论输入+键盘确认发送”
|
||||
if bool(getattr(args, "test_comment", False)):
|
||||
device_id = (args.device_id or "").strip() or analyser.operation.select_device()
|
||||
if not device_id:
|
||||
print("未检测到设备,测试退出")
|
||||
return 2
|
||||
analyser.device_id = device_id
|
||||
analyser.y_pianyi = int(args.y_pianyi or 0)
|
||||
analyser.resolution_ratio_x, analyser.resolution_ratio_y = analyser.operation.get_device_resolution(device_id)
|
||||
print("[TEST-COMMENT] device_id={} res={}x{}".format(device_id, analyser.resolution_ratio_x, analyser.resolution_ratio_y))
|
||||
|
||||
msg = str(getattr(args, "test_comment_text", "测试评论123") or "测试评论123")
|
||||
# 逐步截图
|
||||
analyser._save_step_screenshot("test_comment_start")
|
||||
|
||||
def _scaled_click(base_x: int, base_y: int) -> None:
|
||||
sx, sy = analyser._scale_from_base(int(base_x), int(base_y))
|
||||
analyser.operation.click(device_id, sx, sy)
|
||||
|
||||
try:
|
||||
_scaled_click(analyser.yanghao_comment_btn_x, analyser.yanghao_comment_btn_y)
|
||||
analyser.operation.delay(1)
|
||||
analyser._save_step_screenshot("test_comment_after_open")
|
||||
|
||||
_scaled_click(analyser.yanghao_comment_input_x, analyser.yanghao_comment_input_y)
|
||||
analyser.operation.delay(1)
|
||||
analyser._save_step_screenshot("test_comment_after_focus")
|
||||
|
||||
ix, iy = analyser._scale_from_base(int(analyser.yanghao_comment_input_x), int(analyser.yanghao_comment_input_y))
|
||||
ok_input = bool(analyser.operation.paste_text_at(device_id, ix, iy, msg))
|
||||
print("[TEST-COMMENT] input {}".format("OK" if ok_input else "FAIL"))
|
||||
analyser.operation.delay(1)
|
||||
analyser._save_step_screenshot("test_comment_after_input")
|
||||
|
||||
ok_send = bool(analyser.operation.confirm_from_keyboard(device_id))
|
||||
print("[TEST-COMMENT] send {}".format("OK" if ok_send else "FAIL"))
|
||||
analyser.operation.delay(1)
|
||||
analyser._save_step_screenshot("test_comment_after_send")
|
||||
|
||||
_scaled_click(analyser.yanghao_comment_close_x, analyser.yanghao_comment_close_y)
|
||||
analyser.operation.delay(1)
|
||||
analyser._save_step_screenshot("test_comment_after_close")
|
||||
except Exception as e:
|
||||
print("[TEST-COMMENT] failed: {}".format(e))
|
||||
return 3
|
||||
|
||||
print("[TEST-COMMENT] done")
|
||||
return 0
|
||||
|
||||
# 测试模式:直接跑一次“推荐页养号流程”用于验证是否能点到关键按钮
|
||||
if bool(getattr(args, "test_yanghao_flow", False)):
|
||||
device_id = (args.device_id or "").strip() or analyser.operation.select_device()
|
||||
if not device_id:
|
||||
print("未检测到设备,测试退出")
|
||||
return 2
|
||||
analyser.device_id = device_id
|
||||
analyser.y_pianyi = int(args.y_pianyi or 0)
|
||||
analyser.resolution_ratio_x, analyser.resolution_ratio_y = analyser.operation.get_device_resolution(device_id)
|
||||
analyser.yanghao_use_recommend_flow = True
|
||||
print("[TEST] device_id={} res={}x{}".format(device_id, analyser.resolution_ratio_x, analyser.resolution_ratio_y))
|
||||
seconds = int(getattr(args, "test_yanghao_flow_seconds", 10) or 10)
|
||||
if seconds < 1:
|
||||
seconds = 1
|
||||
analyser._yanghao_recommend_flow(seconds)
|
||||
print("[TEST] done")
|
||||
return 0
|
||||
|
||||
if args.min_prize_value_yuan is not None:
|
||||
analyser.min_prize_value_yuan = float(args.min_prize_value_yuan)
|
||||
if args.min_participants is not None:
|
||||
analyser.min_participants = int(args.min_participants or 0)
|
||||
if args.max_participants is not None:
|
||||
analyser.max_participants = int(args.max_participants or 0)
|
||||
if args.skip_if_countdown_lt_seconds is not None:
|
||||
analyser.skip_if_countdown_lt_seconds = int(args.skip_if_countdown_lt_seconds or 15)
|
||||
if args.reset_after_swipes is not None:
|
||||
analyser.reset_after_swipes = max(1, int(args.reset_after_swipes or 0))
|
||||
analyser.reset_after_swipes_enabled = True
|
||||
if args.reset_after_swipes_enabled:
|
||||
analyser.reset_after_swipes_enabled = True
|
||||
if args.reset_after_swipes_disabled:
|
||||
analyser.reset_after_swipes_enabled = False
|
||||
if args.auto_join_fansclub:
|
||||
analyser.auto_join_fansclub = True
|
||||
if args.fansclub_fail_action is not None:
|
||||
analyser.fansclub_fail_action = args.fansclub_fail_action
|
||||
# 高价值直播间回访开关(优先级:命令行 > config)
|
||||
if getattr(args, "high_value_room_revisit_enabled", False):
|
||||
analyser.high_value_room_revisit_enabled = True
|
||||
if getattr(args, "high_value_room_revisit_disabled", False):
|
||||
analyser.high_value_room_revisit_enabled = False
|
||||
if getattr(args, "high_value_room_revisit_only_current_run", False):
|
||||
analyser.high_value_room_revisit_only_current_run = True
|
||||
# 预约回退校验开关(命令行优先)
|
||||
if getattr(args, "reservation_back_verify_enabled", False):
|
||||
analyser.reservation_back_verify_enabled = True
|
||||
if getattr(args, "reservation_back_verify_disabled", False):
|
||||
analyser.reservation_back_verify_enabled = False
|
||||
|
||||
device_id = args.device_id.strip() if args.device_id else ""
|
||||
if not device_id:
|
||||
device_id = analyser.operation.select_device()
|
||||
|
||||
if not device_id:
|
||||
print("未检测到设备,退出。")
|
||||
return 2
|
||||
|
||||
analyser.fudai_choujiang(
|
||||
device_id=device_id,
|
||||
y_pianyi=args.y_pianyi,
|
||||
needswitch=bool(args.needswitch),
|
||||
wait_minutes=int(args.wait_minutes),
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
from version import print_version_banner
|
||||
|
||||
print_version_banner("run_cli")
|
||||
except Exception:
|
||||
pass
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
@@ -0,0 +1,411 @@
|
||||
{
|
||||
"updated_ts": 1765793514.5361085,
|
||||
"reason": "reservation",
|
||||
"total": 22,
|
||||
"rooms": [
|
||||
{
|
||||
"first_seen_ts": 1765787027.4476137,
|
||||
"last_seen_ts": 1765793514.5361085,
|
||||
"seen_count": 6,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765793514.5361085,
|
||||
"room_title_raw_last": "三火孙...",
|
||||
"alias_raw": [
|
||||
"三火孙...",
|
||||
"三火·孙.."
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【三火专属】新国标成人代步男女自行电车通用休闲.",
|
||||
"last_prize_value_yuan": 1699.0,
|
||||
"max_prize_value_yuan": 1699.0,
|
||||
"room_title": "三火孙"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765793164.28917,
|
||||
"last_seen_ts": 1765793164.28917,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1765793164.28917,
|
||||
"room_title_raw_last": "三火孙流行乐主播新",
|
||||
"alias_raw": [
|
||||
"三火孙流行乐主播新"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【三火专属】新国标成人代步男女自行电车通用休闲.",
|
||||
"last_prize_value_yuan": 1699.0,
|
||||
"max_prize_value_yuan": 1699.0,
|
||||
"room_title": "三火孙流行乐主播新"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765736209.4437785,
|
||||
"last_seen_ts": 1765792379.2718184,
|
||||
"seen_count": 7,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1765792379.2718184,
|
||||
"room_title_raw_last": "梵象名品...",
|
||||
"alias_raw": [
|
||||
"梵象名品..."
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "Camudin黑水鬼系列黑盘钢带款附带调表器",
|
||||
"last_prize_value_yuan": 999.0,
|
||||
"max_prize_value_yuan": 5500.0,
|
||||
"room_title": "梵象名品"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765768902.1252618,
|
||||
"last_seen_ts": 1765792008.9897602,
|
||||
"seen_count": 7,
|
||||
"pos_seen": 3,
|
||||
"pos_updated_ts": 1765792008.9897602,
|
||||
"room_title_raw_last": "凡客陈年?",
|
||||
"alias_raw": [
|
||||
"凡客陈年?",
|
||||
"凡客陈年"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "小米RedmiPadSE新款平板11英寸护眼大屏全金属...",
|
||||
"last_prize_value_yuan": 1199.0,
|
||||
"max_prize_value_yuan": 1199.0,
|
||||
"room_title": "凡客陈年"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765791974.5564253,
|
||||
"last_seen_ts": 1765791974.5564253,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 2,
|
||||
"pos_updated_ts": 1765791974.5564253,
|
||||
"room_title_raw_last": "JRS抖音旗舰",
|
||||
"alias_raw": [
|
||||
"JRS抖音旗舰"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水实时查找安全呵护【颜色",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "JRS抖音旗舰"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765790074.5321088,
|
||||
"last_seen_ts": 1765791144.673664,
|
||||
"seen_count": 3,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765791144.673664,
|
||||
"room_title_raw_last": "华奢名品",
|
||||
"alias_raw": [
|
||||
"华奢名品"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "SHIFAN手表",
|
||||
"last_prize_value_yuan": 1288.0,
|
||||
"max_prize_value_yuan": 1288.0,
|
||||
"room_title": "华奢名品"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765790812.2128222,
|
||||
"last_seen_ts": 1765790812.2128222,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 2,
|
||||
"pos_updated_ts": 1765790812.2128222,
|
||||
"room_title_raw_last": "UT抖音旗舰",
|
||||
"alias_raw": [
|
||||
"UT抖音旗舰"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水实时查找安全呵护【颜色",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "UT抖音旗舰"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765789941.5150285,
|
||||
"last_seen_ts": 1765789941.5150285,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765789941.5150285,
|
||||
"room_title_raw_last": "00抖音旗舰",
|
||||
"alias_raw": [
|
||||
"00抖音旗舰"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【粉丝专属】福联想平板电脑10.1英寸大屏护眼学习娱.",
|
||||
"last_prize_value_yuan": 1999.0,
|
||||
"max_prize_value_yuan": 1999.0,
|
||||
"room_title": "00抖音旗舰"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765788832.21326,
|
||||
"last_seen_ts": 1765788832.21326,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 2,
|
||||
"pos_updated_ts": 1765788832.21326,
|
||||
"room_title_raw_last": "千惠?任",
|
||||
"alias_raw": [
|
||||
"千惠?任"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "小米红米/redmi14C智能手机",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "千惠任"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765788758.527328,
|
||||
"last_seen_ts": 1765788758.527328,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765788758.527328,
|
||||
"room_title_raw_last": "三火孙..流行乐主播模TOP",
|
||||
"alias_raw": [
|
||||
"三火孙..流行乐主播模TOP"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【三火专属】新国标成人代步男女自行电车通用休闲.",
|
||||
"last_prize_value_yuan": 1699.0,
|
||||
"max_prize_value_yuan": 1699.0,
|
||||
"room_title": "三火孙流行乐主播模TOP"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765777950.5447316,
|
||||
"last_seen_ts": 1765787324.5717726,
|
||||
"seen_count": 9,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765787324.5717726,
|
||||
"room_title_raw_last": "云上珠宝",
|
||||
"alias_raw": [
|
||||
"云上珠宝..",
|
||||
"云上珠宝...",
|
||||
"云上珠宝"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "黄金足金古法手镯-约3.5克【圈口随机发】",
|
||||
"last_prize_value_yuan": 3500.0,
|
||||
"max_prize_value_yuan": 5999.0,
|
||||
"room_title": "云上珠宝"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765772560.378592,
|
||||
"last_seen_ts": 1765786243.9525945,
|
||||
"seen_count": 10,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1765786243.9525945,
|
||||
"room_title_raw_last": "彩虹夫妇.2道天团1291.",
|
||||
"alias_raw": [
|
||||
"彩虹夫妇.2道天团1291.",
|
||||
"彩虹夫妇..2道天团",
|
||||
"彩虹夫妇..?",
|
||||
"彩虹夫妇.2馄直天团987.万",
|
||||
"彩虹夫妇..",
|
||||
"彩虹夫妇"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【彩虹夫妇专属】适用于苹/果17256颜色随机",
|
||||
"last_prize_value_yuan": 6999.0,
|
||||
"max_prize_value_yuan": 6999.0,
|
||||
"room_title": "彩虹夫妇",
|
||||
"alias_norm": [
|
||||
"彩虹夫妇2道天团1291",
|
||||
"彩虹夫妇2道天团",
|
||||
"彩虹夫妇2馄直天团987万"
|
||||
],
|
||||
"merged_from_last": "彩虹夫妇2道天团1291",
|
||||
"merged_ratio_last": 0.86
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765777832.5013368,
|
||||
"last_seen_ts": 1765782102.7063458,
|
||||
"seen_count": 4,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1765782102.7063458,
|
||||
"room_title_raw_last": "预选100枝梅14.",
|
||||
"alias_raw": [
|
||||
"预选100枝梅14.",
|
||||
"预选100一枝梅14...",
|
||||
"源送100一枝梅14.",
|
||||
"预送100枝梅",
|
||||
"预送100枝梅14..."
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【梅姐专属】红米Redmi9A4+64G智能手机全新正品",
|
||||
"last_prize_value_yuan": 999.0,
|
||||
"max_prize_value_yuan": 5999.0,
|
||||
"room_title": "预送100枝梅14",
|
||||
"alias_norm": [
|
||||
"预选100枝梅14",
|
||||
"预选100一枝梅14",
|
||||
"源送100一枝梅14",
|
||||
"预送100枝梅"
|
||||
],
|
||||
"merged_from_last": "预选100枝梅14",
|
||||
"merged_ratio_last": 0.8888888888888888
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765772781.066824,
|
||||
"last_seen_ts": 1765782058.454188,
|
||||
"seen_count": 5,
|
||||
"pos_seen": 3,
|
||||
"pos_updated_ts": 1765782058.454188,
|
||||
"room_title_raw_last": "多余和毛优质主播",
|
||||
"alias_raw": [
|
||||
"多余和毛优质主播"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【毛毛姐专属】适用苹果17手机",
|
||||
"last_prize_value_yuan": 5999.0,
|
||||
"max_prize_value_yuan": 5999.0,
|
||||
"room_title": "多余和毛优质主播"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765768936.3513777,
|
||||
"last_seen_ts": 1765778794.3641992,
|
||||
"seen_count": 5,
|
||||
"pos_seen": 1,
|
||||
"pos_updated_ts": 1765778794.3641992,
|
||||
"room_title_raw_last": "彩虹夫妇直天团",
|
||||
"alias_raw": [
|
||||
"彩虹夫妇?道天团",
|
||||
"彩虹夫妇道天团",
|
||||
"彩虹夫妇",
|
||||
"彩虹夫妇.",
|
||||
"彩虹夫妇直天团"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【彩虹夫妇专属】适用于苹/果17256颜色随机",
|
||||
"last_prize_value_yuan": 0.0,
|
||||
"max_prize_value_yuan": 6999.0,
|
||||
"alias_norm": [
|
||||
"彩虹夫妇道天团",
|
||||
"彩虹夫妇"
|
||||
],
|
||||
"merged_from_last": "彩虹夫妇",
|
||||
"merged_ratio_last": 0.86,
|
||||
"room_title": "彩虹夫妇直天团"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765772163.6234417,
|
||||
"last_seen_ts": 1765776050.9045503,
|
||||
"seen_count": 14,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765776050.9045503,
|
||||
"room_title_raw_last": "大大小小...",
|
||||
"alias_raw": [
|
||||
"大大小小..",
|
||||
"大大小小",
|
||||
"大大小小..."
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【大大小小专属】iipad9256全新平板电脑颜色随机",
|
||||
"last_prize_value_yuan": 2999.0,
|
||||
"max_prize_value_yuan": 2999.0,
|
||||
"room_title": "大大小小"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765734737.806301,
|
||||
"last_seen_ts": 1765737390.252383,
|
||||
"seen_count": 2,
|
||||
"pos_seen": 4,
|
||||
"pos_updated_ts": 1765737390.252383,
|
||||
"room_title_raw_last": "作业帮数d季·双",
|
||||
"alias_raw": [
|
||||
"作业帮数d季·双"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水2实时查找安全呵护【颜色",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "作业帮数d季双"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765736325.646862,
|
||||
"last_seen_ts": 1765736390.2576246,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765736390.2576246,
|
||||
"room_title_raw_last": "作业帮数J欠季·双",
|
||||
"alias_raw": [
|
||||
"作业帮数J欠季·双",
|
||||
"作业帮数J季·双"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水实时查找安安全呵护【颜色",
|
||||
"last_prize_value_yuan": 0.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"alias_norm": [
|
||||
"作业帮数J欠季双"
|
||||
],
|
||||
"merged_from_last": "作业帮数J欠季双",
|
||||
"merged_ratio_last": 0.9333333333333333,
|
||||
"room_title": "作业帮数J季双"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765736249.9123456,
|
||||
"last_seen_ts": 1765736325.6338077,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765736325.6338077,
|
||||
"room_title_raw_last": "作业帮数J季·双",
|
||||
"alias_raw": [
|
||||
"作业帮数J季·双",
|
||||
"作业帮数季·双12c"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水实时查找安安全呵护【颜色",
|
||||
"last_prize_value_yuan": 0.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"alias_norm": [
|
||||
"作业帮数J季双"
|
||||
],
|
||||
"merged_from_last": "作业帮数J季双",
|
||||
"merged_ratio_last": 0.8571428571428571,
|
||||
"room_title": "作业帮数季双12c"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765736061.1257513,
|
||||
"last_seen_ts": 1765736061.1257513,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765736061.1257513,
|
||||
"room_title_raw_last": "寸茶传奇手游",
|
||||
"alias_raw": [
|
||||
"寸茶传奇手游"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "天梭手表非仅限图片手表款式随机发货",
|
||||
"last_prize_value_yuan": 5500.0,
|
||||
"max_prize_value_yuan": 5500.0,
|
||||
"room_title": "寸茶传奇手游"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765734459.0887372,
|
||||
"last_seen_ts": 1765734459.0887372,
|
||||
"seen_count": 1,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765734459.0887372,
|
||||
"room_title_raw_last": "作业帮数S欠季·双",
|
||||
"alias_raw": [
|
||||
"作业帮数S欠季·双"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "智能通话儿童手表生活防水实时查找安安全呵护【颜色",
|
||||
"last_prize_value_yuan": 899.0,
|
||||
"max_prize_value_yuan": 899.0,
|
||||
"room_title": "作业帮数S欠季双"
|
||||
},
|
||||
{
|
||||
"first_seen_ts": 1765728524.883359,
|
||||
"last_seen_ts": 1765729036.8238387,
|
||||
"seen_count": 3,
|
||||
"pos_seen": 0,
|
||||
"pos_updated_ts": 1765729036.8238387,
|
||||
"room_title_raw_last": "预选100小小",
|
||||
"alias_raw": [
|
||||
"预选100小小"
|
||||
],
|
||||
"key_kind": "norm",
|
||||
"last_content": "【小小专属】红米Redmi福14C4+64G智能手机原装",
|
||||
"last_prize_value_yuan": 999.0,
|
||||
"max_prize_value_yuan": 999.0,
|
||||
"room_title": "预选100小小"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"updated_ts": 1765793514.5326908,
|
||||
"reason": "add",
|
||||
"room_pos": 0,
|
||||
"current_room_title": "三火孙",
|
||||
"current_room_title_raw": "三火孙...",
|
||||
"reservations": [
|
||||
{
|
||||
"prize_value_yuan": 1699.0,
|
||||
"content": "【三火专属】新国标成人代步男女自行电车通用休闲.",
|
||||
"future_ts": 1765794311.943616,
|
||||
"future_str": "2025-12-15 18:25:11",
|
||||
"pos_seen": 0,
|
||||
"room_title": "三火孙",
|
||||
"room_title_raw": "三火孙..."
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,154 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
|
||||
try:
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
except Exception as e:
|
||||
raise SystemExit(f"tkinter 不可用:{e}\n请安装带 tkinter 的 Python,或改用画图/PS/GIMP 取坐标。")
|
||||
|
||||
|
||||
def clamp(v: float, lo: float, hi: float) -> float:
|
||||
return lo if v < lo else hi if v > hi else v
|
||||
|
||||
|
||||
class CoordPicker:
|
||||
def __init__(self, image_path: Optional[Path]):
|
||||
self.image_path: Optional[Path] = None
|
||||
self.img: Optional[Image.Image] = None
|
||||
self.w = 0
|
||||
self.h = 0
|
||||
self.scale = 1.0
|
||||
self.disp_w = 0
|
||||
self.disp_h = 0
|
||||
self.tk_img = None
|
||||
|
||||
self.root = tk.Tk()
|
||||
|
||||
# 菜单 + 快捷键
|
||||
menubar = tk.Menu(self.root)
|
||||
file_menu = tk.Menu(menubar, tearoff=0)
|
||||
file_menu.add_command(label="打开...", command=self.open_dialog, accelerator="Ctrl+O")
|
||||
file_menu.add_separator()
|
||||
file_menu.add_command(label="退出", command=self.root.destroy)
|
||||
menubar.add_cascade(label="文件", menu=file_menu)
|
||||
self.root.config(menu=menubar)
|
||||
self.root.bind_all("<Control-o>", lambda e: self.open_dialog())
|
||||
|
||||
self.canvas = tk.Canvas(self.root, width=800, height=600)
|
||||
self.canvas.pack(fill=tk.BOTH, expand=False)
|
||||
self._canvas_image_id = self.canvas.create_image(0, 0, anchor=tk.NW)
|
||||
|
||||
self.status = tk.StringVar()
|
||||
self.status.set("移动鼠标查看坐标;单击复制坐标;Ctrl+O 打开图片")
|
||||
self.label = tk.Label(self.root, textvariable=self.status, anchor="w")
|
||||
self.label.pack(fill=tk.X)
|
||||
|
||||
self.canvas.bind("<Motion>", self.on_move)
|
||||
self.canvas.bind("<Button-1>", self.on_click)
|
||||
|
||||
if image_path is None:
|
||||
if not self.open_dialog():
|
||||
raise SystemExit(2)
|
||||
else:
|
||||
self.set_image(image_path)
|
||||
|
||||
def set_image(self, image_path: Path) -> None:
|
||||
image_path = Path(image_path)
|
||||
self.image_path = image_path
|
||||
self.img = Image.open(image_path).convert("RGB")
|
||||
self.w, self.h = self.img.size
|
||||
|
||||
# 显示用缩放(不改变输出坐标)
|
||||
screen_w = self.root.winfo_screenwidth()
|
||||
screen_h = self.root.winfo_screenheight()
|
||||
max_w = int(screen_w * 0.9)
|
||||
max_h = int(screen_h * 0.85)
|
||||
scale_w = max_w / max(1, self.w)
|
||||
scale_h = max_h / max(1, self.h)
|
||||
self.scale = min(1.0, scale_w, scale_h)
|
||||
self.disp_w = int(self.w * self.scale)
|
||||
self.disp_h = int(self.h * self.scale)
|
||||
|
||||
disp_img = self.img
|
||||
if self.scale < 1.0:
|
||||
disp_img = self.img.resize((self.disp_w, self.disp_h), Image.BICUBIC)
|
||||
|
||||
self.tk_img = ImageTk.PhotoImage(disp_img)
|
||||
self.canvas.config(width=self.disp_w, height=self.disp_h)
|
||||
self.canvas.itemconfig(self._canvas_image_id, image=self.tk_img)
|
||||
self.root.title(f"取坐标: {image_path} ({self.w}x{self.h})")
|
||||
|
||||
def open_dialog(self) -> bool:
|
||||
initial_dir = None
|
||||
try:
|
||||
if self.image_path and self.image_path.parent.exists():
|
||||
initial_dir = str(self.image_path.parent)
|
||||
except Exception:
|
||||
initial_dir = None
|
||||
|
||||
filename = filedialog.askopenfilename(
|
||||
title="选择图片",
|
||||
initialdir=initial_dir,
|
||||
filetypes=[
|
||||
("Images", "*.png;*.jpg;*.jpeg;*.bmp;*.webp"),
|
||||
("All files", "*.*"),
|
||||
],
|
||||
)
|
||||
if not filename:
|
||||
return False
|
||||
try:
|
||||
self.set_image(Path(filename))
|
||||
return True
|
||||
except Exception as e:
|
||||
self.status.set(f"打开失败: {e}")
|
||||
return False
|
||||
|
||||
def _to_image_xy(self, event) -> tuple[int, int]:
|
||||
if not self.img or self.w <= 0 or self.h <= 0:
|
||||
return 0, 0
|
||||
x = int(clamp(event.x / self.scale, 0, self.w - 1))
|
||||
y = int(clamp(event.y / self.scale, 0, self.h - 1))
|
||||
return x, y
|
||||
|
||||
def on_move(self, event):
|
||||
x, y = self._to_image_xy(event)
|
||||
self.status.set(f"x={x}, y={y}")
|
||||
|
||||
def on_click(self, event):
|
||||
x, y = self._to_image_xy(event)
|
||||
text = f"{x},{y}"
|
||||
print(text)
|
||||
try:
|
||||
self.root.clipboard_clear()
|
||||
self.root.clipboard_append(text)
|
||||
self.status.set(f"已复制: {text}")
|
||||
except Exception:
|
||||
self.status.set(f"坐标: {text} (复制失败)")
|
||||
|
||||
def run(self):
|
||||
self.root.mainloop()
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
p: Optional[Path] = None
|
||||
if len(argv) >= 2:
|
||||
p = Path(argv[1]).expanduser()
|
||||
if not p.is_absolute():
|
||||
p = (Path(__file__).resolve().parent.parent / p).resolve()
|
||||
if not p.exists():
|
||||
print(f"找不到图片: {p}")
|
||||
print("将弹出文件选择框,请手动选择图片。")
|
||||
p = None
|
||||
else:
|
||||
print("未传入图片路径,将弹出文件选择框。")
|
||||
|
||||
CoordPicker(p).run()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
@@ -0,0 +1,166 @@
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
from datetime import datetime
|
||||
|
||||
BASE = "http://127.0.0.1:8765"
|
||||
|
||||
|
||||
def _get(path: str, timeout: float = 5.0) -> dict:
|
||||
with urllib.request.urlopen(BASE + path, timeout=timeout) as r:
|
||||
return json.loads(r.read().decode("utf-8"))
|
||||
|
||||
|
||||
def _post(path: str, payload: dict, timeout: float = 15.0) -> dict:
|
||||
data = json.dumps(payload).encode("utf-8")
|
||||
req = urllib.request.Request(
|
||||
BASE + path,
|
||||
data=data,
|
||||
headers={"Content-Type": "application/json"},
|
||||
method="POST",
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return json.loads(r.read().decode("utf-8"))
|
||||
|
||||
|
||||
def _is_click_join(line: str) -> bool:
|
||||
s = line or ""
|
||||
return ("点击参与抽奖" in s) or ("[参与]" in s and "动作=点击参与" in s)
|
||||
|
||||
|
||||
def _is_attend_ok(line: str) -> bool:
|
||||
s = line or ""
|
||||
return (
|
||||
("已经参与,等待开奖" in s)
|
||||
or ("已经参与,等待看播时间凑齐开奖" in s)
|
||||
or ("已参与成功(或看播中)" in s)
|
||||
or ("[参与]" in s and ("结果=已参与" in s or "结果=看播中" in s))
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
print("[测试] Web GUI 地址:", BASE)
|
||||
print("[测试] 开始时间:", datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
devices_resp = _get("/api/devices")
|
||||
devices = devices_resp.get("devices") or []
|
||||
print("[测试] ADB:", devices_resp.get("adb"))
|
||||
print("[测试] 设备列表:", devices)
|
||||
if not devices:
|
||||
print("[测试][失败] 未发现任何 ADB 设备(请确认 adb devices 能看到设备)")
|
||||
return 2
|
||||
|
||||
device_id = devices[0]
|
||||
print("[测试] 使用设备:", device_id)
|
||||
|
||||
# 停止旧进程
|
||||
try:
|
||||
_post("/api/stop", {})
|
||||
time.sleep(0.5)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# baseline logs
|
||||
last_idx = 0
|
||||
try:
|
||||
base_logs = _get("/api/logs?since=0")
|
||||
last_idx = int(base_logs.get("next") or 0)
|
||||
except Exception:
|
||||
last_idx = 0
|
||||
|
||||
payload = {
|
||||
"device_id": device_id,
|
||||
"y_pianyi": 0,
|
||||
"needswitch": True,
|
||||
"wait_minutes": 5,
|
||||
}
|
||||
|
||||
try:
|
||||
start_resp = _post("/api/start-run", payload)
|
||||
print("[测试] 启动挂机:", start_resp)
|
||||
except urllib.error.HTTPError as e:
|
||||
body = e.read().decode("utf-8", errors="replace")
|
||||
print("[测试][失败] 启动 HTTPError:", e.code, body)
|
||||
return 3
|
||||
|
||||
duration_seconds = 300
|
||||
print(f"[测试] 监控时长:{duration_seconds} 秒(5 分钟)")
|
||||
|
||||
start_ts = time.time()
|
||||
|
||||
key_lines: list[str] = []
|
||||
saw_click_join = False
|
||||
saw_attend_ok = False
|
||||
abnormal_count = 0
|
||||
last_stats_ts = 0.0
|
||||
|
||||
try:
|
||||
while time.time() - start_ts < duration_seconds:
|
||||
j = _get(f"/api/logs?since={last_idx}")
|
||||
last_idx = int(j.get("next") or last_idx)
|
||||
lines = j.get("lines") or []
|
||||
|
||||
for ln in lines:
|
||||
if any(k in ln for k in ("[截图]", "[详情]", "[异常]", "[参与]", "[预约]", "点击打开福袋详情")):
|
||||
key_lines.append(ln)
|
||||
if _is_click_join(ln):
|
||||
saw_click_join = True
|
||||
if _is_attend_ok(ln):
|
||||
saw_attend_ok = True
|
||||
if "[异常]" in ln:
|
||||
abnormal_count += 1
|
||||
|
||||
# 每 10 秒打一次 stats(更直观看是否有“参与点击/参与成功”计数)
|
||||
now = time.time()
|
||||
if now - last_stats_ts >= 10:
|
||||
last_stats_ts = now
|
||||
try:
|
||||
st = _get("/api/stats")
|
||||
c = st.get("counters") or {}
|
||||
print(
|
||||
"[测试][统计] 运行=", st.get("running"),
|
||||
" 参与点击=", c.get("fudai_click_attend", 0),
|
||||
" 参与成功=", c.get("fudai_attend_ok", 0),
|
||||
" 打开详情=", c.get("fudai_open_detail", 0),
|
||||
" 异常打开=", c.get("fudai_open_error", 0),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 已经出现“点击参与+参与成功”就提前结束(你要的是5分钟内能参与)
|
||||
if saw_click_join and saw_attend_ok:
|
||||
print("[测试] 已检测到参与点击 + 参与成功标志,提前结束监控。")
|
||||
break
|
||||
|
||||
time.sleep(1)
|
||||
finally:
|
||||
# stop
|
||||
try:
|
||||
stop_resp = _post("/api/stop", {})
|
||||
print("[测试] 已停止挂机:", stop_resp)
|
||||
except Exception as e:
|
||||
print("[测试][警告] 停止失败:", e)
|
||||
|
||||
print("\n[测试] ===== 结果汇总 =====")
|
||||
print("- 5分钟内是否出现【点击参与】:", "是" if saw_click_join else "否")
|
||||
print("- 5分钟内是否出现【参与成功/已参与】:", "是" if saw_attend_ok else "否")
|
||||
print("- [异常] 行计数:", abnormal_count)
|
||||
|
||||
print("\n[测试] ===== 关键日志(最近 120 行) =====")
|
||||
for ln in key_lines[-120:]:
|
||||
print(ln)
|
||||
|
||||
if not saw_click_join:
|
||||
print("\n[测试][判定] 5分钟内没有看到‘点击参与’相关日志:可能存在问题(没打开到福袋详情/识别失败/策略跳过/禁抢时段等)。")
|
||||
return 10
|
||||
if saw_click_join and (not saw_attend_ok):
|
||||
print("\n[测试][判定] 看到‘点击参与’,但没看到‘已参与/看播中’:可能按钮点击后未生效或被门槛/弹窗打断。")
|
||||
return 11
|
||||
|
||||
print("\n[测试][通过] 5分钟内参与链路有证据日志。")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,135 @@
|
||||
import json
|
||||
import time
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
|
||||
BASE = "http://127.0.0.1:8765"
|
||||
|
||||
|
||||
def _get(path: str, timeout: float = 5.0) -> dict:
|
||||
with urllib.request.urlopen(BASE + path, timeout=timeout) as r:
|
||||
return json.loads(r.read().decode("utf-8"))
|
||||
|
||||
|
||||
def _post(path: str, payload: dict, timeout: float = 10.0) -> dict:
|
||||
data = json.dumps(payload).encode("utf-8")
|
||||
req = urllib.request.Request(
|
||||
BASE + path,
|
||||
data=data,
|
||||
headers={"Content-Type": "application/json"},
|
||||
method="POST",
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
return json.loads(r.read().decode("utf-8"))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
devices_resp = _get("/api/devices")
|
||||
devices = devices_resp.get("devices") or []
|
||||
print("[smoke] devices:", devices_resp)
|
||||
if not devices:
|
||||
print("[smoke] ERROR: no adb devices")
|
||||
return 2
|
||||
|
||||
device_id = devices[0]
|
||||
payload = {
|
||||
"device_id": device_id,
|
||||
"y_pianyi": 0,
|
||||
"needswitch": True,
|
||||
"wait_minutes": 5,
|
||||
}
|
||||
|
||||
# best-effort: stop any existing run to avoid mixed logs / 409
|
||||
try:
|
||||
_post("/api/stop", {})
|
||||
time.sleep(0.5)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# baseline logs (avoid old history)
|
||||
try:
|
||||
base_logs = _get("/api/logs?since=0")
|
||||
last_idx = int(base_logs.get("next") or 0)
|
||||
except Exception:
|
||||
last_idx = 0
|
||||
|
||||
try:
|
||||
start_resp = _post("/api/start-run", payload)
|
||||
print("[smoke] start:", start_resp)
|
||||
except urllib.error.HTTPError as e:
|
||||
body = e.read().decode("utf-8", errors="replace")
|
||||
print("[smoke] start HTTPError:", e.code, body)
|
||||
return 3
|
||||
|
||||
# poll logs
|
||||
start_ts = time.time()
|
||||
hits: list[str] = []
|
||||
all_lines: list[str] = []
|
||||
|
||||
# 轮询最多 240 秒;命中首次“[异常] 时间/价值异常仍未恢复”后再额外等待一小段时间,
|
||||
# 尽量抓到 reopen 识别结果或“持续异常”最终分支。
|
||||
post_abnormal_grace_seconds = 20
|
||||
abnormal_marker_ts: float | None = None
|
||||
while time.time() - start_ts < 240:
|
||||
j = _get(f"/api/logs?since={last_idx}")
|
||||
last_idx = int(j.get("next") or last_idx)
|
||||
lines = j.get("lines") or []
|
||||
if lines:
|
||||
all_lines.extend(lines)
|
||||
for ln in lines:
|
||||
if any(k in ln for k in ("[截图]", "[详情]", "[异常]")):
|
||||
hits.append(ln)
|
||||
if abnormal_marker_ts is None and any("[异常] 时间/价值异常仍未恢复" in x for x in hits):
|
||||
abnormal_marker_ts = time.time()
|
||||
|
||||
if any("[异常] 时间/价值持续异常" in x for x in hits):
|
||||
break
|
||||
if any("[详情] reopen" in x for x in hits):
|
||||
break
|
||||
if abnormal_marker_ts is not None and (time.time() - abnormal_marker_ts) >= post_abnormal_grace_seconds:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
# stop
|
||||
try:
|
||||
stop_resp = _post("/api/stop", {})
|
||||
print("[smoke] stop:", stop_resp)
|
||||
except Exception as e:
|
||||
print("[smoke] stop ERROR:", e)
|
||||
|
||||
print("\n[smoke] ==== KEY LINES ([截图]/[详情]/[异常]) tail 80 ====")
|
||||
for ln in hits[-80:]:
|
||||
print(ln)
|
||||
|
||||
# simple verdict
|
||||
has_shot = any("[截图]" in x for x in hits)
|
||||
has_detail = any("[详情]" in x for x in hits)
|
||||
has_abnormal = any("[异常]" in x for x in hits)
|
||||
saw_first_abnormal = any(("[详情] first" in x and "异常=True" in x) for x in hits)
|
||||
saw_retry1 = any("[详情] retry1" in x for x in hits)
|
||||
saw_reopen = any("[详情] reopen" in x for x in hits)
|
||||
saw_normal = any(("[详情]" in x and "异常=False" in x) for x in hits)
|
||||
print("\n[smoke] verdict:")
|
||||
print("- saw [截图]:", has_shot)
|
||||
print("- saw [详情]:", has_detail)
|
||||
print("- saw [异常]:", has_abnormal)
|
||||
print("- saw first abnormal (first):", saw_first_abnormal)
|
||||
print("- saw retry1:", saw_retry1)
|
||||
print("- saw reopen:", saw_reopen)
|
||||
print("- saw any normal detail:", saw_normal)
|
||||
|
||||
if not has_shot:
|
||||
print("[smoke] NOTE: 未看到[截图],通常表示子进程未真正跑起来或日志未回流")
|
||||
if has_shot and (not has_detail):
|
||||
print("[smoke] NOTE: 已看到[截图]但未看到[详情],可能还没打开到福袋详情,或 OCR 初始化/识别较慢")
|
||||
|
||||
# also show last 30 lines for context
|
||||
print("\n[smoke] ==== LAST 50 LOG LINES ====")
|
||||
for ln in all_lines[-50:]:
|
||||
print(ln)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
"""版本信息(统一入口)。
|
||||
|
||||
说明:
|
||||
- APP_VERSION: 语义化版本号(含前缀 V)
|
||||
- APP_BUILD_DATE: 构建/发布日期(YYYY-MM-DD)
|
||||
|
||||
运行前打印版本号的入口统一用 print_version_banner()。
|
||||
"""
|
||||
|
||||
APP_NAME = "douyin_guaji"
|
||||
APP_VERSION = "V3.3.1"
|
||||
APP_BUILD_DATE = "2025-12-14"
|
||||
|
||||
|
||||
def get_version_string() -> str:
|
||||
return f"{APP_VERSION} ({APP_BUILD_DATE})"
|
||||
|
||||
|
||||
def print_version_banner(app_name: str | None = None) -> str:
|
||||
name = (app_name or APP_NAME).strip() or APP_NAME
|
||||
s = f"{name} 版本:{get_version_string()}"
|
||||
print(s)
|
||||
return s
|
||||
+1077
File diff suppressed because it is too large.
Load diff
Whitespace-only changes.
+907
@@ -0,0 +1,907 @@
|
||||
let logIdx = 0;
|
||||
let pollTimer = null;
|
||||
let statsTimer = null;
|
||||
let shotTimer = null;
|
||||
|
||||
const DEFAULTS = {
|
||||
// 筛选
|
||||
min_prize_value_yuan: 0,
|
||||
min_participants: 0,
|
||||
max_participants: 0,
|
||||
skip_if_countdown_lt_seconds: 15,
|
||||
reset_after_swipes_enabled: false,
|
||||
reset_after_swipes: 10,
|
||||
auto_join_fansclub: false,
|
||||
fansclub_fail_action: "stay",
|
||||
|
||||
// 养号
|
||||
yanghao_enabled: true,
|
||||
yanghao_enable_actions: true,
|
||||
yanghao_step_screenshot: false,
|
||||
yanghao_recommend_duration_seconds: 60,
|
||||
yanghao_recommend_interval_seconds: 0,
|
||||
yanghao_like_prob: 0.15,
|
||||
yanghao_fav_prob: 0.05,
|
||||
yanghao_comment_prob: 0,
|
||||
yanghao_icon_roi_size: 180,
|
||||
yanghao_icon_match_threshold: 0.72,
|
||||
yanghao_like_template_path: "assets/like.png",
|
||||
yanghao_fav_template_path: "assets/fav.png",
|
||||
yanghao_after_dwell_swipe_direction: "up",
|
||||
yanghao_after_dwell_swipe_distance_px: 900,
|
||||
|
||||
// 高价值福袋预约
|
||||
high_value_fudai_enabled: false,
|
||||
high_value_fudai_threshold_yuan: 1000,
|
||||
high_value_fudai_join_ahead_seconds: 120,
|
||||
high_value_fudai_max_swipe_back: 60,
|
||||
high_value_fudai_max_reservations: 5,
|
||||
high_value_fudai_after_action: "continue",
|
||||
high_value_room_revisit_enabled: true,
|
||||
high_value_room_revisit_only_current_run: false,
|
||||
reservation_back_verify_enabled: true,
|
||||
|
||||
// 定时禁抢福袋(默认 2-7 点)
|
||||
fudai_quiet_hours_enabled: true,
|
||||
fudai_quiet_start_hour: 2,
|
||||
fudai_quiet_end_hour: 7,
|
||||
// 福袋图标检测等待参数(可调)
|
||||
fudai_icon_max_wait_seconds: 3.0,
|
||||
fudai_icon_adaptive_enabled: false,
|
||||
};
|
||||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
|
||||
function initTabs() {
|
||||
const tabButtons = Array.from(document.querySelectorAll(".tabBtn[data-target]"));
|
||||
const panels = Array.from(document.querySelectorAll(".panel[data-panel]"));
|
||||
if (tabButtons.length === 0 || panels.length === 0) return;
|
||||
|
||||
const setActive = (target) => {
|
||||
for (const btn of tabButtons) {
|
||||
const isActive = btn.dataset.target === target;
|
||||
btn.classList.toggle("active", isActive);
|
||||
btn.setAttribute("aria-selected", isActive ? "true" : "false");
|
||||
}
|
||||
for (const panel of panels) {
|
||||
const isActive = panel.dataset.panel === target;
|
||||
panel.toggleAttribute("hidden", !isActive);
|
||||
panel.classList.toggle("active", isActive);
|
||||
}
|
||||
};
|
||||
|
||||
for (const btn of tabButtons) {
|
||||
btn.addEventListener("click", () => setActive(btn.dataset.target));
|
||||
}
|
||||
|
||||
const defaultTarget = tabButtons.find(b => b.classList.contains("active"))?.dataset.target || tabButtons[0].dataset.target;
|
||||
setActive(defaultTarget);
|
||||
}
|
||||
|
||||
function appendLog(lines) {
|
||||
const log = $("log");
|
||||
if (!lines || lines.length === 0) return;
|
||||
log.textContent += lines.join("\n") + "\n";
|
||||
log.scrollTop = log.scrollHeight;
|
||||
}
|
||||
|
||||
function fmtTime(ts) {
|
||||
if (!ts) return "-";
|
||||
try {
|
||||
return new Date(ts * 1000).toLocaleString();
|
||||
} catch {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
|
||||
function fmtDuration(seconds) {
|
||||
const s = Math.max(0, parseInt(seconds || 0, 10));
|
||||
const h = Math.floor(s / 3600);
|
||||
const m = Math.floor((s % 3600) / 60);
|
||||
const sec = s % 60;
|
||||
if (h > 0) return `${h}小时${m}分${sec}秒`;
|
||||
if (m > 0) return `${m}分${sec}秒`;
|
||||
return `${sec}秒`;
|
||||
}
|
||||
|
||||
function pollShot() {
|
||||
const img = $("liveShot");
|
||||
if (!img) return;
|
||||
|
||||
const url = `/pic/screenshot.png?t=${Date.now()}`;
|
||||
img.src = url;
|
||||
|
||||
const status = $("liveShotStatus");
|
||||
if (status) status.textContent = `刷新中:${new Date().toLocaleTimeString()}`;
|
||||
}
|
||||
|
||||
function startShotPolling() {
|
||||
if (shotTimer) clearInterval(shotTimer);
|
||||
|
||||
const img = $("liveShot");
|
||||
const status = $("liveShotStatus");
|
||||
if (img) {
|
||||
img.addEventListener("load", () => {
|
||||
if (status) status.textContent = `已更新:${new Date().toLocaleTimeString()}`;
|
||||
});
|
||||
img.addEventListener("error", () => {
|
||||
if (status) status.textContent = "暂无截图(等待脚本生成 pic/screenshot.png)";
|
||||
});
|
||||
}
|
||||
|
||||
shotTimer = setInterval(pollShot, 900);
|
||||
}
|
||||
|
||||
function setTextIfExists(id, text) {
|
||||
const el = $(id);
|
||||
if (!el) return;
|
||||
el.textContent = String(text ?? "-");
|
||||
}
|
||||
|
||||
function clearEl(el) {
|
||||
while (el && el.firstChild) el.removeChild(el.firstChild);
|
||||
}
|
||||
|
||||
|
||||
function renderBars(containerId, dataMap, labelMap) {
|
||||
const root = $(containerId);
|
||||
if (!root) return;
|
||||
clearEl(root);
|
||||
|
||||
const m = (dataMap && typeof dataMap === "object") ? dataMap : {};
|
||||
const items = Object.keys(m).map(k => ({ key: k, count: Number(m[k]) || 0 }))
|
||||
.filter(x => x.count > 0);
|
||||
items.sort((a, b) => b.count - a.count);
|
||||
|
||||
if (items.length === 0) {
|
||||
const d = document.createElement("div");
|
||||
d.className = "hint";
|
||||
d.textContent = "暂无数据";
|
||||
root.appendChild(d);
|
||||
return;
|
||||
}
|
||||
|
||||
const max = Math.max(...items.map(x => x.count));
|
||||
for (const it of items) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "barRow";
|
||||
|
||||
const label = document.createElement("div");
|
||||
label.className = "barLabel";
|
||||
label.textContent = (labelMap && labelMap[it.key]) ? labelMap[it.key] : it.key;
|
||||
|
||||
const track = document.createElement("div");
|
||||
track.className = "barTrack";
|
||||
const fill = document.createElement("div");
|
||||
fill.className = "barFill";
|
||||
fill.style.width = `${max > 0 ? (it.count / max * 100) : 0}%`;
|
||||
track.appendChild(fill);
|
||||
|
||||
const val = document.createElement("div");
|
||||
val.className = "barValue";
|
||||
val.textContent = String(it.count);
|
||||
|
||||
row.appendChild(label);
|
||||
row.appendChild(track);
|
||||
row.appendChild(val);
|
||||
root.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
function renderTopContent(containerId, items) {
|
||||
const root = $(containerId);
|
||||
if (!root) return;
|
||||
clearEl(root);
|
||||
|
||||
const list = Array.isArray(items) ? items : [];
|
||||
const head = document.createElement("div");
|
||||
head.className = "tableRow tableHead";
|
||||
head.innerHTML = `<div>#</div><div>内容</div><div>次数</div>`;
|
||||
root.appendChild(head);
|
||||
|
||||
if (list.length === 0) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "tableRow";
|
||||
row.innerHTML = `<div class="mono">-</div><div class="hint">暂无数据</div><div class="mono">-</div>`;
|
||||
root.appendChild(row);
|
||||
return;
|
||||
}
|
||||
|
||||
list.forEach((it, idx) => {
|
||||
const row = document.createElement("div");
|
||||
row.className = "tableRow";
|
||||
const key = String(it.key ?? "");
|
||||
const cnt = Number(it.count) || 0;
|
||||
row.innerHTML = `<div class="mono">#${idx + 1}</div><div>${escapeHtml(key)}</div><div class="mono">${cnt}</div>`;
|
||||
root.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
function escapeHtml(s) {
|
||||
return String(s ?? "")
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """)
|
||||
.replaceAll("'", "'");
|
||||
}
|
||||
|
||||
function renderWinsTable(containerId, wins) {
|
||||
const root = $(containerId);
|
||||
if (!root) return;
|
||||
clearEl(root);
|
||||
|
||||
const list = Array.isArray(wins) ? wins : [];
|
||||
|
||||
const head = document.createElement("div");
|
||||
head.className = "tableRow tableHead";
|
||||
head.innerHTML = `<div>时间</div><div>内容</div><div>价值</div>`;
|
||||
root.appendChild(head);
|
||||
|
||||
if (list.length === 0) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "tableRow";
|
||||
row.innerHTML = `<div class="mono">-</div><div class="hint">暂无中奖记录</div><div class="mono">-</div>`;
|
||||
root.appendChild(row);
|
||||
return;
|
||||
}
|
||||
|
||||
// 后端按时间顺序存储,这里倒序展示(最新在上)
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
const it = list[i] || {};
|
||||
const ts = Number(it.ts) || 0;
|
||||
const content = String(it.content || "-");
|
||||
const value = (it.prize_value_yuan === null || typeof it.prize_value_yuan === "undefined") ? "-" : String(it.prize_value_yuan);
|
||||
|
||||
const row = document.createElement("div");
|
||||
row.className = "tableRow";
|
||||
row.innerHTML = `<div class="mono">${escapeHtml(fmtTime(ts))}</div><div>${escapeHtml(content)}</div><div class="mono">${escapeHtml(value)}</div>`;
|
||||
root.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
function renderTimeline(containerId, timeline) {
|
||||
const root = $(containerId);
|
||||
if (!root) return;
|
||||
clearEl(root);
|
||||
|
||||
const t = (timeline && typeof timeline === "object") ? timeline : null;
|
||||
const series = t && t.series && typeof t.series === "object" ? t.series : null;
|
||||
const bins = Number(t && t.bins) || 0;
|
||||
|
||||
if (!series || bins <= 0) {
|
||||
const d = document.createElement("div");
|
||||
d.className = "hint";
|
||||
d.textContent = "暂无数据";
|
||||
root.appendChild(d);
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = [
|
||||
"fudai_open_detail",
|
||||
"fudai_attend_ok",
|
||||
"fudai_attend_fail",
|
||||
"fudai_result_win",
|
||||
"fudai_result_no_win",
|
||||
"fudai_skip",
|
||||
"switch_room",
|
||||
];
|
||||
|
||||
let maxY = 0;
|
||||
for (const k of keys) {
|
||||
const arr = Array.isArray(series[k]) ? series[k] : [];
|
||||
for (const v of arr) maxY = Math.max(maxY, Number(v) || 0);
|
||||
}
|
||||
if (maxY <= 0) {
|
||||
const d = document.createElement("div");
|
||||
d.className = "hint";
|
||||
d.textContent = "暂无数据";
|
||||
root.appendChild(d);
|
||||
return;
|
||||
}
|
||||
|
||||
const W = 900;
|
||||
const H = 220;
|
||||
const padL = 36;
|
||||
const padR = 14;
|
||||
const padT = 10;
|
||||
const padB = 26;
|
||||
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
svg.setAttribute("viewBox", `0 0 ${W} ${H}`);
|
||||
svg.setAttribute("width", "100%");
|
||||
svg.setAttribute("height", String(H));
|
||||
svg.style.display = "block";
|
||||
|
||||
const axis = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
axis.setAttribute("d", `M ${padL} ${H - padB} L ${W - padR} ${H - padB}`);
|
||||
axis.setAttribute("stroke", "var(--border)");
|
||||
axis.setAttribute("fill", "none");
|
||||
svg.appendChild(axis);
|
||||
|
||||
const mkText = (x, y, txt, anchor = "start") => {
|
||||
const el = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
||||
el.setAttribute("x", String(x));
|
||||
el.setAttribute("y", String(y));
|
||||
el.setAttribute("fill", "var(--muted)");
|
||||
el.setAttribute("font-size", "11");
|
||||
el.setAttribute("text-anchor", anchor);
|
||||
el.textContent = txt;
|
||||
return el;
|
||||
};
|
||||
|
||||
const startTs = Number(t.start_ts) || 0;
|
||||
const binSec = Number(t.bin_seconds) || 0;
|
||||
const xAt = (i) => {
|
||||
if (bins <= 1) return padL;
|
||||
return padL + (W - padL - padR) * (i / (bins - 1));
|
||||
};
|
||||
const yAt = (v) => {
|
||||
const vv = Number(v) || 0;
|
||||
const h = (H - padT - padB);
|
||||
return (H - padB) - (vv / maxY) * h;
|
||||
};
|
||||
|
||||
// y 轴 max 标记
|
||||
svg.appendChild(mkText(padL, padT + 10, String(maxY), "start"));
|
||||
|
||||
// x 轴 3 个时间刻度
|
||||
const fmtShort = (ts) => {
|
||||
if (!ts) return "-";
|
||||
try { return new Date(ts * 1000).toLocaleTimeString(); } catch { return "-"; }
|
||||
};
|
||||
svg.appendChild(mkText(padL, H - 8, fmtShort(startTs), "start"));
|
||||
svg.appendChild(mkText((padL + (W - padR)) / 2, H - 8, fmtShort(startTs + Math.floor(bins / 2) * binSec), "middle"));
|
||||
svg.appendChild(mkText(W - padR, H - 8, fmtShort(startTs + (bins - 1) * binSec), "end"));
|
||||
|
||||
const strokes = {
|
||||
fudai_open_detail: { stroke: "var(--primary)", dash: "" },
|
||||
fudai_attend_ok: { stroke: "var(--primary)", dash: "6 4" },
|
||||
fudai_attend_fail: { stroke: "var(--danger)", dash: "" },
|
||||
fudai_result_win: { stroke: "var(--danger)", dash: "6 4" },
|
||||
fudai_result_no_win: { stroke: "var(--muted)", dash: "" },
|
||||
fudai_skip: { stroke: "var(--muted)", dash: "6 4" },
|
||||
switch_room: { stroke: "var(--text)", dash: "2 4" },
|
||||
};
|
||||
|
||||
for (const k of keys) {
|
||||
const arr = Array.isArray(series[k]) ? series[k] : [];
|
||||
if (arr.length === 0) continue;
|
||||
let d = "";
|
||||
for (let i = 0; i < Math.min(bins, arr.length); i++) {
|
||||
const x = xAt(i);
|
||||
const y = yAt(arr[i]);
|
||||
d += (i === 0) ? `M ${x.toFixed(2)} ${y.toFixed(2)}` : ` L ${x.toFixed(2)} ${y.toFixed(2)}`;
|
||||
}
|
||||
const p = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
p.setAttribute("d", d);
|
||||
p.setAttribute("fill", "none");
|
||||
p.setAttribute("stroke", strokes[k]?.stroke || "var(--primary)");
|
||||
p.setAttribute("stroke-width", "2");
|
||||
if (strokes[k]?.dash) p.setAttribute("stroke-dasharray", strokes[k].dash);
|
||||
p.setAttribute("stroke-linecap", "round");
|
||||
p.setAttribute("stroke-linejoin", "round");
|
||||
svg.appendChild(p);
|
||||
}
|
||||
|
||||
root.appendChild(svg);
|
||||
|
||||
const legend = document.createElement("div");
|
||||
legend.className = "hint";
|
||||
legend.textContent = "图例:实线/虚线区分同色不同事件";
|
||||
root.appendChild(legend);
|
||||
}
|
||||
|
||||
async function apiGet(path) {
|
||||
const res = await fetch(path, { cache: "no-store" });
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
async function apiPost(path, body) {
|
||||
const res = await fetch(path, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body || {}),
|
||||
});
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
async function refreshDevices() {
|
||||
const data = await apiGet("/api/devices");
|
||||
const sel = $("device");
|
||||
sel.innerHTML = "";
|
||||
const devices = data.devices || [];
|
||||
|
||||
const optAuto = document.createElement("option");
|
||||
optAuto.value = "";
|
||||
optAuto.textContent = "(auto)";
|
||||
sel.appendChild(optAuto);
|
||||
|
||||
for (const d of devices) {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = d;
|
||||
opt.textContent = d;
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
|
||||
$("adbStatus").textContent = data.adb ? `adb: ${data.adb}` : "未找到 adb.exe(请安装 platform-tools)";
|
||||
}
|
||||
|
||||
function getConfigBoundElements() {
|
||||
return Array.from(document.querySelectorAll("[data-key]"));
|
||||
}
|
||||
|
||||
function coerceValue(type, raw, isCheckbox) {
|
||||
if (type === "bool") return !!raw;
|
||||
if (type === "int") {
|
||||
const n = parseInt(String(raw ?? "0"), 10);
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
if (type === "float") {
|
||||
const n = parseFloat(String(raw ?? "0"));
|
||||
return Number.isFinite(n) ? n : 0;
|
||||
}
|
||||
if (type === "list_lines") {
|
||||
if (Array.isArray(raw)) return raw.map(x => String(x).trim()).filter(Boolean);
|
||||
return String(raw ?? "").split("\n").map(x => x.trim()).filter(Boolean);
|
||||
}
|
||||
if (isCheckbox) return !!raw;
|
||||
return String(raw ?? "");
|
||||
}
|
||||
|
||||
function applyConfigToUI(cfg) {
|
||||
for (const el of getConfigBoundElements()) {
|
||||
const key = el.dataset.key;
|
||||
const type = el.dataset.type || "str";
|
||||
const val = cfg ? cfg[key] : undefined;
|
||||
|
||||
// undefined/null 都视为“未配置”:保留页面默认值
|
||||
const hasVal = !(typeof val === "undefined" || val === null);
|
||||
const useVal = hasVal ? val : (Object.prototype.hasOwnProperty.call(DEFAULTS, key) ? DEFAULTS[key] : undefined);
|
||||
if (typeof useVal === "undefined") continue;
|
||||
|
||||
if (el.type === "checkbox") {
|
||||
el.checked = !!useVal;
|
||||
continue;
|
||||
}
|
||||
if (type === "list_lines") {
|
||||
el.value = (Array.isArray(useVal) ? useVal : []).join("\n");
|
||||
continue;
|
||||
}
|
||||
el.value = String(useVal);
|
||||
}
|
||||
}
|
||||
|
||||
function collectConfigFromUI() {
|
||||
const out = {};
|
||||
for (const el of getConfigBoundElements()) {
|
||||
const key = el.dataset.key;
|
||||
const type = el.dataset.type || "str";
|
||||
if (!key) continue;
|
||||
|
||||
if (el.type === "checkbox") {
|
||||
out[key] = coerceValue(type, el.checked, true);
|
||||
} else {
|
||||
out[key] = coerceValue(type, el.value, false);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
async function loadConfig() {
|
||||
const cfg = await apiGet("/api/config");
|
||||
applyConfigToUI(cfg);
|
||||
appendLog(["[WEB] 配置已加载"]);
|
||||
}
|
||||
|
||||
async function saveConfig() {
|
||||
const cfgUpdate = collectConfigFromUI();
|
||||
await apiPost("/api/config", cfgUpdate);
|
||||
appendLog(["[WEB] 配置已保存到 config.json"]);
|
||||
}
|
||||
|
||||
async function startRun() {
|
||||
const deviceId = $("device").value || "";
|
||||
const yPianyi = parseInt($("y_pianyi").value || "0", 10);
|
||||
const waitMinutes = parseInt($("wait_minutes").value || "5", 10);
|
||||
const needswitch = $("needswitch").checked;
|
||||
const cfgPart = collectConfigFromUI();
|
||||
|
||||
await apiPost("/api/start-run", {
|
||||
device_id: deviceId,
|
||||
y_pianyi: yPianyi,
|
||||
wait_minutes: waitMinutes,
|
||||
needswitch,
|
||||
reset_after_swipes_enabled: cfgPart.reset_after_swipes_enabled,
|
||||
min_prize_value_yuan: cfgPart.min_prize_value_yuan,
|
||||
min_participants: cfgPart.min_participants,
|
||||
max_participants: cfgPart.max_participants,
|
||||
skip_if_countdown_lt_seconds: cfgPart.skip_if_countdown_lt_seconds,
|
||||
reset_after_swipes: cfgPart.reset_after_swipes,
|
||||
auto_join_fansclub: cfgPart.auto_join_fansclub,
|
||||
fansclub_fail_action: cfgPart.fansclub_fail_action,
|
||||
high_value_room_revisit_enabled: cfgPart.high_value_room_revisit_enabled,
|
||||
high_value_room_revisit_only_current_run: cfgPart.high_value_room_revisit_only_current_run,
|
||||
reservation_back_verify_enabled: cfgPart.reservation_back_verify_enabled,
|
||||
fudai_icon_max_wait_seconds: cfgPart.fudai_icon_max_wait_seconds,
|
||||
fudai_icon_adaptive_enabled: cfgPart.fudai_icon_adaptive_enabled,
|
||||
});
|
||||
appendLog([`[WEB] 已开始运行:device=${deviceId || '(auto)'}`]);
|
||||
}
|
||||
|
||||
async function testYanghao() {
|
||||
const deviceId = $("device").value || "";
|
||||
const seconds = parseInt($("yanghao_recommend_duration_seconds").value || "60", 10);
|
||||
await apiPost("/api/test-yanghao", { device_id: deviceId, seconds });
|
||||
appendLog([`[WEB] 已启动测试养号:device=${deviceId || '(auto)'} seconds=${seconds}`]);
|
||||
}
|
||||
|
||||
async function testComment() {
|
||||
const deviceId = $("device").value || "";
|
||||
const text = "";
|
||||
await apiPost("/api/test-comment", { device_id: deviceId, text });
|
||||
appendLog([`[WEB] 已启动测试评论:device=${deviceId || '(auto)'}${text ? ' text=自定义' : ''}`]);
|
||||
}
|
||||
|
||||
async function stopRun() {
|
||||
await apiPost("/api/stop", {});
|
||||
appendLog(["[WEB] 已发送停止"]);
|
||||
}
|
||||
|
||||
async function pollLogs() {
|
||||
try {
|
||||
const data = await apiGet(`/api/logs?since=${logIdx}`);
|
||||
logIdx = data.next ?? logIdx;
|
||||
appendLog(data.lines || []);
|
||||
} catch (e) {
|
||||
appendLog([`[WEB] poll logs failed: ${e.message}`]);
|
||||
}
|
||||
}
|
||||
|
||||
async function pollReservations() {
|
||||
try {
|
||||
const data = await apiGet(`/api/reservations?t=${Date.now()}`);
|
||||
const container = $("reservationsContent");
|
||||
if (!container) return;
|
||||
// 保留上次滚动位置
|
||||
const prevList = container.querySelector('.reservationsList');
|
||||
const prevScroll = prevList ? prevList.scrollTop : 0;
|
||||
clearEl(container);
|
||||
|
||||
const reservations = data.reservations || [];
|
||||
const room_pos = data.room_pos || 0;
|
||||
const updated_ts = data.updated_ts || 0;
|
||||
const current_room_title = data.current_room_title || "";
|
||||
const current_room_title_raw = data.current_room_title_raw || "";
|
||||
const reason = data.reason || "";
|
||||
|
||||
// 显示基本信息
|
||||
const info = document.createElement("div");
|
||||
info.className = "reservationsInfo";
|
||||
info.innerHTML = `
|
||||
<div><strong>当前位置:</strong>${room_pos}</div>
|
||||
<div><strong>当前直播间(清洗后):</strong>${escapeHtml(current_room_title || '-') }</div>
|
||||
<div><strong>当前直播间原文:</strong>${escapeHtml(current_room_title_raw || '-') }</div>
|
||||
<div><strong>预约数量:</strong>${reservations.length}</div>
|
||||
<div class="hint">更新时间:${updated_ts > 0 ? new Date(updated_ts * 1000).toLocaleTimeString() : '-'}</div>
|
||||
<div class="hint">原因:${escapeHtml(reason || '-') }</div>
|
||||
`;
|
||||
container.appendChild(info);
|
||||
|
||||
if (reservations.length === 0) {
|
||||
const hint = document.createElement("div");
|
||||
hint.className = "hint";
|
||||
hint.textContent = "暂无预约信息";
|
||||
container.appendChild(hint);
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示预约列表
|
||||
const list = document.createElement("div");
|
||||
list.className = "reservationsList";
|
||||
|
||||
reservations.forEach((item, idx) => {
|
||||
const card = document.createElement("div");
|
||||
card.className = "reservationItem";
|
||||
|
||||
const now = Date.now() / 1000;
|
||||
const future_ts = item.future_ts || 0;
|
||||
const remain = Math.max(0, Math.floor(future_ts - now));
|
||||
const remainStr = remain > 0 ? `${Math.floor(remain / 60)}分${remain % 60}秒后` : "已到开奖时间";
|
||||
|
||||
card.innerHTML = `
|
||||
<div class="reservationHeader">
|
||||
<span class="reservationIndex">#${idx + 1}</span>
|
||||
<span class="reservationValue">${item.prize_value_yuan || 0}元</span>
|
||||
</div>
|
||||
<div class="reservationBody">
|
||||
<div><strong>内容:</strong>${escapeHtml(item.content || '-')}</div>
|
||||
<div><strong>开奖时间:</strong>${item.future_str || '-'}</div>
|
||||
<div><strong>剩余时间:</strong>${remainStr}</div>
|
||||
<div><strong>发现位置:</strong>${item.pos_seen || 0}</div>
|
||||
<div><strong>直播间(清洗后):</strong>${escapeHtml(item.room_title || '-')}</div>
|
||||
<div><strong>直播间原文:</strong>${escapeHtml(item.room_title_raw || '-')}</div>
|
||||
</div>
|
||||
`;
|
||||
list.appendChild(card);
|
||||
});
|
||||
|
||||
container.appendChild(list);
|
||||
// 恢复滚动位置(若有)
|
||||
try { list.scrollTop = prevScroll; } catch (e) { /* ignore */ }
|
||||
} catch (e) {
|
||||
console.error("poll reservations failed:", e);
|
||||
const container = $("reservationsContent");
|
||||
if (!container) return;
|
||||
clearEl(container);
|
||||
const hint = document.createElement("div");
|
||||
hint.className = "hint";
|
||||
hint.textContent = `预约信息获取失败:${e?.message || e}`;
|
||||
container.appendChild(hint);
|
||||
}
|
||||
}
|
||||
|
||||
async function pollHighValueRooms() {
|
||||
try {
|
||||
const data = await apiGet(`/api/high-value-rooms?t=${Date.now()}`);
|
||||
const container = $("highValueRoomsContent");
|
||||
if (!container) return;
|
||||
// 保留上次滚动位置
|
||||
const prevList = container.querySelector('.reservationsList');
|
||||
const prevScroll = prevList ? prevList.scrollTop : 0;
|
||||
clearEl(container);
|
||||
|
||||
const rooms = Array.isArray(data.rooms) ? data.rooms : [];
|
||||
const updated_ts = Number(data.updated_ts) || 0;
|
||||
const reason = String(data.reason || "");
|
||||
const total = Number(data.total) || rooms.length;
|
||||
|
||||
const info = document.createElement("div");
|
||||
info.className = "reservationsInfo";
|
||||
info.innerHTML = `
|
||||
<div><strong>记录数量:</strong>${total}</div>
|
||||
<div class="hint">更新时间:${updated_ts > 0 ? new Date(updated_ts * 1000).toLocaleTimeString() : '-'}</div>
|
||||
<div class="hint">原因:${escapeHtml(reason || '-') }</div>
|
||||
`;
|
||||
container.appendChild(info);
|
||||
|
||||
if (rooms.length === 0) {
|
||||
const hint = document.createElement("div");
|
||||
hint.className = "hint";
|
||||
hint.textContent = "暂无记录";
|
||||
container.appendChild(hint);
|
||||
return;
|
||||
}
|
||||
|
||||
const list = document.createElement("div");
|
||||
list.className = "reservationsList";
|
||||
|
||||
rooms.forEach((item, idx) => {
|
||||
const card = document.createElement("div");
|
||||
card.className = "reservationItem";
|
||||
|
||||
const roomTitle = String(item.room_title || "-");
|
||||
const roomRaw = String(item.room_title_raw_last || "-");
|
||||
const posSeen = (typeof item.pos_seen === "number") ? item.pos_seen : ((item.pos_seen === null || typeof item.pos_seen === "undefined") ? "-" : String(item.pos_seen));
|
||||
const firstSeen = Number(item.first_seen_ts) || 0;
|
||||
const lastSeen = Number(item.last_seen_ts) || 0;
|
||||
const seenCount = Number(item.seen_count) || 0;
|
||||
const maxVal = (item.max_prize_value_yuan === null || typeof item.max_prize_value_yuan === "undefined") ? "-" : String(item.max_prize_value_yuan);
|
||||
const lastVal = (item.last_prize_value_yuan === null || typeof item.last_prize_value_yuan === "undefined") ? "-" : String(item.last_prize_value_yuan);
|
||||
|
||||
card.innerHTML = `
|
||||
<div class="reservationHeader">
|
||||
<span class="reservationIndex">#${idx + 1}</span>
|
||||
<span class="reservationValue">max ${escapeHtml(maxVal)}元</span>
|
||||
</div>
|
||||
<div class="reservationBody">
|
||||
<div><strong>直播间(清洗后):</strong>${escapeHtml(roomTitle)}</div>
|
||||
<div><strong>直播间原文:</strong>${escapeHtml(roomRaw)}</div>
|
||||
<div><strong>最近位置:</strong>${escapeHtml(posSeen)}</div>
|
||||
<div><strong>首次记录:</strong>${escapeHtml(fmtTime(firstSeen))}</div>
|
||||
<div><strong>最近记录:</strong>${escapeHtml(fmtTime(lastSeen))}</div>
|
||||
<div><strong>记录次数:</strong>${escapeHtml(seenCount)}</div>
|
||||
<div><strong>最近价值:</strong>${escapeHtml(lastVal)}元</div>
|
||||
</div>
|
||||
`;
|
||||
// 让每条记录的 header 可点击以折叠/展开本条详情
|
||||
list.appendChild(card);
|
||||
try {
|
||||
const header = card.querySelector('.reservationHeader');
|
||||
const body = card.querySelector('.reservationBody');
|
||||
if (header && body) {
|
||||
header.style.cursor = 'pointer';
|
||||
header.addEventListener('click', () => {
|
||||
if (body.style.display === 'none') {
|
||||
body.style.display = '';
|
||||
} else {
|
||||
body.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
container.appendChild(list);
|
||||
// 恢复滚动位置(若有)
|
||||
try { list.scrollTop = prevScroll; } catch (e) { /* ignore */ }
|
||||
// 全局折叠/展开按钮绑定:折叠/展开整个列表(隐藏序号/条目),而不是仅隐藏每条的详情
|
||||
try {
|
||||
const btnExpand = $('hv_expand_all');
|
||||
const btnCollapse = $('hv_collapse_all');
|
||||
if (btnExpand) btnExpand.addEventListener('click', () => {
|
||||
const listEl = container.querySelector('.reservationsList');
|
||||
if (listEl) listEl.style.display = '';
|
||||
});
|
||||
if (btnCollapse) btnCollapse.addEventListener('click', () => {
|
||||
const listEl = container.querySelector('.reservationsList');
|
||||
if (listEl) listEl.style.display = 'none';
|
||||
});
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("poll high value rooms failed:", e);
|
||||
const container = $("highValueRoomsContent");
|
||||
if (!container) return;
|
||||
clearEl(container);
|
||||
const hint = document.createElement("div");
|
||||
hint.className = "hint";
|
||||
hint.textContent = `直播间记录获取失败:${e?.message || e}`;
|
||||
container.appendChild(hint);
|
||||
}
|
||||
}
|
||||
|
||||
async function pollStats() {
|
||||
try {
|
||||
const s = await apiGet(`/api/stats?t=${Date.now()}`);
|
||||
const running = s.running ? "运行中" : "未运行";
|
||||
setTextIfExists("statRunning", running);
|
||||
setTextIfExists("statPid", s.pid ?? "-");
|
||||
setTextIfExists("statUptime", fmtDuration(s.uptime_seconds));
|
||||
setTextIfExists("statLogLen", s.log_len ?? "-");
|
||||
if ($("statLogCap")) {
|
||||
const cap = s.log_capacity ?? 2000;
|
||||
const len = s.log_len ?? 0;
|
||||
$("statLogCap").textContent = `缓存上限:${cap}(已用 ${len}/${cap})`;
|
||||
}
|
||||
setTextIfExists("statLastLog", fmtTime(s.last_log_ts));
|
||||
setTextIfExists("statExitCode", (s.exit_code === null || typeof s.exit_code === "undefined") ? "-" : s.exit_code);
|
||||
|
||||
const c = s.counters || {};
|
||||
const getC = (k) => Number.isFinite(Number(c[k])) ? Number(c[k]) : 0;
|
||||
|
||||
setTextIfExists("statFudaiSeen", getC("fudai_seen"));
|
||||
setTextIfExists("statFudaiOpen", getC("fudai_open_detail"));
|
||||
setTextIfExists("statFudaiAttendOk", getC("fudai_attend_ok"));
|
||||
setTextIfExists("statFudaiAttendFail", getC("fudai_attend_fail"));
|
||||
setTextIfExists("statFudaiNoWin", getC("fudai_result_no_win"));
|
||||
setTextIfExists("statFudaiWin", getC("fudai_result_win"));
|
||||
|
||||
setTextIfExists("statSkipValueLow", getC("fudai_skip_value_low"));
|
||||
|
||||
const pLow = getC("fudai_skip_participants_low");
|
||||
const pHigh = getC("fudai_skip_participants_high");
|
||||
setTextIfExists("statSkipParticipants", pLow + pHigh);
|
||||
if ($("statSkipParticipantsHint")) {
|
||||
$("statSkipParticipantsHint").textContent = `低:${pLow} / 高:${pHigh}`;
|
||||
}
|
||||
|
||||
setTextIfExists("statSkipContent", getC("fudai_skip_content"));
|
||||
|
||||
const cdShort = getC("fudai_skip_countdown_short");
|
||||
const cdLong = getC("fudai_skip_countdown_long");
|
||||
setTextIfExists("statSkipCountdown", cdShort + cdLong);
|
||||
if ($("statSkipCountdownHint")) {
|
||||
$("statSkipCountdownHint").textContent = `短:${cdShort} / 长:${cdLong}`;
|
||||
}
|
||||
|
||||
const fcReq = getC("fansclub_required");
|
||||
const fcManual = getC("fansclub_manual_needed");
|
||||
const fcUn = getC("fansclub_unresolved");
|
||||
setTextIfExists("statFansclub", fcReq);
|
||||
if ($("statFansclubHint")) {
|
||||
$("statFansclubHint").textContent = `需手动:${fcManual} / 未解决:${fcUn}`;
|
||||
}
|
||||
|
||||
const sw = getC("switch_room");
|
||||
setTextIfExists("statSwitchRoom", sw);
|
||||
if ($("statSwitchRoomHint")) {
|
||||
const parts = [
|
||||
`无福袋:${getC("switch_room_no_fudai")}`,
|
||||
`人数:${getC("switch_room_participants")}`,
|
||||
`价值:${getC("switch_room_value")}`,
|
||||
`内容:${getC("switch_room_content")}`,
|
||||
`倒计时:${getC("switch_room_countdown")}`,
|
||||
`参与失败:${getC("switch_room_attend_fail")}`,
|
||||
];
|
||||
$("statSwitchRoomHint").textContent = parts.join(" / ");
|
||||
}
|
||||
|
||||
const last = s.fudai_last || {};
|
||||
setTextIfExists("statLastContent", last.content || "-");
|
||||
setTextIfExists("statLastCountdown", last.countdown || "-");
|
||||
const ppl = (typeof last.participants === "number") ? String(last.participants) : "-";
|
||||
const cop = (typeof last.copies === "number") ? String(last.copies) : "-";
|
||||
setTextIfExists("statLastPeople", `${ppl} / ${cop}`);
|
||||
const val = (typeof last.prize_value_yuan === "number") ? String(last.prize_value_yuan) : "-";
|
||||
setTextIfExists("statLastValue", val);
|
||||
if ($("statLastUpdated")) {
|
||||
$("statLastUpdated").textContent = last.updated_ts ? `更新时间:${fmtTime(last.updated_ts)}` : "更新时间:-";
|
||||
}
|
||||
|
||||
// ====== 详细聚合渲染(趋势/分布/Top) ======
|
||||
const agg = s.agg || {};
|
||||
const reasonName = {
|
||||
value_low: "价值过低",
|
||||
participants_low: "人数过少",
|
||||
participants_high: "人数过多",
|
||||
content: "内容不匹配",
|
||||
countdown_short: "倒计时太短",
|
||||
countdown_long: "倒计时太长",
|
||||
unknown: "未知",
|
||||
};
|
||||
const switchName = {
|
||||
no_fudai: "无福袋",
|
||||
participants: "人数不符合",
|
||||
value: "价值不符合",
|
||||
content: "内容不符合",
|
||||
countdown: "倒计时不符合",
|
||||
attend_fail: "参与失败",
|
||||
unknown: "未知",
|
||||
};
|
||||
|
||||
renderTimeline("chartTimeline", agg.timeline);
|
||||
renderBars("chartSkipReason", agg.skip_reason || {}, reasonName);
|
||||
renderBars("chartSwitchReason", agg.switch_reason || {}, switchName);
|
||||
renderBars("chartValueBuckets", agg.value_buckets || {});
|
||||
renderBars("chartParticipantsBuckets", agg.participants_buckets || {});
|
||||
renderBars("chartCountdownBuckets", agg.countdown_buckets || {});
|
||||
renderTopContent("tableTopContent", agg.content_top || []);
|
||||
|
||||
// ====== 中奖内容列表 ======
|
||||
renderWinsTable("tableWins", s.wins || []);
|
||||
} catch (e) {
|
||||
// 统计失败不打断其他功能
|
||||
}
|
||||
}
|
||||
|
||||
function startPolling() {
|
||||
if (pollTimer) clearInterval(pollTimer);
|
||||
pollTimer = setInterval(pollLogs, 700);
|
||||
}
|
||||
|
||||
function startStatsPolling() {
|
||||
if (statsTimer) clearInterval(statsTimer);
|
||||
statsTimer = setInterval(() => {
|
||||
pollStats();
|
||||
pollReservations();
|
||||
pollHighValueRooms();
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", async () => {
|
||||
initTabs();
|
||||
$("btnRefresh").addEventListener("click", refreshDevices);
|
||||
$("btnLoad").addEventListener("click", async () => { await loadConfig(); });
|
||||
$("btnSave").addEventListener("click", async () => { await saveConfig(); });
|
||||
$("btnStart").addEventListener("click", async () => { await startRun(); });
|
||||
$("btnStop").addEventListener("click", async () => { await stopRun(); });
|
||||
|
||||
await refreshDevices();
|
||||
await loadConfig();
|
||||
|
||||
startPolling();
|
||||
startStatsPolling();
|
||||
startShotPolling();
|
||||
pollLogs();
|
||||
pollStats();
|
||||
pollShot();
|
||||
pollReservations();
|
||||
pollHighValueRooms();
|
||||
});
|
||||
@@ -0,0 +1,665 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>抖音挂机 - Web GUI</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
<header class="header">
|
||||
<div>
|
||||
<div class="title">抖音挂机控制台</div>
|
||||
<div class="subtitle">配置与运行(纯坐标点击)</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<button id="btnStart" class="btn btnPrimary">
|
||||
<span class="btnIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4v16l13-8z"/></svg>
|
||||
</span>
|
||||
开始运行
|
||||
</button>
|
||||
<button id="btnRefresh" class="btn">
|
||||
<span class="btnIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-2.64-6.36"/><path d="M21 3v6h-6"/></svg>
|
||||
</span>
|
||||
刷新设备
|
||||
</button>
|
||||
<button id="btnLoad" class="btn">
|
||||
<span class="btnIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="M7 10l5 5 5-5"/><path d="M12 15V3"/></svg>
|
||||
</span>
|
||||
加载配置
|
||||
</button>
|
||||
<button id="btnSave" class="btn btnPrimary">
|
||||
<span class="btnIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h11l5 5v9a2 2 0 0 1-2 2z"/><path d="M17 21v-8H7v8"/><path d="M7 3v5h8"/></svg>
|
||||
</span>
|
||||
保存配置
|
||||
</button>
|
||||
<button id="btnStop" class="btn btnDanger">
|
||||
<span class="btnIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>
|
||||
</span>
|
||||
停止
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="grid">
|
||||
<section class="card cardScroll cardConfig">
|
||||
<div class="cardTitle">
|
||||
<span class="sectionIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 .31 1.7 1.7 0 0 0-.82 1.46V21a2 2 0 0 1-4 0v-.09a1.7 1.7 0 0 0-.82-1.46 1.7 1.7 0 0 0-1-.31 1.7 1.7 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-.31-1 1.7 1.7 0 0 0-1.46-.82H2a2 2 0 0 1 0-4h.09a1.7 1.7 0 0 0 1.46-.82 1.7 1.7 0 0 0 .31-1 1.7 1.7 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.7 1.7 0 0 0 9 4.6a1.7 1.7 0 0 0 1-.31 1.7 1.7 0 0 0 .82-1.46V2a2 2 0 0 1 4 0v.09a1.7 1.7 0 0 0 .82 1.46 1.7 1.7 0 0 0 1 .31 1.7 1.7 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.7 1.7 0 0 0 19.4 9a1.7 1.7 0 0 0 .31 1 1.7 1.7 0 0 0 1.46.82H22a2 2 0 0 1 0 4h-.09a1.7 1.7 0 0 0-1.46.82 1.7 1.7 0 0 0-.31 1z"/></svg>
|
||||
</span>
|
||||
配置
|
||||
</div>
|
||||
|
||||
<div class="configLayout">
|
||||
<nav class="sideNav" role="tablist" aria-label="配置分类">
|
||||
<button class="tabBtn active" type="button" data-target="device" role="tab" aria-selected="true">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 19h2"/></svg></span>
|
||||
<span class="tabText">设备</span>
|
||||
</button>
|
||||
<button class="tabBtn" type="button" data-target="run" role="tab" aria-selected="false">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M12 4h9"/><path d="M4 9h16"/><path d="M4 15h16"/><circle cx="8" cy="9" r="2"/><circle cx="8" cy="15" r="2"/></svg></span>
|
||||
<span class="tabText">运行</span>
|
||||
</button>
|
||||
<button class="tabBtn" type="button" data-target="filter" role="tab" aria-selected="false">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 3H2l8 9v7l4 2v-9z"/></svg></span>
|
||||
<span class="tabText">筛选</span>
|
||||
</button>
|
||||
<button class="tabBtn" type="button" data-target="stats" role="tab" aria-selected="false">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19V5"/><path d="M20 19V5"/><path d="M8 17v-6"/><path d="M12 17V9"/><path d="M16 17V7"/></svg></span>
|
||||
<span class="tabText">统计</span>
|
||||
</button>
|
||||
<button class="tabBtn" type="button" data-target="yanghao" role="tab" aria-selected="false">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.8 4.6c-1.4-1.4-3.7-1.4-5.1 0L12 8.3 8.3 4.6c-1.4-1.4-3.7-1.4-5.1 0s-1.4 3.7 0 5.1L12 18.5l8.8-8.8c1.4-1.4 1.4-3.7 0-5.1z"/></svg></span>
|
||||
<span class="tabText">养号</span>
|
||||
</button>
|
||||
<button class="tabBtn" type="button" data-target="keywords" role="tab" aria-selected="false">
|
||||
<span class="tabIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0z"/><path d="M21 21l-6-6"/></svg></span>
|
||||
<span class="tabText">关键词</span>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<div class="panels">
|
||||
<div class="panel active" data-panel="device" role="tabpanel">
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 19h2"/></svg></span>
|
||||
设备
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">设备</label>
|
||||
<select id="device" class="input"></select>
|
||||
<div class="hint" id="adbStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" data-panel="run" role="tabpanel" hidden>
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M12 4h9"/><path d="M4 9h16"/><path d="M4 15h16"/><circle cx="8" cy="9" r="2"/><circle cx="8" cy="15" r="2"/></svg></span>
|
||||
运行参数
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">Y偏移</label>
|
||||
<input id="y_pianyi" class="input" type="number" min="-200" max="200" step="1" value="0" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">倒计时阈值(分钟)</label>
|
||||
<input id="wait_minutes" class="input" type="number" min="1" max="60" step="1" value="5" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">允许切换直播间(needswitch)</label>
|
||||
<label class="check">
|
||||
<input id="needswitch" type="checkbox" checked />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">切换 N 次后回到第一个(开关)</label>
|
||||
<label class="check">
|
||||
<input id="reset_after_swipes_enabled" type="checkbox" data-key="reset_after_swipes_enabled" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">切换 N 次后回到第一个(次数)</label>
|
||||
<input id="reset_after_swipes" class="input" data-key="reset_after_swipes" data-type="int" type="number" min="1" step="1" />
|
||||
<div class="hint">用于需要循环切换时的回退阈值;配合上方开关启用</div>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">福袋图标等待最大秒数</label>
|
||||
<input id="fudai_icon_max_wait_seconds" class="input" data-key="fudai_icon_max_wait_seconds" data-type="float" type="number" min="0" step="0.1" />
|
||||
<div class="hint">默认 4.0 秒;自适应可缩短该等待时间</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">启用自适应等待时间</label>
|
||||
<label class="check">
|
||||
<input id="fudai_icon_adaptive_enabled" type="checkbox" data-key="fudai_icon_adaptive_enabled" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" data-panel="filter" role="tabpanel" hidden>
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 3H2l8 9v7l4 2v-9z"/></svg></span>
|
||||
筛选设置
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">最低价值(元)</label>
|
||||
<input id="min_prize_value_yuan" class="input" data-key="min_prize_value_yuan" data-type="float" type="number" min="0" step="0.1" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">倒计时小于(秒)跳过</label>
|
||||
<input id="skip_if_countdown_lt_seconds" class="input" data-key="skip_if_countdown_lt_seconds" data-type="int" type="number" min="0" max="120" step="1" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">参与人数最小</label>
|
||||
<input id="min_participants" class="input" data-key="min_participants" data-type="int" type="number" min="0" step="1" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">参与人数最大</label>
|
||||
<input id="max_participants" class="input" data-key="max_participants" data-type="int" type="number" min="0" step="1" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">自动加入粉丝团(谨慎)</label>
|
||||
<label class="check">
|
||||
<input id="auto_join_fansclub" type="checkbox" data-key="auto_join_fansclub" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">粉丝团失败策略</label>
|
||||
<select id="fansclub_fail_action" class="input" data-key="fansclub_fail_action" data-type="str">
|
||||
<option value="stay">stay</option>
|
||||
<option value="switch">switch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">高价值福袋预约参与</div>
|
||||
<div class="row">
|
||||
<label class="label">启用预约(价值≥阈值)</label>
|
||||
<label class="check">
|
||||
<input id="high_value_fudai_enabled" type="checkbox" data-key="high_value_fudai_enabled" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">价值阈值(元)</label>
|
||||
<input id="high_value_fudai_threshold_yuan" class="input" data-key="high_value_fudai_threshold_yuan" data-type="float" type="number" min="0" step="1" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">提前参与(秒)</label>
|
||||
<input id="high_value_fudai_join_ahead_seconds" class="input" data-key="high_value_fudai_join_ahead_seconds" data-type="int" type="number" min="5" max="900" step="1" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">最多回退直播间次数</label>
|
||||
<input id="high_value_fudai_max_swipe_back" class="input" data-key="high_value_fudai_max_swipe_back" data-type="int" type="number" min="0" max="300" step="1" />
|
||||
<div class="hint">防止预约期间切换太远导致回退过慢/异常;0 表示不限制</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">最多记录数量</label>
|
||||
<input id="high_value_fudai_max_reservations" class="input" data-key="high_value_fudai_max_reservations" data-type="int" type="number" min="1" max="50" step="1" />
|
||||
<div class="hint">超过后丢弃最晚开奖的预约</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">完成后策略</label>
|
||||
<select id="high_value_fudai_after_action" class="input" data-key="high_value_fudai_after_action" data-type="str">
|
||||
<option value="continue">continue</option>
|
||||
<option value="stay">stay</option>
|
||||
</select>
|
||||
<div class="hint">stay:停留当前直播间;continue:继续抢福袋</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">启用高价值直播间定时回访</label>
|
||||
<label class="check">
|
||||
<input id="high_value_room_revisit_enabled" type="checkbox" data-key="high_value_room_revisit_enabled" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">仅回访本次运行记录的直播间</label>
|
||||
<label class="check">
|
||||
<input id="high_value_room_revisit_only_current_run" type="checkbox" data-key="high_value_room_revisit_only_current_run" data-type="bool" />
|
||||
<span>仅本次运行</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">预约回退后校验(回退校验开关)</label>
|
||||
<label class="check">
|
||||
<input id="reservation_back_verify_enabled" type="checkbox" data-key="reservation_back_verify_enabled" data-type="bool" />
|
||||
<span>启用回退校验</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">定时禁抢(仅养号)</div>
|
||||
<div class="row">
|
||||
<label class="label">启用定时禁抢</label>
|
||||
<label class="check">
|
||||
<input id="fudai_quiet_hours_enabled" type="checkbox" data-key="fudai_quiet_hours_enabled" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">开始小时</label>
|
||||
<input id="fudai_quiet_start_hour" class="input" data-key="fudai_quiet_start_hour" data-type="int" type="number" min="0" max="23" step="1" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">结束小时</label>
|
||||
<input id="fudai_quiet_end_hour" class="input" data-key="fudai_quiet_end_hour" data-type="int" type="number" min="0" max="23" step="1" />
|
||||
<div class="hint">区间为 [开始, 结束),例如 2-7 表示 2:00~6:59</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" data-panel="stats" role="tabpanel" hidden>
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19V5"/><path d="M20 19V5"/><path d="M8 17v-6"/><path d="M12 17V9"/><path d="M16 17V7"/></svg></span>
|
||||
运行统计
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">福袋中奖内容(最近20条)</div>
|
||||
<div class="table" id="tableWins"></div>
|
||||
|
||||
<div class="statsGrid">
|
||||
<div class="stat">
|
||||
<div class="statLabel">运行状态</div>
|
||||
<div id="statRunning" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">PID</div>
|
||||
<div id="statPid" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">运行时长</div>
|
||||
<div id="statUptime" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">日志行数</div>
|
||||
<div id="statLogLen" class="statValue">-</div>
|
||||
<div class="statHint" id="statLogCap">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">最近日志时间</div>
|
||||
<div id="statLastLog" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">退出码</div>
|
||||
<div id="statExitCode" class="statValue">-</div>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:识别次数</div>
|
||||
<div id="statFudaiSeen" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:打开详情</div>
|
||||
<div id="statFudaiOpen" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:参与成功/已参与</div>
|
||||
<div id="statFudaiAttendOk" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:参与失败</div>
|
||||
<div id="statFudaiAttendFail" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:未中奖次数</div>
|
||||
<div id="statFudaiNoWin" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:中奖次数</div>
|
||||
<div id="statFudaiWin" class="statValue">-</div>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:跳过(价值低)</div>
|
||||
<div id="statSkipValueLow" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:跳过(人数低/高)</div>
|
||||
<div id="statSkipParticipants" class="statValue">-</div>
|
||||
<div class="statHint" id="statSkipParticipantsHint">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:跳过(内容不理想)</div>
|
||||
<div id="statSkipContent" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">福袋:跳过(倒计时短/长)</div>
|
||||
<div id="statSkipCountdown" class="statValue">-</div>
|
||||
<div class="statHint" id="statSkipCountdownHint">-</div>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<div class="statLabel">粉丝团门槛</div>
|
||||
<div id="statFansclub" class="statValue">-</div>
|
||||
<div class="statHint" id="statFansclubHint">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">切换直播间次数</div>
|
||||
<div id="statSwitchRoom" class="statValue">-</div>
|
||||
<div class="statHint" id="statSwitchRoomHint">-</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">最近识别到的福袋</div>
|
||||
<div class="statsGrid">
|
||||
<div class="stat">
|
||||
<div class="statLabel">内容</div>
|
||||
<div id="statLastContent" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">倒计时</div>
|
||||
<div id="statLastCountdown" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">参与人数 / 份数</div>
|
||||
<div id="statLastPeople" class="statValue">-</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="statLabel">奖品价值(元)</div>
|
||||
<div id="statLastValue" class="statValue">-</div>
|
||||
<div class="statHint" id="statLastUpdated">-</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">趋势(最近2小时,5分钟粒度)</div>
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">福袋关键动作趋势</div>
|
||||
<div id="chartTimeline" class="chart"></div>
|
||||
<div class="hint">展示:打开详情 / 参与成功 / 参与失败 / 中奖 / 未中奖 / 跳过 / 切换直播间</div>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">分布</div>
|
||||
<div class="chartsGrid">
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">跳过原因</div>
|
||||
<div id="chartSkipReason" class="chart"></div>
|
||||
</div>
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">切换直播间原因</div>
|
||||
<div id="chartSwitchReason" class="chart"></div>
|
||||
</div>
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">奖品价值区间(元)</div>
|
||||
<div id="chartValueBuckets" class="chart"></div>
|
||||
</div>
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">参与人数区间</div>
|
||||
<div id="chartParticipantsBuckets" class="chart"></div>
|
||||
</div>
|
||||
<div class="chartBlock">
|
||||
<div class="chartTitle">倒计时区间(秒)</div>
|
||||
<div id="chartCountdownBuckets" class="chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sectionTitle">Top 福袋内容</div>
|
||||
<div class="table" id="tableTopContent"></div>
|
||||
</div>
|
||||
|
||||
<div class="panel" data-panel="yanghao" role="tabpanel" hidden>
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.8 4.6c-1.4-1.4-3.7-1.4-5.1 0L12 8.3 8.3 4.6c-1.4-1.4-3.7-1.4-5.1 0s-1.4 3.7 0 5.1L12 18.5l8.8-8.8c1.4-1.4 1.4-3.7 0-5.1z"/></svg></span>
|
||||
推荐页养号(爱心/收藏/评论)
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">养号总开关(关闭=不跑推荐页养号)</label>
|
||||
<label class="check">
|
||||
<input id="yanghao_enabled" type="checkbox" data-key="yanghao_enabled" data-type="bool" checked />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">养号动作开关(爱心/收藏/评论)</label>
|
||||
<label class="check">
|
||||
<input id="yanghao_enable_actions" type="checkbox" data-key="yanghao_enable_actions" data-type="bool" checked />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">逐步截图(调试用)</label>
|
||||
<label class="check">
|
||||
<input id="yanghao_step_screenshot" type="checkbox" data-key="yanghao_step_screenshot" data-type="bool" />
|
||||
<span>启用</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">养号时长(秒)</label>
|
||||
<input id="yanghao_recommend_duration_seconds" class="input" data-key="yanghao_recommend_duration_seconds" data-type="int" type="number" min="1" max="3600" step="5" value="60" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">养号间隔(秒)</label>
|
||||
<input id="yanghao_recommend_interval_seconds" class="input" data-key="yanghao_recommend_interval_seconds" data-type="int" type="number" min="0" max="3600" step="10" value="0" />
|
||||
<div class="hint">0 表示每次触发都执行</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row grid3">
|
||||
<div>
|
||||
<label class="label">爱心概率</label>
|
||||
<input id="yanghao_like_prob" class="input" data-key="yanghao_like_prob" data-type="float" type="number" min="0" max="1" step="0.01" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">收藏概率</label>
|
||||
<input id="yanghao_fav_prob" class="input" data-key="yanghao_fav_prob" data-type="float" type="number" min="0" max="1" step="0.01" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">评论概率</label>
|
||||
<input id="yanghao_comment_prob" class="input" data-key="yanghao_comment_prob" data-type="float" type="number" min="0" max="1" step="0.01" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">图标 ROI 大小(px)</label>
|
||||
<input id="yanghao_icon_roi_size" class="input" data-key="yanghao_icon_roi_size" data-type="int" type="number" min="80" max="600" step="10" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">匹配阈值</label>
|
||||
<input id="yanghao_icon_match_threshold" class="input" data-key="yanghao_icon_match_threshold" data-type="float" type="number" min="0" max="1" step="0.01" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">爱心图标坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_like_icon_x" class="input" data-key="yanghao_like_icon_x" data-type="int" type="number" />
|
||||
<input id="yanghao_like_icon_y" class="input" data-key="yanghao_like_icon_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">收藏图标坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_fav_icon_x" class="input" data-key="yanghao_fav_icon_x" data-type="int" type="number" />
|
||||
<input id="yanghao_fav_icon_y" class="input" data-key="yanghao_fav_icon_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">爱心 ROI 偏移(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_like_roi_offset_x" class="input" data-key="yanghao_like_roi_offset_x" data-type="int" type="number" />
|
||||
<input id="yanghao_like_roi_offset_y" class="input" data-key="yanghao_like_roi_offset_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">收藏 ROI 偏移(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_fav_roi_offset_x" class="input" data-key="yanghao_fav_roi_offset_x" data-type="int" type="number" />
|
||||
<input id="yanghao_fav_roi_offset_y" class="input" data-key="yanghao_fav_roi_offset_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">爱心模板路径</label>
|
||||
<input id="yanghao_like_template_path" class="input" data-key="yanghao_like_template_path" data-type="str" type="text" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">收藏模板路径</label>
|
||||
<input id="yanghao_fav_template_path" class="input" data-key="yanghao_fav_template_path" data-type="str" type="text" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">评论按钮坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_comment_btn_x" class="input" data-key="yanghao_comment_btn_x" data-type="int" type="number" />
|
||||
<input id="yanghao_comment_btn_y" class="input" data-key="yanghao_comment_btn_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">评论输入框坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_comment_input_x" class="input" data-key="yanghao_comment_input_x" data-type="int" type="number" />
|
||||
<input id="yanghao_comment_input_y" class="input" data-key="yanghao_comment_input_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">评论发送坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_comment_send_x" class="input" data-key="yanghao_comment_send_x" data-type="int" type="number" />
|
||||
<input id="yanghao_comment_send_y" class="input" data-key="yanghao_comment_send_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">评论关闭坐标(x,y)</label>
|
||||
<div class="inline2">
|
||||
<input id="yanghao_comment_close_x" class="input" data-key="yanghao_comment_close_x" data-type="int" type="number" />
|
||||
<input id="yanghao_comment_close_y" class="input" data-key="yanghao_comment_close_y" data-type="int" type="number" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">停留后滑动方向</label>
|
||||
<select id="yanghao_after_dwell_swipe_direction" class="input" data-key="yanghao_after_dwell_swipe_direction" data-type="str">
|
||||
<option value="up">up</option>
|
||||
<option value="down">down</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">停留后滑动距离(px)</label>
|
||||
<input id="yanghao_after_dwell_swipe_distance_px" class="input" data-key="yanghao_after_dwell_swipe_distance_px" data-type="int" type="number" min="100" max="2000" step="10" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label class="label">评论文案库(每行一个)</label>
|
||||
<textarea id="yanghao_comment_texts" class="input textarea" data-key="yanghao_comment_texts" data-type="list_lines" rows="6"></textarea>
|
||||
</div>
|
||||
<div class="row grid2">
|
||||
<div>
|
||||
<label class="label">爱心关键词(每行一个)</label>
|
||||
<textarea id="yanghao_like_keywords" class="input textarea" data-key="yanghao_like_keywords" data-type="list_lines" rows="4"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label">收藏关键词(每行一个)</label>
|
||||
<textarea id="yanghao_fav_keywords" class="input textarea" data-key="yanghao_fav_keywords" data-type="list_lines" rows="4"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel" data-panel="keywords" role="tabpanel" hidden>
|
||||
<div class="sectionTitle">
|
||||
<span class="sectionIcon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0z"/><path d="M21 21l-6-6"/></svg></span>
|
||||
关键词(每行一个)
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">想要 contains_want</label>
|
||||
<textarea id="contains_want" class="input textarea" data-key="contains_want" data-type="list_lines" rows="5"></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="label">不想要 contains_not_want</label>
|
||||
<textarea id="contains_not_want" class="input textarea" data-key="contains_not_want" data-type="list_lines" rows="5"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card cardShot">
|
||||
<div class="cardTitle">
|
||||
<span class="sectionIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 15l3-3 3 3 5-5"/></svg>
|
||||
</span>
|
||||
实时截图
|
||||
</div>
|
||||
<div class="preview">
|
||||
<img id="liveShot" alt="实时截图预览" src="/pic/screenshot.png" />
|
||||
</div>
|
||||
<div class="hint" id="liveShotStatus">等待截图…</div>
|
||||
</section>
|
||||
|
||||
<section class="card cardReservations">
|
||||
<div class="cardTitle">
|
||||
<span class="sectionIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
|
||||
</span>
|
||||
预约队列
|
||||
</div>
|
||||
<div id="reservationsContent" class="reservationsContent">
|
||||
<div class="hint">暂无预约信息</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
<details open>
|
||||
<summary class="sectionTitle">已记录直播间(高价值)
|
||||
<span style="float:right; font-weight:normal; font-size:13px; margin-left:8px">
|
||||
<button id="hv_expand_all" class="btn small">展开全部</button>
|
||||
<button id="hv_collapse_all" class="btn small">折叠全部</button>
|
||||
</span>
|
||||
</summary>
|
||||
<div id="highValueRoomsContent" class="reservationsContent">
|
||||
<div class="hint">暂无记录</div>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<section class="card cardLog">
|
||||
<div class="cardTitle">
|
||||
<span class="sectionIcon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16v16H4z"/><path d="M8 8h8"/><path d="M8 12h8"/><path d="M8 16h6"/></svg>
|
||||
</span>
|
||||
日志
|
||||
</div>
|
||||
<pre id="log" class="log"></pre>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,534 @@
|
||||
:root {
|
||||
--bg: #f6f7fb;
|
||||
--card: #ffffff;
|
||||
--card2: #fbfcfe;
|
||||
--border: #e6e8ef;
|
||||
--text: #111827;
|
||||
--muted: #6b7280;
|
||||
--primary: #2563eb;
|
||||
--danger: #dc2626;
|
||||
--shadow: 0 12px 30px rgba(17,24,39,0.08);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html, body { height: 100%; }
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
|
||||
background: radial-gradient(1200px 600px at 18% 10%, rgba(37,99,235,0.10), transparent 55%),
|
||||
radial-gradient(900px 520px at 82% 16%, rgba(220,38,38,0.07), transparent 60%),
|
||||
var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.app { max-width: 1360px; margin: 0 auto; padding: 16px; }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid var(--border);
|
||||
background: linear-gradient(180deg, var(--card2), var(--card));
|
||||
border-radius: 14px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.title { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
|
||||
.subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
|
||||
|
||||
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
|
||||
|
||||
.grid {
|
||||
margin-top: 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cardLog { order: 0; }
|
||||
.cardShot { order: 1; }
|
||||
.cardConfig { order: 2; }
|
||||
|
||||
/* 关键:避免日志超长行撑爆 grid 导致页面变形 */
|
||||
.grid > * { min-width: 0; }
|
||||
|
||||
.card {
|
||||
border: 1px solid var(--border);
|
||||
background: linear-gradient(180deg, var(--card2), var(--card));
|
||||
border-radius: 14px;
|
||||
padding: 12px;
|
||||
min-height: 520px;
|
||||
box-shadow: var(--shadow);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.cardScroll { max-height: calc(100vh - 132px); overflow: auto; }
|
||||
|
||||
.configLayout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.sideNav {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
background: var(--card);
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 8px;
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@supports ((-webkit-backdrop-filter: blur(6px)) or (backdrop-filter: blur(6px))) {
|
||||
.sideNav {
|
||||
background: rgba(255,255,255,0.78);
|
||||
-webkit-backdrop-filter: blur(6px);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
}
|
||||
|
||||
.tabBtn {
|
||||
border: 1px solid transparent;
|
||||
background: transparent;
|
||||
color: rgba(17,24,39,0.78);
|
||||
border-radius: 12px;
|
||||
padding: 8px 10px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
min-height: 40px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.tabText { font-size: 12px; line-height: 1; }
|
||||
|
||||
.tabBtn:hover { background: #eef2ff; color: rgba(17,24,39,0.92); }
|
||||
|
||||
.tabBtn.active {
|
||||
background: #eaf0ff;
|
||||
color: rgba(17,24,39,0.92);
|
||||
border-color: rgba(37,99,235,0.30);
|
||||
box-shadow: 0 6px 16px rgba(37,99,235,0.10);
|
||||
}
|
||||
|
||||
.tabIcon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
display: inline-flex;
|
||||
color: rgba(37,99,235,0.85);
|
||||
}
|
||||
|
||||
.tabIcon svg { width: 18px; height: 18px; }
|
||||
|
||||
.panels { min-width: 0; }
|
||||
|
||||
.panel { padding-top: 2px; }
|
||||
|
||||
.panel[hidden] { display: none; }
|
||||
|
||||
.cardTitle {
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
font-size: 13px;
|
||||
color: rgba(17,24,39,0.88);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sectionTitle {
|
||||
margin: 14px 0 8px;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
color: rgba(17,24,39,0.78);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sectionIcon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: #6b7280;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.sectionIcon svg { width: 18px; height: 18px; }
|
||||
|
||||
.row { margin-bottom: 10px; }
|
||||
.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
|
||||
.input {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: #ffffff;
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
font-size: 13px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.input:focus { border-color: rgba(37,99,235,0.65); box-shadow: 0 0 0 3px rgba(37,99,235,0.16); }
|
||||
|
||||
.textarea { resize: vertical; min-height: 110px; }
|
||||
|
||||
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
|
||||
|
||||
.rowActions { display: flex; gap: 10px; flex-wrap: wrap; }
|
||||
.rowActions .btn { flex: 1 1 140px; }
|
||||
|
||||
.btn {
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: #f3f4f6;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.btn:hover { background: #e9edf3; }
|
||||
.btn:active { transform: translateY(1px); }
|
||||
|
||||
.btnPrimary { background: var(--primary); border-color: rgba(37,99,235,0.65); color: #ffffff; }
|
||||
.btnPrimary:hover { filter: brightness(0.96); }
|
||||
|
||||
.btnDanger { background: var(--danger); border-color: rgba(220,38,38,0.55); color: #ffffff; }
|
||||
.btnDanger:hover { filter: brightness(0.96); }
|
||||
|
||||
.btnIcon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.btnIcon svg { width: 18px; height: 18px; }
|
||||
|
||||
.divider { height: 1px; background: var(--border); margin: 12px 0; }
|
||||
|
||||
.log {
|
||||
height: 100%;
|
||||
min-height: 500px;
|
||||
max-height: 650px;
|
||||
overflow: auto;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: #0b1220;
|
||||
color: rgba(255,255,255,0.92);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.preview {
|
||||
border: 1px solid var(--border);
|
||||
background: #f3f4f6;
|
||||
border-radius: 12px;
|
||||
padding: 8px;
|
||||
height: 260px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.cardShot .preview {
|
||||
height: min(520px, 60vh);
|
||||
}
|
||||
|
||||
/* 移除旧的 stickyBar(开始运行已在顶部栏) */
|
||||
|
||||
.preview img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.grid { flex-direction: column; }
|
||||
.card { min-height: unset; }
|
||||
.log { min-height: 360px; }
|
||||
.configLayout { grid-template-columns: 1fr; }
|
||||
.sideNav { position: static; flex-wrap: nowrap; }
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.app { padding: 12px; }
|
||||
.header-actions { gap: 8px; }
|
||||
.btn { padding: 9px 10px; }
|
||||
}
|
||||
|
||||
.grid2 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.grid3 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.inline2 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.statsGrid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.stat {
|
||||
border: 1px solid var(--border);
|
||||
background: linear-gradient(180deg, var(--card2), var(--card));
|
||||
border-radius: 12px;
|
||||
padding: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.statLabel {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.statValue {
|
||||
font-weight: 800;
|
||||
font-size: 14px;
|
||||
color: rgba(17,24,39,0.92);
|
||||
}
|
||||
|
||||
.statHint {
|
||||
margin-top: 6px;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.chartsGrid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.chartsGrid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.chartBlock {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(180deg, var(--card2), var(--card));
|
||||
padding: 12px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.chartTitle {
|
||||
font-weight: 800;
|
||||
font-size: 12px;
|
||||
color: rgba(17,24,39,0.88);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.chart {
|
||||
width: 100%;
|
||||
min-height: 140px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.barRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.barLabel {
|
||||
width: 190px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: rgba(17,24,39,0.78);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.barTrack {
|
||||
flex: 1;
|
||||
height: 10px;
|
||||
border-radius: 999px;
|
||||
background: #ffffff;
|
||||
border: 1px solid var(--border);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.barFill {
|
||||
height: 100%;
|
||||
width: 0%;
|
||||
background: rgba(37,99,235,0.22);
|
||||
}
|
||||
|
||||
.barValue {
|
||||
width: 70px;
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: rgba(17,24,39,0.85);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.table {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.tableRow {
|
||||
display: grid;
|
||||
grid-template-columns: 170px 1fr 100px;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tableRow:first-child { border-top: none; }
|
||||
|
||||
.tableHead {
|
||||
font-weight: 800;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
color: rgba(17,24,39,0.75);
|
||||
}
|
||||
|
||||
/* 预约队列样式 */
|
||||
.cardReservations { order: 1.5; }
|
||||
|
||||
.reservationsContent {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.reservationsInfo {
|
||||
padding: 12px;
|
||||
background: #f8fafc;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.reservationsInfo > div {
|
||||
margin: 6px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.reservationsInfo strong {
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.reservationsList {
|
||||
display: flex;
|
||||
flex-direction: row; /* 横向排列 */
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
/* 横向滚动,垂直方向固定高度以便卡片一致 */
|
||||
max-height: 320px;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
padding-bottom: 6px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* 每个项固定最小宽度,横向排列时按卡片显示 */
|
||||
.reservationItem {
|
||||
flex: 0 0 320px;
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
.reservationItem {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
background: linear-gradient(135deg, rgba(37,99,235,0.03), rgba(255,255,255,0.8));
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.reservationItem:hover {
|
||||
box-shadow: 0 4px 12px rgba(37,99,235,0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.reservationHeader {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.reservationIndex {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.reservationValue {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.reservationBody {
|
||||
font-size: 13px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.reservationBody > div {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.reservationBody strong {
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
min-width: 80px;
|
||||
display: inline-block;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
REM 切到脚本所在目录(项目根目录)
|
||||
pushd "%~dp0"
|
||||
|
||||
REM 先尝试停止旧的 web_gui.py(避免端口占用/版本未更新)
|
||||
powershell -NoProfile -Command "$ps = Get-CimInstance Win32_Process | Where-Object { ($_.CommandLine -like '*web_gui.py*') -and ($_.Name -like 'python*') }; $ps | ForEach-Object { try { Stop-Process -Id $_.ProcessId -Force } catch {} }" >nul 2>nul
|
||||
|
||||
REM 启动 Web GUI(隐藏窗口)
|
||||
powershell -NoProfile -Command "Start-Process -FilePath python -ArgumentList @('web_gui.py') -WorkingDirectory (Get-Location).Path -WindowStyle Hidden" >nul 2>nul
|
||||
|
||||
REM 稍等服务起来
|
||||
timeout /t 1 /nobreak >nul
|
||||
|
||||
REM 打开浏览器
|
||||
start "" "http://127.0.0.1:8765"
|
||||
|
||||
popd
|
||||
endlocal
|
||||
Reference in new issue
Block a user