50 lines
1.6 KiB
Markdown
50 lines
1.6 KiB
Markdown
|
# 推广二维码背景图片说明
|
|||
|
|
|||
|
## 目录结构
|
|||
|
|
|||
|
```
|
|||
|
static/images/
|
|||
|
├── tg_qrcode_1.jpg # promote 类型的背景图片(推广)
|
|||
|
├── yq_qrcode_1.png # invitation 类型的背景图片(邀请)
|
|||
|
└── README.md
|
|||
|
```
|
|||
|
|
|||
|
## 支持的二维码类型
|
|||
|
|
|||
|
- `promote`: 使用 tg_qrcode_1.jpg 作为背景(推广二维码)
|
|||
|
- `invitation`: 使用 yq_qrcode_1.png 作为背景(邀请二维码)
|
|||
|
|
|||
|
## 路径计算说明
|
|||
|
|
|||
|
程序运行时的路径计算:
|
|||
|
|
|||
|
- 工作目录:`D:\Code\qnc-project\qnc-server`
|
|||
|
- 相对路径:`static/images`
|
|||
|
- 完整路径示例:
|
|||
|
- promote: `D:\Code\qnc-project\qnc-server\static\images\tg_qrcode_1.jpg`
|
|||
|
- invitation: `D:\Code\qnc-project\qnc-server\static\images\yq_qrcode_1.png`
|
|||
|
|
|||
|
## 背景图片要求
|
|||
|
|
|||
|
- 格式:支持 PNG、JPEG 等常见格式
|
|||
|
- 尺寸:建议不小于 600x600 像素
|
|||
|
- 设计:考虑到二维码会放置在图片中心,请在设计时预留中心区域
|
|||
|
|
|||
|
## API 使用示例
|
|||
|
|
|||
|
```bash
|
|||
|
# 生成推广二维码
|
|||
|
GET /api/v1/agent/promotion/qrcode?qrcode_type=promote&qrcode_url=https://example.com/promotion/12345
|
|||
|
|
|||
|
# 生成邀请二维码
|
|||
|
GET /api/v1/agent/promotion/qrcode?qrcode_type=invitation&qrcode_url=https://example.com/invite/67890
|
|||
|
```
|
|||
|
|
|||
|
## 注意事项
|
|||
|
|
|||
|
1. 确保 tg_qrcode_1.jpg 和 yq_qrcode_1.png 文件存在于此目录下
|
|||
|
2. 二维码会自动添加白色半透明背景以确保可读性
|
|||
|
3. 二维码大小会根据背景图片尺寸自动调整,范围在 120px-300px 之间
|
|||
|
4. 默认二维码类型是 `promote`
|
|||
|
5. 程序启动时必须在项目根目录(qnc-server)下执行
|