歪马送酒每日采集流程(云端出签)

This commit is contained in:
mjz
2026-12-05 18:08:06 +08:00
commit 37c2062499
6 changed files with 1785 additions and 0 deletions
+147
View File
@@ -0,0 +1,147 @@
# 歪马送酒每日采集流程
顺序:**查批次 → 补门店ID →(券日)券列表 → 券商品 → 搜索**
批次由外部准备,本流程不复制批次。
命令都在本目录执行:`C:\Users\mjz\Desktop\python\9月\歪马送酒\AI代码`
## 1. 查批次
```sql
select count(*) from waima_keyword_input where batch = 'D';
```
0 行就停,报告"当天批次不存在"。
## 2. 补门店ID(每天,必须在券和搜索之前)
```bash
python 歪马送酒_按坐标补门店ID.py
```
BATCH 默认当天,不用改。
## 3. 判券日
```sql
select distinct need_coupon from waima_keyword_input where batch = 'D';
```
`need_coupon = 1` → 跑第 4、5 步;`0` → 跳过券,只跑第 6 步。
## 4. 券列表(券日)
改脚本第 46 行 `BATCH = 'D'`,再跑:
```bash
python 歪马送酒_商品券列表.py
```
已入库的店自动跳过,失败的店重跑即补。
## 5. 券商品(券日)
```bash
python 歪马送酒_shark请求.py
```
无 BATCH 常量;后台跑,进度查库,中断重跑即续:
```sql
select sum(is_ok is null), sum(is_ok = 1) from waima_coupon_list_item;
```
## 6. 关键词搜索(每天)
改脚本第 30 行 `BATCH = 'D'`,再跑:
```bash
python 歪马送酒_搜索.py
```
## 7. 收尾
报四项:搜索 `current_page >= page` 完成数、`new_store_id` 补全数、券明细 `is_ok` 分布、两个包池的 `is_ok` 分布。
---
## 注意
- 券是否跑看 `need_coupon`,搜索每天跑;跳过券时不能连搜索一起跳过。
- 包池 403/418/406 会掉号,池空脚本直接退出。
- 日志块缓冲会滞后,进度一律看库。
- 券明细表没有 `batch` 列,按天统计用 `date(created_at)`。
- 只改 `BATCH` 常量,不改脚本结构。
---
## 8. 完整示例:券日 2026-12-03(实测)
```bash
cd "C:\Users\mjz\Desktop\python\9月\歪马送酒\AI代码"
```
**1)查批次**
```sql
select count(*) from waima_keyword_input where batch = '2026-12-03';
-- 228
```
**2)补门店ID**
```bash
python 歪马送酒_按坐标补门店ID.py
```
→ 6 个坐标召回全部 200,`new_store_id` 228/228。
**3)判券**
```sql
select distinct need_coupon from waima_keyword_input where batch = '2026-12-03';
-- 1,跑券
```
**4)券列表**(脚本第 46 行改成 `BATCH = '2026-12-03'`)
```bash
python 歪马送酒_商品券列表.py
```
→ 6 个店全 200,当天新建券明细 401 条。
```sql
select count(*) from waima_coupon_list_item where date(created_at) = '2026-12-03';
-- 401
```
**5)券商品**(不改常量,后台跑)
```bash
python 歪马送酒_shark请求.py
```
→ 取全表 `is_ok is null` 401 条(恰好都是当天新建),150 张券、928 页,最终 401/401 完成。
```sql
select sum(is_ok is null), sum(is_ok = 1) from waima_coupon_list_item;
-- 0, 401
```
**6)搜索**(脚本第 30 行改成 `BATCH = '2026-12-03'`)
```bash
python 歪马送酒_搜索.py
```
→ 228/228 完成,234 页。日志里的「厦门市 改用省会 福州 代理」是正常兜底。
**7)收尾**
- 搜索完成:`current_page >= page` = 228/228
- 补门店ID:228/228
- 券明细:401 条全部 `is_ok=1`
- 包池:查两个 `*_headers` 的 `is_ok` 分布,看 403/418/406 掉号
> 以上是 2026-12-03 那轮的真实数字,换一天任务量、券数、页数会变,判定逻辑不变。