Fix VIP Youtube notes routing and VIP/join-group switch sync for weapp audit.
Tag 20261011-2: youtube-notes opens reader?id=default; VIP center toggle drives join popup vs VIP jump. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
017008dd7c
commit
dfc5f2d502
15
README.md
15
README.md
@ -56,7 +56,7 @@ UI 组件:`apps/admin/src/pages/wechat.css` · `apps/admin/src/components/wxUi
|
|||||||
| VIP 落地 | `pages/vip/index` | 模块锚点真滚动、虚拟支付 / 免费方案 |
|
| VIP 落地 | `pages/vip/index` | 模块锚点真滚动、虚拟支付 / 免费方案 |
|
||||||
| 专题课 | `pages/vip-course/index?id=` | `cloudphone` / `livestream` / `indie` / `aiagent` |
|
| 专题课 | `pages/vip-course/index?id=` | `cloudphone` / `livestream` / `indie` / `aiagent` |
|
||||||
| 课时 | `pages/vip-lesson/index` | 原生 Video + 配套 markdown |
|
| 课时 | `pages/vip-lesson/index` | 原生 Video + 配套 markdown |
|
||||||
| 电子书 | `pages/vip-ebook/index?id=` | `nomad`(免费)/ `cloudphone`(VIP),目录抽屉 |
|
| 电子书 | `pages/vip-ebook/index?id=` | `nomad`(免费)/ `cloudphone`(VIP);**Youtube运营笔记**走 `pages/reader?id=default`(后台 books/default) |
|
||||||
| **知识社群** | `pages/vip-memo` · `vip-memo-detail` | 知识星球风格:精华/收藏/Markdown/图/#话题;缓存秒开 |
|
| **知识社群** | `pages/vip-memo` · `vip-memo-detail` | 知识星球风格:精华/收藏/Markdown/图/#话题;缓存秒开 |
|
||||||
| **设备商城** | `pages/vip-store*` | 虚拟卡 + 实物发货;微信 `chooseAddress` |
|
| **设备商城** | `pages/vip-store*` | 虚拟卡 + 实物发货;微信 `chooseAddress` |
|
||||||
|
|
||||||
@ -120,8 +120,13 @@ pnpm dev:api
|
|||||||
## pre4 摘要
|
## pre4 摘要
|
||||||
|
|
||||||
- 微信启动页 **`pages/home/index`**(话题/体验码同路径);`pages/index` 兼容 `reLaunch` → home
|
- 微信启动页 **`pages/home/index`**(话题/体验码同路径);`pages/index` 兼容 `reLaunch` → home
|
||||||
- 本轮标记:**`20261011b`**(视觉对齐 `20261011`)
|
- 本轮标记:**`20261011-2`**(审核候选;承接 `20261011b` 路径 + `20261011` 视觉)
|
||||||
- **P0/P1 加固**
|
- **审核前修复(`20261011-2`)**
|
||||||
|
- VIP「Youtube运营笔记」→ `reader?id=default`(后台「内容→VIP→电子书→youtube运营笔记」),禁止误进数字游民 `vip-ebook?id=nomad`
|
||||||
|
- `vipContent.ebooks` 默认含 youtube-notes;服务端 `_ensure_youtube_notes_ebook` 校正 href
|
||||||
|
- 提审开关只影响数字游民,不劫持 `book_id=default`
|
||||||
|
- 「VIP 中心」开关与加群联动:开→跳会员页,关→公众号弹窗;加群点击强制拉最新 `/api/config`
|
||||||
|
- **P0/P1 加固**(已在 `017008d`)
|
||||||
- 统一 API 挂载 VIP library / weapp switches;VIP 正文需鉴权(目录可匿名)
|
- 统一 API 挂载 VIP library / weapp switches;VIP 正文需鉴权(目录可匿名)
|
||||||
- Mine 统一 ebook 登录(`ensureLogin` / `clearLogin`)
|
- Mine 统一 ebook 登录(`ensureLogin` / `clearLogin`)
|
||||||
- weapp game:`index.weapp.tsx` stub + `IgnorePlugin(three)`,无 Three.js 包体
|
- weapp game:`index.weapp.tsx` stub + `IgnorePlugin(three)`,无 Three.js 包体
|
||||||
@ -140,4 +145,6 @@ pnpm dev:api
|
|||||||
|
|
||||||
构建微信包:`pnpm build:weapp` / `pnpm dev:weapp` → 开发者工具打开 `apps/miniprogram/weapp`(读 `dist/`)。图片域名需放行 `nomadro.cn`。
|
构建微信包:`pnpm build:weapp` / `pnpm dev:weapp` → 开发者工具打开 `apps/miniprogram/weapp`(读 `dist/`)。图片域名需放行 `nomadro.cn`。
|
||||||
|
|
||||||
微信启动首页为 **`pages/home/index`**(官方话题/体验码同路径;视觉对齐 **`20261011`**,路径发版 tag **`20261011b`**)。`pages/index/index` 仅作兼容:`reLaunch` → home(勿与 home 共用组件入口,否则页面 wxss 缺失)。详见 `apps/miniprogram/weapp/README.md`。
|
微信启动首页为 **`pages/home/index`**(官方话题/体验码同路径;视觉对齐 **`20261011`**;路径 **`20261011b`**;**审核包 tag `20261011-2`**)。`pages/index/index` 仅作兼容:`reLaunch` → home(勿与 home 共用组件入口,否则页面 wxss 缺失)。详见 `apps/miniprogram/weapp/README.md`。
|
||||||
|
|
||||||
|
提审上传:本地 `pnpm build:weapp` → 开发者工具打开 `apps/miniprogram/weapp`(读 `dist/`)→ 上传体验版;后台「数字游民」提审开关按需开启。
|
||||||
|
|||||||
137
apps/admin/deploy/_fix_vip_youtube_ebook.py
Normal file
137
apps/admin/deploy/_fix_vip_youtube_ebook.py
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Deploy vip_content.py + patch remote-config: Youtube运营笔记 → books/default."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import paramiko
|
||||||
|
|
||||||
|
REPO = Path(__file__).resolve().parents[3]
|
||||||
|
HOST, USER, PASS = "82.157.112.245", "ubuntu", "Xiao4669805"
|
||||||
|
SRC = REPO / "apps/api/services/ebook_svc/services/vip_content.py"
|
||||||
|
|
||||||
|
YT = {
|
||||||
|
"id": "youtube-notes",
|
||||||
|
"title": "Youtube运营笔记",
|
||||||
|
"desc": "试读可进,单买或 VIP 解锁全文",
|
||||||
|
"ebookId": "default",
|
||||||
|
"href": "/pages/reader/index?id=default",
|
||||||
|
"free": False,
|
||||||
|
"enabled": True,
|
||||||
|
"sort": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_app_pkg(src: Path) -> bytes:
|
||||||
|
return src.read_text(encoding="utf-8").replace("ebook_svc.", "app.").encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
data = to_app_pkg(SRC)
|
||||||
|
c = paramiko.SSHClient()
|
||||||
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
c.connect(HOST, username=USER, password=PASS, timeout=60, allow_agent=False, look_for_keys=False)
|
||||||
|
sftp = c.open_sftp()
|
||||||
|
with sftp.file("/tmp/vip_content_yt.py", "wb") as rf:
|
||||||
|
rf.write(data)
|
||||||
|
print("up vip_content", len(data), flush=True)
|
||||||
|
sftp.close()
|
||||||
|
|
||||||
|
patch_json = json.dumps(YT, ensure_ascii=False)
|
||||||
|
cmd = r"""
|
||||||
|
set -e
|
||||||
|
B=/opt/nomadmini/backend/app
|
||||||
|
sudo cp /tmp/vip_content_yt.py "$B/services/vip_content.py"
|
||||||
|
|
||||||
|
# patch remote-config ebooks
|
||||||
|
python3 <<'PY'
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
paths = [
|
||||||
|
Path("/var/www/nomadro.cn/data/remote-config.json"),
|
||||||
|
Path("/opt/nomadmini/backend/data/remote-config.json"),
|
||||||
|
]
|
||||||
|
yt = {
|
||||||
|
"id": "youtube-notes",
|
||||||
|
"title": "Youtube运营笔记",
|
||||||
|
"desc": "试读可进,单买或 VIP 解锁全文",
|
||||||
|
"ebookId": "default",
|
||||||
|
"href": "/pages/reader/index?id=default",
|
||||||
|
"free": False,
|
||||||
|
"enabled": True,
|
||||||
|
"sort": 1,
|
||||||
|
}
|
||||||
|
for p in paths:
|
||||||
|
if not p.is_file():
|
||||||
|
print("skip missing", p)
|
||||||
|
continue
|
||||||
|
raw = json.loads(p.read_text(encoding="utf-8"))
|
||||||
|
platforms = raw.setdefault("platforms", {})
|
||||||
|
weapp = platforms.setdefault("weapp", {})
|
||||||
|
vc = weapp.setdefault("vipContent", {})
|
||||||
|
ebooks = list(vc.get("ebooks") or [])
|
||||||
|
hit = -1
|
||||||
|
for i, e in enumerate(ebooks):
|
||||||
|
if not isinstance(e, dict):
|
||||||
|
continue
|
||||||
|
t = str(e.get("title") or "")
|
||||||
|
if (
|
||||||
|
e.get("id") == "youtube-notes"
|
||||||
|
or e.get("ebookId") == "default"
|
||||||
|
or "youtube" in t.lower()
|
||||||
|
or "运营笔记" in t
|
||||||
|
):
|
||||||
|
hit = i
|
||||||
|
break
|
||||||
|
if hit >= 0:
|
||||||
|
prev = ebooks[hit]
|
||||||
|
ebooks[hit] = {**yt, "title": prev.get("title") or yt["title"], "desc": prev.get("desc") or yt["desc"], "enabled": prev.get("enabled") is not False, "sort": prev.get("sort", 1)}
|
||||||
|
else:
|
||||||
|
idx = next((i for i, e in enumerate(ebooks) if isinstance(e, dict) and (e.get("id") == "1" or e.get("title") == "数字游民")), -1)
|
||||||
|
if idx >= 0:
|
||||||
|
ebooks.insert(idx + 1, dict(yt))
|
||||||
|
else:
|
||||||
|
ebooks.append(dict(yt))
|
||||||
|
# fix cloudphone sort if needed
|
||||||
|
for e in ebooks:
|
||||||
|
if isinstance(e, dict) and e.get("id") == "2" and e.get("sort") in (None, 1):
|
||||||
|
e["sort"] = 2
|
||||||
|
vc["ebooks"] = ebooks
|
||||||
|
stats = dict(vc.get("stats") or {})
|
||||||
|
stats["ebooks"] = "3"
|
||||||
|
vc["stats"] = stats
|
||||||
|
weapp["vipContent"] = vc
|
||||||
|
platforms["weapp"] = weapp
|
||||||
|
raw["platforms"] = platforms
|
||||||
|
raw["updatedAt"] = raw.get("updatedAt") or ""
|
||||||
|
bak = p.with_suffix(p.suffix + ".bak-yt")
|
||||||
|
bak.write_text(p.read_text(encoding="utf-8"), encoding="utf-8")
|
||||||
|
p.write_text(json.dumps(raw, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||||
|
print("patched", p, "ebooks=", [e.get("id") for e in ebooks if isinstance(e, dict)])
|
||||||
|
PY
|
||||||
|
|
||||||
|
cd /opt/nomadmini/backend
|
||||||
|
.venv/bin/python -c 'from app.services import vip_content as v; d=v.default_vip_content(); ids=[e["id"] for e in d["ebooks"]]; assert "youtube-notes" in ids; print("default_ok", ids)'
|
||||||
|
sudo systemctl restart nomadmini-api
|
||||||
|
sleep 3
|
||||||
|
systemctl is-active nomadmini-api
|
||||||
|
curl -sk https://api.nomadro.cn/api/config | python3 -c 'import sys,json; d=json.load(sys.stdin); e=((d.get("config") or {}).get("platforms") or {}).get("weapp",{}).get("vipContent",{}).get("ebooks") or []); print("live_ebooks", [(x.get("id"), x.get("ebookId"), x.get("href")) for x in e])'
|
||||||
|
rm -f /tmp/vip_content_yt.py
|
||||||
|
"""
|
||||||
|
_, stdout, _ = c.exec_command(cmd, timeout=180, get_pty=True)
|
||||||
|
while not stdout.channel.exit_status_ready():
|
||||||
|
if stdout.channel.recv_ready():
|
||||||
|
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||||
|
time.sleep(0.05)
|
||||||
|
while stdout.channel.recv_ready():
|
||||||
|
print(stdout.channel.recv(65536).decode("utf-8", "replace"), end="", flush=True)
|
||||||
|
code = stdout.channel.recv_exit_status()
|
||||||
|
print(f"[exit {code}]", flush=True)
|
||||||
|
c.close()
|
||||||
|
return code
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@ -58,7 +58,7 @@ const PAGE_MODS: Array<{ key: string; label: string; ico: string; desc: string }
|
|||||||
{ key: 'nav', label: '出海导航', ico: '🧭', desc: '导航页 / Tab' },
|
{ key: 'nav', label: '出海导航', ico: '🧭', desc: '导航页 / Tab' },
|
||||||
{ key: 'book', label: '数字游民小册', ico: '📕', desc: '小册 Tab → 正式读 nomad' },
|
{ key: 'book', label: '数字游民小册', ico: '📕', desc: '小册 Tab → 正式读 nomad' },
|
||||||
{ key: 'community', label: '旅居社群', ico: '🏕️', desc: '社群入口' },
|
{ key: 'community', label: '旅居社群', ico: '🏕️', desc: '社群入口' },
|
||||||
{ key: 'vip', label: 'VIP 中心', ico: '👑', desc: '会员落地页' },
|
{ key: 'vip', label: 'VIP 中心', ico: '👑', desc: '会员落地页;关闭后「加群」改弹公众号' },
|
||||||
{ key: 'destinations', label: '目的地', ico: '📍', desc: '目的地列表' },
|
{ key: 'destinations', label: '目的地', ico: '📍', desc: '目的地列表' },
|
||||||
{ key: 'meetups', label: '活动', ico: '📅', desc: '活动入口' },
|
{ key: 'meetups', label: '活动', ico: '📅', desc: '活动入口' },
|
||||||
]
|
]
|
||||||
@ -232,12 +232,25 @@ export default function Switches() {
|
|||||||
checked={on}
|
checked={on}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
label={m.label}
|
label={m.label}
|
||||||
onChange={(v) =>
|
onChange={(v) => {
|
||||||
|
// VIP 中心 ↔ 加群行为联动:开=跳会员页,关=公众号弹窗(实时)
|
||||||
|
if (m.key === 'vip') {
|
||||||
|
void patch(
|
||||||
|
{
|
||||||
|
modules: { vip: { enabled: v } },
|
||||||
|
flags: { joinGroupAction: v ? 'vip' : 'popup' },
|
||||||
|
},
|
||||||
|
v
|
||||||
|
? 'VIP 中心已开启 · 加群跳转会员页'
|
||||||
|
: 'VIP 中心已关闭 · 加群改为公众号弹窗',
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
void patch(
|
void patch(
|
||||||
{ modules: { [m.key]: { enabled: v } } },
|
{ modules: { [m.key]: { enabled: v } } },
|
||||||
`${m.label}已${v ? '开启' : '关闭'}`,
|
`${m.label}已${v ? '开启' : '关闭'}`,
|
||||||
)
|
)
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<h3>{m.label}</h3>
|
<h3>{m.label}</h3>
|
||||||
@ -299,7 +312,7 @@ export default function Switches() {
|
|||||||
<div className="sw-row">
|
<div className="sw-row">
|
||||||
<div>
|
<div>
|
||||||
<strong>加群行为</strong>
|
<strong>加群行为</strong>
|
||||||
<span>点击加群:弹窗或跳转 VIP</span>
|
<span>弹窗=关注公众号;跳 VIP 需「VIP 中心」开启,否则仍弹窗</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="sw-seg">
|
<div className="sw-seg">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -23,7 +23,7 @@ DEFAULT_VIP_CONTENT: dict[str, Any] = {
|
|||||||
"reviewMode": False,
|
"reviewMode": False,
|
||||||
"stats": {
|
"stats": {
|
||||||
"topics": "4",
|
"topics": "4",
|
||||||
"ebooks": "2",
|
"ebooks": "3",
|
||||||
"videos": "40+",
|
"videos": "40+",
|
||||||
"updateFrequency": "每周",
|
"updateFrequency": "每周",
|
||||||
},
|
},
|
||||||
@ -117,6 +117,17 @@ DEFAULT_VIP_CONTENT: dict[str, Any] = {
|
|||||||
"enabled": True,
|
"enabled": True,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# 后台「内容 → VIP → 电子书 → youtube运营笔记」= books/default
|
||||||
|
"id": "youtube-notes",
|
||||||
|
"title": "Youtube运营笔记",
|
||||||
|
"desc": "试读可进,单买或 VIP 解锁全文",
|
||||||
|
"ebookId": "default",
|
||||||
|
"href": "/pages/reader/index?id=default",
|
||||||
|
"free": False,
|
||||||
|
"enabled": True,
|
||||||
|
"sort": 1,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "2",
|
"id": "2",
|
||||||
"title": "云手机",
|
"title": "云手机",
|
||||||
@ -124,7 +135,7 @@ DEFAULT_VIP_CONTENT: dict[str, Any] = {
|
|||||||
"ebookId": "cloudphone",
|
"ebookId": "cloudphone",
|
||||||
"free": False,
|
"free": False,
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"sort": 1,
|
"sort": 2,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"compareTitle": "单品 vs 会员",
|
"compareTitle": "单品 vs 会员",
|
||||||
@ -189,6 +200,56 @@ def default_vip_content() -> dict[str, Any]:
|
|||||||
return deepcopy(DEFAULT_VIP_CONTENT)
|
return deepcopy(DEFAULT_VIP_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
def _ensure_youtube_notes_ebook(ebooks: list[Any]) -> list[Any]:
|
||||||
|
"""运营表缺 youtube 时补上;已有则校正到 books/default(禁止导到 nomad)。"""
|
||||||
|
seed = next(
|
||||||
|
(e for e in DEFAULT_VIP_CONTENT["ebooks"] if e.get("id") == "youtube-notes"),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if not seed:
|
||||||
|
return ebooks
|
||||||
|
reader_href = "/pages/reader/index?id=default"
|
||||||
|
out = [dict(x) if isinstance(x, dict) else x for x in ebooks]
|
||||||
|
hit = -1
|
||||||
|
for i, e in enumerate(out):
|
||||||
|
if not isinstance(e, dict):
|
||||||
|
continue
|
||||||
|
title = str(e.get("title") or "")
|
||||||
|
if (
|
||||||
|
e.get("id") == "youtube-notes"
|
||||||
|
or e.get("ebookId") == "default"
|
||||||
|
or e.get("href") == reader_href
|
||||||
|
or ("youtube" in title.lower())
|
||||||
|
or ("油管" in title)
|
||||||
|
or ("运营笔记" in title)
|
||||||
|
):
|
||||||
|
hit = i
|
||||||
|
break
|
||||||
|
if hit >= 0:
|
||||||
|
prev = out[hit]
|
||||||
|
out[hit] = {
|
||||||
|
**seed,
|
||||||
|
**{k: prev[k] for k in ("title", "desc", "enabled", "sort") if k in prev and prev[k] is not None},
|
||||||
|
"id": "youtube-notes",
|
||||||
|
"ebookId": "default",
|
||||||
|
"href": reader_href,
|
||||||
|
"free": False,
|
||||||
|
"enabled": prev.get("enabled") is not False,
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
# 插在数字游民后
|
||||||
|
idx = next(
|
||||||
|
(i for i, e in enumerate(out) if isinstance(e, dict) and (e.get("id") == "1" or e.get("title") == "数字游民")),
|
||||||
|
-1,
|
||||||
|
)
|
||||||
|
row = deepcopy(seed)
|
||||||
|
if idx >= 0:
|
||||||
|
out.insert(idx + 1, row)
|
||||||
|
else:
|
||||||
|
out.append(row)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
def _merge_list(base: list[Any], patch: Any, *, id_key: str = "id") -> list[Any]:
|
def _merge_list(base: list[Any], patch: Any, *, id_key: str = "id") -> list[Any]:
|
||||||
if not isinstance(patch, list):
|
if not isinstance(patch, list):
|
||||||
return deepcopy(base)
|
return deepcopy(base)
|
||||||
@ -239,7 +300,11 @@ def merge_vip_content(base: dict[str, Any] | None, patch: dict[str, Any] | None)
|
|||||||
if "videos" in patch:
|
if "videos" in patch:
|
||||||
out["videos"] = _merge_list(out.get("videos") or [], patch["videos"])
|
out["videos"] = _merge_list(out.get("videos") or [], patch["videos"])
|
||||||
if "ebooks" in patch:
|
if "ebooks" in patch:
|
||||||
out["ebooks"] = _merge_list(out.get("ebooks") or [], patch["ebooks"])
|
out["ebooks"] = _ensure_youtube_notes_ebook(
|
||||||
|
_merge_list(out.get("ebooks") or [], patch["ebooks"])
|
||||||
|
)
|
||||||
|
elif isinstance(out.get("ebooks"), list):
|
||||||
|
out["ebooks"] = _ensure_youtube_notes_ebook(out["ebooks"])
|
||||||
if "compare" in patch and isinstance(patch["compare"], list):
|
if "compare" in patch and isinstance(patch["compare"], list):
|
||||||
out["compare"] = [
|
out["compare"] = [
|
||||||
{
|
{
|
||||||
@ -267,7 +332,13 @@ def read_vip_content_from_raw(raw: dict[str, Any]) -> dict[str, Any]:
|
|||||||
platforms = raw.get("platforms") if isinstance(raw.get("platforms"), dict) else {}
|
platforms = raw.get("platforms") if isinstance(raw.get("platforms"), dict) else {}
|
||||||
weapp = platforms.get("weapp") if isinstance(platforms.get("weapp"), dict) else {}
|
weapp = platforms.get("weapp") if isinstance(platforms.get("weapp"), dict) else {}
|
||||||
stored = weapp.get("vipContent") if isinstance(weapp.get("vipContent"), dict) else None
|
stored = weapp.get("vipContent") if isinstance(weapp.get("vipContent"), dict) else None
|
||||||
return merge_vip_content(default_vip_content(), stored)
|
merged = merge_vip_content(default_vip_content(), stored)
|
||||||
|
merged["ebooks"] = _ensure_youtube_notes_ebook(list(merged.get("ebooks") or []))
|
||||||
|
stats = dict(merged.get("stats") or {})
|
||||||
|
if str(stats.get("ebooks") or "") in ("", "2"):
|
||||||
|
stats["ebooks"] = "3"
|
||||||
|
merged["stats"] = stats
|
||||||
|
return merged
|
||||||
|
|
||||||
|
|
||||||
def apply_vip_content_patch(raw: dict[str, Any], patch: dict[str, Any] | None) -> dict[str, Any]:
|
def apply_vip_content_patch(raw: dict[str, Any], patch: dict[str, Any] | None) -> dict[str, Any]:
|
||||||
|
|||||||
@ -173,10 +173,10 @@ export const DEFAULT_WEAPP_VIP: WeappVipContent = {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 原小册 book_id=default:收费展示;直达试读阅读器,单买或 VIP 解锁全文
|
// 后台「内容→VIP→电子书→youtube运营笔记」= /wechat/books/default
|
||||||
id: 'youtube-notes',
|
id: 'youtube-notes',
|
||||||
title: 'Youtube运营笔记',
|
title: 'Youtube运营笔记',
|
||||||
desc: '原小册 · 试读可进,单买或 VIP 解锁全文',
|
desc: '试读可进,单买或 VIP 解锁全文',
|
||||||
ebookId: 'default',
|
ebookId: 'default',
|
||||||
href: '/pages/reader/index?id=default',
|
href: '/pages/reader/index?id=default',
|
||||||
free: false,
|
free: false,
|
||||||
@ -234,7 +234,7 @@ function mergeList<T extends { id?: string; enabled?: boolean; sort?: number }>(
|
|||||||
.sort((a, b) => Number(a.sort || 0) - Number(b.sort || 0))
|
.sort((a, b) => Number(a.sort || 0) - Number(b.sort || 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 远程配置缺「Youtube运营笔记」时补上;已存在则校正到试读阅读器 */
|
/** 远程配置缺「Youtube运营笔记」时补上;已存在则强制校正到 reader?id=default(禁止导到 nomad) */
|
||||||
function ensureYoutubeNotesEbook(ebooks: VipEbookItem[]): VipEbookItem[] {
|
function ensureYoutubeNotesEbook(ebooks: VipEbookItem[]): VipEbookItem[] {
|
||||||
const seed = DEFAULT_WEAPP_VIP.ebooks.find((e) => e.id === 'youtube-notes')
|
const seed = DEFAULT_WEAPP_VIP.ebooks.find((e) => e.id === 'youtube-notes')
|
||||||
if (!seed) return ebooks
|
if (!seed) return ebooks
|
||||||
@ -242,15 +242,17 @@ function ensureYoutubeNotesEbook(ebooks: VipEbookItem[]): VipEbookItem[] {
|
|||||||
const hit = ebooks.findIndex(
|
const hit = ebooks.findIndex(
|
||||||
(e) =>
|
(e) =>
|
||||||
e.id === 'youtube-notes' ||
|
e.id === 'youtube-notes' ||
|
||||||
e.href === '/pages/book/index' ||
|
e.ebookId === 'default' ||
|
||||||
e.href === readerHref ||
|
e.href === readerHref ||
|
||||||
(e.title === 'Youtube运营笔记' && e.ebookId === 'default'),
|
/youtube|油管|运营笔记/i.test(String(e.title || '')),
|
||||||
)
|
)
|
||||||
if (hit >= 0) {
|
if (hit >= 0) {
|
||||||
const next = ebooks.slice()
|
const next = ebooks.slice()
|
||||||
next[hit] = {
|
next[hit] = {
|
||||||
...next[hit],
|
...next[hit],
|
||||||
...seed,
|
...seed,
|
||||||
|
title: next[hit].title || seed.title,
|
||||||
|
desc: next[hit].desc || seed.desc,
|
||||||
href: readerHref,
|
href: readerHref,
|
||||||
ebookId: 'default',
|
ebookId: 'default',
|
||||||
free: false,
|
free: false,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* 社区首页收敛:仅顶栏 + Hero;「加群」按 flags.joinGroupAction 弹窗或跳 VIP。
|
* 社区首页收敛:仅顶栏 + Hero;「加群」:VIP 中心开且 joinGroupAction=vip → 跳会员页,否则弹公众号。
|
||||||
* Hero 视觉:社交星座网(区别于门户首页地球)。对齐 Next `/community`。
|
* Hero 视觉:社交星座网(区别于门户首页地球)。对齐 Next `/community`。
|
||||||
*/
|
*/
|
||||||
import { View, Button } from '@tarojs/components'
|
import { View, Button } from '@tarojs/components'
|
||||||
@ -98,14 +98,18 @@ function HomePageInner() {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
async function onJoinClick() {
|
async function onJoinClick() {
|
||||||
// 点击前强制拉最新远程配置(后台 VIP「加群→跳转」实时生效)
|
// 点击前强制拉最新配置(用返回值,避免旧内存/Storage)
|
||||||
|
let cfg = getCachedRemoteConfig()
|
||||||
try {
|
try {
|
||||||
await loadRemoteConfig(true)
|
const res = await loadRemoteConfig(true)
|
||||||
|
cfg = res.config
|
||||||
} catch {
|
} catch {
|
||||||
/* 用缓存 */
|
/* 用缓存 */
|
||||||
}
|
}
|
||||||
const action = getCachedRemoteConfig().flags.joinGroupAction
|
// VIP 中心开 + 加群=跳VIP → 会员页;否则公众号弹窗
|
||||||
if (action === 'vip') {
|
const vipCenterOn = cfg.modules?.vip?.enabled === true
|
||||||
|
const jumpVip = cfg.flags?.joinGroupAction === 'vip'
|
||||||
|
if (vipCenterOn && jumpVip) {
|
||||||
void Taro.navigateTo({ url: '/pages/vip/index' })
|
void Taro.navigateTo({ url: '/pages/vip/index' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,8 @@ function ReaderPage() {
|
|||||||
const auditId = audit.bookId || 'audit'
|
const auditId = audit.bookId || 'audit'
|
||||||
if (audit.reviewMode) {
|
if (audit.reviewMode) {
|
||||||
if (bookId === auditId || bookId === 'audit') return
|
if (bookId === auditId || bookId === 'audit') return
|
||||||
if (bookId === 'nomad' || bookId === 'default') {
|
// 仅数字游民走审核版;youtube运营笔记(book_id=default) 不受提审开关影响
|
||||||
|
if (bookId === 'nomad') {
|
||||||
switching = true
|
switching = true
|
||||||
const url = `/pages/reader/index?id=${encodeURIComponent(auditId)}`
|
const url = `/pages/reader/index?id=${encodeURIComponent(auditId)}`
|
||||||
void Taro.redirectTo({ url })
|
void Taro.redirectTo({ url })
|
||||||
@ -122,7 +123,7 @@ function ReaderPage() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 提审关:从审核版回到正式会员书
|
// 提审关:从审核版回到正式会员书(数字游民);勿误伤 youtube default
|
||||||
if (bookId === auditId || bookId === 'audit') {
|
if (bookId === auditId || bookId === 'audit') {
|
||||||
switching = true
|
switching = true
|
||||||
const url = '/pages/vip-ebook/index?id=nomad'
|
const url = '/pages/vip-ebook/index?id=nomad'
|
||||||
|
|||||||
@ -7,7 +7,12 @@ import Taro, { useRouter } from '@tarojs/taro'
|
|||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { H5Box, H5Txt } from '../../components/H5Box'
|
import { H5Box, H5Txt } from '../../components/H5Box'
|
||||||
import { MarkdownView } from '../../components/MarkdownView'
|
import { MarkdownView } from '../../components/MarkdownView'
|
||||||
import { resolveVipEbookId, VIP_EBOOKS, type VipEbookPack } from '../../data/vipEbooks'
|
import {
|
||||||
|
isYoutubeNotesBookId,
|
||||||
|
resolveVipEbookId,
|
||||||
|
VIP_EBOOKS,
|
||||||
|
type VipEbookPack,
|
||||||
|
} from '../../data/vipEbooks'
|
||||||
import { loadVipEbook } from '../../services/vipLibrary'
|
import { loadVipEbook } from '../../services/vipLibrary'
|
||||||
import { goPage } from '../../utils/nav'
|
import { goPage } from '../../utils/nav'
|
||||||
import { goVipUnlock, resolveVipContentAccess } from '../../utils/vipAccess'
|
import { goVipUnlock, resolveVipContentAccess } from '../../utils/vipAccess'
|
||||||
@ -33,7 +38,15 @@ type TocItem = { index: number; title: string }
|
|||||||
export default function VipEbookPage() {
|
export default function VipEbookPage() {
|
||||||
const theme = useNomadroTheme()
|
const theme = useNomadroTheme()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const bookId = resolveVipEbookId(router.params?.id)
|
const rawParam = router.params?.id
|
||||||
|
const youtubeMisroute = isYoutubeNotesBookId(rawParam)
|
||||||
|
// Youtube运营笔记(book_id=default) 误进本页时立刻打回 reader,禁止当成数字游民
|
||||||
|
useEffect(() => {
|
||||||
|
if (!youtubeMisroute) return
|
||||||
|
const url = '/pages/reader/index?id=default'
|
||||||
|
void Taro.redirectTo({ url }).catch(() => goPage(url))
|
||||||
|
}, [youtubeMisroute])
|
||||||
|
const bookId = resolveVipEbookId(rawParam)
|
||||||
const safe = getSafeAreaMetrics()
|
const safe = getSafeAreaMetrics()
|
||||||
const [book, setBook] = useState<VipEbookPack>(VIP_EBOOKS[bookId])
|
const [book, setBook] = useState<VipEbookPack>(VIP_EBOOKS[bookId])
|
||||||
const [allowed, setAllowed] = useState(VIP_EBOOKS[bookId].free)
|
const [allowed, setAllowed] = useState(VIP_EBOOKS[bookId].free)
|
||||||
@ -72,6 +85,7 @@ export default function VipEbookPage() {
|
|||||||
}, [toc, tocFilter])
|
}, [toc, tocFilter])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (youtubeMisroute) return
|
||||||
let cancelled = false
|
let cancelled = false
|
||||||
setScrollInto('')
|
setScrollInto('')
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
@ -178,6 +192,14 @@ export default function VipEbookPage() {
|
|||||||
Taro.navigateBack({ fail: () => goPage('/pages/vip/index') })
|
Taro.navigateBack({ fail: () => goPage('/pages/vip/index') })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (youtubeMisroute) {
|
||||||
|
return (
|
||||||
|
<View className={`vip-ebookPage theme-${theme}`}>
|
||||||
|
<Text className="vip-ebookLoading">正在打开 Youtube 运营笔记…</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
return (
|
return (
|
||||||
<H5Box className="veb" data-theme={theme}>
|
<H5Box className="veb" data-theme={theme}>
|
||||||
|
|||||||
@ -485,22 +485,29 @@ function VipLanding() {
|
|||||||
</View>
|
</View>
|
||||||
<H5Box className="vip-ebookGrid">
|
<H5Box className="vip-ebookGrid">
|
||||||
{ebooks.map((e) => {
|
{ebooks.map((e) => {
|
||||||
// 原小册 Youtube运营笔记:谁都能进(自带试读/单买);另支持 VIP 全文;不标「免费」
|
// Youtube运营笔记 = 后台「内容→VIP→电子书→youtube运营笔记」= books/default
|
||||||
const isPaidBooklet =
|
// 必须进 reader?id=default,禁止落到 vip-ebook nomad(数字游民)
|
||||||
|
const title = String(e.title || '')
|
||||||
|
const isYoutubeNotes =
|
||||||
e.id === 'youtube-notes' ||
|
e.id === 'youtube-notes' ||
|
||||||
(typeof e.href === 'string' && e.href.includes('/pages/reader'))
|
e.ebookId === 'default' ||
|
||||||
const isFree = !isPaidBooklet && (Boolean(e.free) || isFreeVip)
|
/youtube|油管|运营笔记/i.test(title) ||
|
||||||
const vipLocked = !isPaidBooklet && !isFree && !canAccess
|
(typeof e.href === 'string' && e.href.includes('id=default'))
|
||||||
|
const isFree = !isYoutubeNotes && (Boolean(e.free) || isFreeVip)
|
||||||
|
const vipLocked = !isYoutubeNotes && !isFree && !canAccess
|
||||||
return (
|
return (
|
||||||
<H5Box
|
<H5Box
|
||||||
key={e.id}
|
key={e.id}
|
||||||
className="vip-card vip-ebookCard"
|
className="vip-card vip-ebookCard"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// 原小册始终可进;VIP 专属电子书才拦
|
|
||||||
if (vipLocked) {
|
if (vipLocked) {
|
||||||
onLocked()
|
onLocked()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (isYoutubeNotes) {
|
||||||
|
goPage('/pages/reader/index?id=default')
|
||||||
|
return
|
||||||
|
}
|
||||||
if (e.href) {
|
if (e.href) {
|
||||||
goPage(e.href)
|
goPage(e.href)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -18,7 +18,7 @@ pnpm --dir apps/miniprogram/weapp build:weapp # 或根目录 pnpm build:weapp
|
|||||||
| `pages/index/` | 兼容旧路径:`reLaunch` → home(勿与 home 共用组件入口,否则无页面 wxss → 微信 ENOENT) |
|
| `pages/index/` | 兼容旧路径:`reLaunch` → home(勿与 home 共用组件入口,否则无页面 wxss → 微信 ENOENT) |
|
||||||
|
|
||||||
`home/index.scss` 已进 `pxExclude`(真 px)。话题链接填:`pages/home/index`。
|
`home/index.scss` 已进 `pxExclude`(真 px)。话题链接填:`pages/home/index`。
|
||||||
发版对照:视觉标准 tag `20261011`;启动路径本轮 tag `20261011b`。
|
发版对照:视觉 `20261011` · 启动路径 `20261011b` · **审核包 `20261011-2`**。
|
||||||
|
|
||||||
## 包体与代码质量
|
## 包体与代码质量
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ pnpm --dir apps/miniprogram/weapp build:weapp # 或根目录 pnpm build:weapp
|
|||||||
| `vip-memo` / `vip-memo-detail` | 知识星球风格:精华/收藏/Markdown;本地缓存秒开 + 静默刷新 |
|
| `vip-memo` / `vip-memo-detail` | 知识星球风格:精华/收藏/Markdown;本地缓存秒开 + 静默刷新 |
|
||||||
| `vip-store` / `vip-store-detail` / `vip-store-orders` | 虚拟卡 + 实物;微信收货地址 |
|
| `vip-store` / `vip-store-detail` / `vip-store-orders` | 虚拟卡 + 实物;微信收货地址 |
|
||||||
| `book` / `reader` | 数字游民小册;后台提审开则读备用合规书(无「提审」UI 文案) |
|
| `book` / `reader` | 数字游民小册;后台提审开则读备用合规书(无「提审」UI 文案) |
|
||||||
|
| VIP 电子书 Youtube | `reader?id=default` | 对应后台 books/default,勿进 `vip-ebook?id=nomad` |
|
||||||
|
|
||||||
电子书 / 课时内容从 `src/modules/vip/app/data` 抽取:
|
电子书 / 课时内容从 `src/modules/vip/app/data` 抽取:
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user