fix(cafe24): 모바일 상세설명 '직접등록' 오적용·적용직후 읽기지연 수정
- PUT 시 mobile_description 필드를 더 이상 보내지 않는다. 그 필드를 보내는 순간 카페24가 모바일 상세설명 설정을 "직접 등록"으로 바꿔버림을 실물로 확인(separated_mobile_description 이 'T'가 됨). 대신 separated_mobile_description="F" 만 지정해 "PC 상세설명과 동일"을 강제하고, 카페24가 모바일 값을 PC 와 자동으로 맞추게 한다. 화면 적용(apply)과 예약 적용(worker) 양쪽 다 수정. - products.wait_for_description 추가 — 적용 직후 카페24 관리자 API 의 짧은 읽기 지연(쓰기 직후 몇 초간 이전 값을 돌려줌 — 쇼핑몰 화면에는 바로 반영됨)을 0.8초 간격 최대 3회 재확인으로 흡수. "쇼핑몰엔 반영됐는데 카페24 상품관리 화면만 적용 안 된 것처럼 보이는" 증상 완화. - CAFE24_SHOP_URL 예시를 www.miras.co.kr 로 갱신(.env.example) — 실제 값은 운영 서버 .env 에서 직접 설정해야 함(코드는 그대로 이 값을 읽어 다이렉트 주소를 만듦). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,6 @@ def _apply(store_db: Any, api: Any, row: dict[str, Any]) -> str:
|
||||
|
||||
# 상세설명을 바꿀 때는 쓰기 직전 현재값을 읽어 백업한다(로컬 값을 믿지 않는다).
|
||||
backup_id = 0
|
||||
mobile_html: str | None = None
|
||||
if html is not None:
|
||||
current = products.fetch_descriptions(api.client, product_no)
|
||||
backup_id = store_db.add_revision(
|
||||
@@ -77,17 +76,22 @@ def _apply(store_db: Any, api: Any, row: dict[str, Any]) -> str:
|
||||
memo=f"예약 #{schedule_id} 적용 직전 자동 백업 (모바일)",
|
||||
created_by=ACTOR,
|
||||
)
|
||||
# PC/모바일은 구분하지 않는다 — 화면 편집과 같은 방침.
|
||||
mobile_html = html
|
||||
|
||||
# PC/모바일은 구분하지 않는다 — mobile_description 은 보내지 않고
|
||||
# separated_mobile_description="F" 로 "PC 상세설명과 동일"을 강제한다.
|
||||
# (mobile_description 을 직접 보내면 카페24가 그 설정을 "직접 등록"으로 바꿔버린다.)
|
||||
products.update_product(
|
||||
api.client,
|
||||
product_no,
|
||||
description=html,
|
||||
mobile_description=mobile_html,
|
||||
separated_mobile_description="F" if html is not None else None,
|
||||
display=set_display,
|
||||
selling=set_selling,
|
||||
)
|
||||
if html is not None:
|
||||
# 화면 편집(apply)과 동일 — 카페24 관리자 API 의 쓰기 직후 읽기 지연을
|
||||
# 여기서 짧게 흡수한다(쇼핑몰에는 바로 반영되지만 관리자 조회만 뒤쳐질 때가 있다).
|
||||
products.wait_for_description(api.client, product_no, html)
|
||||
|
||||
summary = store.describe_schedule_action(
|
||||
has_html=html is not None, set_display=set_display, set_selling=set_selling
|
||||
|
||||
Reference in New Issue
Block a user