支持其他店铺

This commit is contained in:
2026-07-08 21:53:20 +08:00
parent af8d3a859f
commit 7ddb41cea1
10 changed files with 932 additions and 432 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "surugaya-common"
version = "0.3.0"
version = "0.4.0"
description = "Shared contracts and browser utilities (Redis keys, models, parsers, fingerprint profile) for jp_surugaya services"
requires-python = ">=3.12"
dependencies = [
@@ -9,14 +9,24 @@ CARGO_DETAIL_URL = f"{BASE_URL}/cargo/detail"
MYPAGE_URL = f"{BASE_URL}/pcmypage"
def product_detail_url(product_id: str, tenpo_cd: str | None = None) -> str:
"""商品详情页地址;tenpo_cd 用于加盟店商品"""
def product_detail_url(product_id: str, tenpo_cd: str | None = None, branch_number: str | None = None) -> str:
"""商品详情页地址;tenpo_cd/branch_number 用于指定加盟店/市场店铺的具体报价"""
url = f"{BASE_URL}/product/detail/{product_id}"
params = []
if tenpo_cd:
url += f"?tenpo_cd={tenpo_cd}"
params.append(f"tenpo_cd={tenpo_cd}")
if branch_number:
params.append(f"branch_number={branch_number}")
if params:
url += "?" + "&".join(params)
return url
def product_other_url(product_id: str) -> str:
"""商品「他のショップ」页地址:列出该商品全部店铺(官方自营+加盟店/市场店铺)报价。"""
return f"{BASE_URL}/product/other/{product_id}"
def trade_detail_url(trade_code: str) -> str:
"""交易(订单)详情页地址。"""
return f"{BASE_URL}/pcmypage/action_sell_search/detail?trade_code={trade_code}"