下单接口支持其他店铺
/api/order/get_shipping_fee 与购物车加入逻辑此前只认官方自营详情页,加盟店运费分桶 仅靠自由文本 supplier 判断,未与其他店铺列表的 tenpo_cd 打通。补充 OrderItem/ CargoItemRequest 的 tenpo_cd/branch_number 字段,运费计算优先按 tenpo_cd 分桶 (无则回退 supplier 保持兼容),cargo_service 加购 URL 同步带上店铺参数。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@ class CargoService:
|
||||
continue
|
||||
|
||||
logger.debug("进入商品 %s 详情页,准备购买数量: %s...", product_id, number)
|
||||
detail_url = product_detail_url(product_id)
|
||||
detail_url = product_detail_url(product_id, item.tenpo_cd, item.branch_number)
|
||||
await page.goto(detail_url, wait_until="domcontentloaded", timeout=20000)
|
||||
|
||||
# 判断是否缺货
|
||||
|
||||
@@ -265,6 +265,11 @@ class SurugayaClient:
|
||||
# 提取面包屑
|
||||
breadcrumb_list = self.get_breadcrumb_list(tree)
|
||||
|
||||
# 仅当调用方显式要求时,才额外抓取「他のショップ」页面(多付出一次 Cloudflare 保护页面请求)
|
||||
other_shop_list: list[OtherShopItem] = []
|
||||
if payload.include_other_shops:
|
||||
other_shop_list = await self._fetch_other_shop_list(goods_id)
|
||||
|
||||
detail = ProductDetailData(
|
||||
goods_id=goods_id,
|
||||
goods_name=goods_name,
|
||||
@@ -279,6 +284,7 @@ class SurugayaClient:
|
||||
price_note=price_note,
|
||||
shipping_comission_fee=shipping_comission_fee,
|
||||
breadcrumb_list=breadcrumb_list,
|
||||
other_shop_list=other_shop_list,
|
||||
)
|
||||
logger.debug("详情页解析完成:goods_id=%s goods_name=%s ", detail.goods_id, detail.goods_name)
|
||||
return detail
|
||||
|
||||
Reference in New Issue
Block a user