Files
2026-06-24 19:11:02 +08:00

59 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 斗鱼抢购系统
Wails v2 桌面应用。
## 开发运行
```bash
wails dev
```
## 构建
```bash
# 构建当前平台
wails build
# 交叉编译
GOOS=windows GOARCH=amd64 wails build
GOOS=darwin GOARCH=amd64 wails build
GOOS=darwin GOARCH=arm64 wails build
GOOS=linux GOARCH=amd64 wails build
```
构建产物在 `build/bin/` 目录。
## 项目结构
```
├── main.go # Wails 入口
├── app.go # App 结构体 + 前端可调用方法
├── frontend/
│ └── index.html # 前端页面
├── internal/
│ ├── client/ # 斗鱼接口客户端
│ ├── seckill/ # 抢购调度器
│ ├── logger/ # 日志系统
│ ├── trace/ # HTTP 请求追踪
│ ├── image/ # 成功图片生成
│ ├── config/ # 配置管理
│ ├── types/ # 类型定义
│ ├── constants/ # 常量
│ └── utils/ # 工具函数
├── data/
│ └── user.txt # 账号文件
└── build/ # 构建输出(gitignore)
```
## 环境变量
| 变量 | 说明 | 默认值 |
|------|------|--------|
| `DOUYU_CONFIG` | 配置文件路径 | `config.json` |
| `DOUYU_USERS` | 账号文件路径 | `data/user.txt` |
| `DOUYU_LOG_DIR` | 日志目录 | `logs` |
| `DOUYU_SUCCESS_DIR` | 成功图片目录 | `success_images` |
| `DOUYU_FONT` | 自定义字体路径 | 自动检测系统字体 |
| `DOUYU_TRACE` | 启用 HTTP 追踪 | 关闭 |
| `DOUYU_TRACE_MAX_BODY` | trace 正文最大字节数 | 无限制 |