MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / load_products

Method load_products

app/services/payment_service.py:519–588  ·  view source on GitHub ↗
(
        self,
        account_id: str,
        *,
        invitation_code: str | None = None,
        account: AccountRecord | None = None,
        session: AccountSessionState | None = None,
        flow: FlowRun | None = None,
    )

Source from the content-addressed store, hash-verified

517 "challenge": None,
518 "verify": {
519 "skipped": True,
520 "error_code": "OCR_EXCEPTION",
521 "error_message": exc.message,
522 "details": exc.details,
523 },
524 "ticket": "",
525 "randstr": "",
526 "status": "ocr_exception",
527 }
528 attempts.append(result)
529 last_result = result
530 self.runtime_logs.log_event(
531 flow,
532 stage="captcha_attempt",
533 status="retry",
534 message="OCR 识别异常,刷新验证码重试",
535 details={"attempt": attempt, "error": exc.message, "details": exc.details},
536 level=logging.WARNING,
537 )
538 self._push_runtime_message(
539 account_id,
540 f"验证码 OCR 异常,第 {attempt} 轮重试中",
541 )
542 continue
543 ocr_gate = self._captcha_ocr_gate(challenge)
544 if not ocr_gate["usable"]:
545 result = {
546 "attempt": attempt,
547 "challenge": challenge,
548 "verify": {
549 "skipped": True,
550 "error_code": "OCR_INCOMPLETE",
551 "error_message": "OCR 点位少于 3 个或置信度不达标,跳过 verify 并刷新重试。",
552 "ocr_gate": ocr_gate,
553 },
554 "ticket": "",
555 "randstr": "",
556 "status": "ocr_rejected",
557 }
558 attempts.append(result)
559 last_result = result
560 self.runtime_logs.log_event(
561 flow,
562 stage="ocr_gate",
563 status="retry",
564 message="OCR 点位未达标,刷新验证码重试",
565 details={"attempt": attempt, **ocr_gate},
566 level=logging.WARNING,
567 )
568 self._push_runtime_message(
569 account_id,
570 f"验证码点位不足或不匹配,第 {attempt} 轮重试中",
571 )
572 continue
573
574 verify = self.submit_captcha_verify(account_id, CaptchaVerifyPayloadRequest(), flow=flow)
575 error_code = str(verify.get("error_code") or "")
576 result = {

Callers 3

_check_stock_onceMethod · 0.80
get_productsFunction · 0.80

Calls 10

bootstrap_accountMethod · 0.95
_ensure_dictMethod · 0.95
_merge_productsMethod · 0.95
start_runMethod · 0.80
get_accountMethod · 0.80
load_sessionMethod · 0.80
log_eventMethod · 0.80
batch_previewMethod · 0.80
save_sessionMethod · 0.80
finish_runMethod · 0.80

Tested by

no test coverage detected