Add WeChat virtual-pay props 29, 298 and 588 with batch upload sheet.

Include CORS images and prefer exact product_id match over legacy price remaps.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Eric 2026-11-22 11:04:36 +08:00
parent b574a54d4c
commit 5dd573ce22
8 changed files with 92 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,7 +1,7 @@
"""虚拟支付道具目录:免费 + 微信已发布道具。
已发布(MP):
tiktok / youtube / nomad / svip / ebook_unlock_default
tiktok / youtube / nomad / svip / ebook_unlock_default / 29 / 298 / 588
价格单位:分;道具 ID 与名称字段一致(ebook 道具 ID 为 ebook_unlock_default)。
"""
@ -65,6 +65,39 @@ PRODUCT_OFFERS: list[dict[str, Any]] = [
"image": "props/svip.png",
"remark": "已发布 · ¥998",
},
{
"key": "yen29",
"label": "29",
"name": "29",
"product_id": "29",
"price_fen": 2900,
"unlock_percent": 30,
"free": False,
"image": "props/29.png",
"remark": "已发布 · ¥29",
},
{
"key": "yen298",
"label": "298",
"name": "298",
"product_id": "298",
"price_fen": 29800,
"unlock_percent": 30,
"free": False,
"image": "props/298.png",
"remark": "已发布 · ¥298",
},
{
"key": "yen588",
"label": "588",
"name": "588",
"product_id": "588",
"price_fen": 58800,
"unlock_percent": 30,
"free": False,
"image": "props/588.png",
"remark": "已发布 · ¥588",
},
{
"key": "ebook",
"label": "ebook",
@ -89,8 +122,8 @@ PRODUCT_OFFERS: list[dict[str, Any]] = [
},
]
# 旧书把「价格数字」当 product_id;仅当目录中没有同名道具时才映射
_LEGACY_PRODUCT_IDS = {
"298": "tiktok",
"188": "youtube",
"49": "nomad",
"998": "svip",
@ -107,12 +140,19 @@ def match_offer(book: dict[str, Any] | None) -> dict[str, Any]:
if is_book_free(book):
return PRODUCT_OFFERS[0]
pid = str((book or {}).get("product_id") or "")
mapped = _LEGACY_PRODUCT_IDS.get(pid, pid)
# 先精确匹配现网道具 id(含 29/298/588),再走遗留价格数字映射
for offer in PRODUCT_OFFERS:
if offer["free"]:
continue
if offer["product_id"] == pid or offer["key"] == mapped or offer["product_id"] == mapped:
if offer["product_id"] == pid or offer["key"] == pid:
return offer
mapped = _LEGACY_PRODUCT_IDS.get(pid, pid)
if mapped != pid:
for offer in PRODUCT_OFFERS:
if offer["free"]:
continue
if offer["key"] == mapped or offer["product_id"] == mapped:
return offer
price = int((book or {}).get("price_fen") or 0)
return {
"key": "custom",

View File

@ -65,6 +65,39 @@ PRODUCT_OFFERS: list[dict[str, Any]] = [
"image": "props/svip.png",
"remark": "已发布 · ¥998",
},
{
"key": "yen29",
"label": "29",
"name": "29",
"product_id": "29",
"price_fen": 2900,
"unlock_percent": 30,
"free": False,
"image": "props/29.png",
"remark": "已发布 · ¥29",
},
{
"key": "yen298",
"label": "298",
"name": "298",
"product_id": "298",
"price_fen": 29800,
"unlock_percent": 30,
"free": False,
"image": "props/298.png",
"remark": "已发布 · ¥298",
},
{
"key": "yen588",
"label": "588",
"name": "588",
"product_id": "588",
"price_fen": 58800,
"unlock_percent": 30,
"free": False,
"image": "props/588.png",
"remark": "已发布 · ¥588",
},
{
"key": "ebook",
"label": "ebook",
@ -90,7 +123,6 @@ PRODUCT_OFFERS: list[dict[str, Any]] = [
]
_LEGACY_PRODUCT_IDS = {
"298": "tiktok",
"188": "youtube",
"49": "nomad",
"998": "svip",
@ -107,12 +139,18 @@ def match_offer(book: dict[str, Any] | None) -> dict[str, Any]:
if is_book_free(book):
return PRODUCT_OFFERS[0]
pid = str((book or {}).get("product_id") or "")
mapped = _LEGACY_PRODUCT_IDS.get(pid, pid)
for offer in PRODUCT_OFFERS:
if offer["free"]:
continue
if offer["product_id"] == pid or offer["key"] == mapped or offer["product_id"] == mapped:
if offer["product_id"] == pid or offer["key"] == pid:
return offer
mapped = _LEGACY_PRODUCT_IDS.get(pid, pid)
if mapped != pid:
for offer in PRODUCT_OFFERS:
if offer["free"]:
continue
if offer["key"] == mapped or offer["product_id"] == mapped:
return offer
price = int((book or {}).get("price_fen") or 0)
return {
"key": "custom",

View File

@ -34,6 +34,9 @@ WX_PAY_ENV=0
| `youtube` | `youtube` | ¥188(18800 分) | 30 | `props/youtube.png` | 默认付费方案 |
| `nomad` | `nomad` | ¥49(4900 分) | 30 | `props/nomad.png` | 已发布 |
| `svip` | `svip` | ¥998(99800 分) | 30 | `props/svip.png` | 已发布 |
| `yen29` | `29` | ¥29(2900 分) | 30 | `props/29.png` | 新方案 |
| `yen298` | `298` | ¥298(29800 分) | 30 | `props/298.png` | 新方案 |
| `yen588` | `588` | ¥588(58800 分) | 30 | `props/588.png` | 新方案 |
| `ebook` | `ebook_unlock_default` | ¥188(18800 分) | 30 | `props/ebook.png` | 旧默认道具 |
| `test` | `test` | ¥1(100 分) | 30 | `props/test.png` | 联调;须在 MP 发布 |
@ -66,7 +69,7 @@ WX_PAY_ENV=0
当前图片 CDN:`https://admin.nomadro.cn/props/{id}.png`
已对 `https://mp.weixin.qq.com` 放开 CORS(`Access-Control-Allow-Origin`)。
本仓库已填 6 个付费道具:`tiktok` / `youtube` / `nomad` / `svip` / `ebook_unlock_default` / `test`。
本仓库已填 9 个付费道具:`tiktok` / `youtube` / `nomad` / `svip` / `29` / `298` / `588` / `ebook_unlock_default` / `test`。
## 验收

View File

@ -17,6 +17,9 @@ ROWS = [
("youtube", "youtube", f"{IMG_BASE}/youtube.png", 188, "默认付费方案 · 试读30%"),
("nomad", "nomad", f"{IMG_BASE}/nomad.png", 49, "已发布方案 · 试读30%"),
("svip", "svip", f"{IMG_BASE}/svip.png", 998, "已发布方案 · 试读30%"),
("29", "29", f"{IMG_BASE}/29.png", 29, "新方案 · ¥29 · 试读30%"),
("298", "298", f"{IMG_BASE}/298.png", 298, "新方案 · ¥298 · 试读30%"),
("588", "588", f"{IMG_BASE}/588.png", 588, "新方案 · ¥588 · 试读30%"),
("ebook_unlock_default", "ebook", f"{IMG_BASE}/ebook.png", 188, "旧默认道具 · 试读30%"),
("test", "test", f"{IMG_BASE}/test.png", 1, "联调测试道具 · ¥1"),
]