You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

17 hours ago
# -*- coding: utf-8 -*-
"""提取 A7 页面清单(pages dict 的 key = 页面名.html)+ sitemap 归属"""
import json, io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
doc = json.load(open(r'e:\code\crm-backend-matt\.scratch\lanhu-latest\axure-v29.json', encoding='utf-8'))
pages = doc['pages']
# ---- A7 页面(按 key 过滤,key = 页面名.html)----
a7 = {k: v for k, v in pages.items() if k.upper().startswith('A7')}
print('=== A7 pages:', len(a7), '===')
for k, v in a7.items():
print(f"{k} | mapping={v['mapping_md5']}")
# ---- sitemap walk:输出每个叶子页的路径(区分正式树与草稿箱)----
def walk(node, path, out):
name = node.get('pageName', '')
cur = path + [name] if node.get('type') != 'Axure:Page' else path
url = node.get('url')
if url:
out.append(('/'.join(cur), url))
for ch in node.get('children') or []:
walk(ch, cur, out)
leaves = []
for rn in doc['sitemap']['rootNodes']:
walk(rn, [], leaves)
a7_tree = [(p, u) for p, u in leaves if u.upper().startswith('A7')]
print('=== A7 in sitemap tree:', len(a7_tree), '===')
for p, u in a7_tree:
print(f'{u} <- {p}')