Implement credit parse result polling and sentinel handling

This commit is contained in:
wkc
2026-05-18 10:56:25 +08:00
parent 9917d10e59
commit 1fadb38d99
25 changed files with 918 additions and 81 deletions

View File

@@ -12,6 +12,7 @@ router = APIRouter()
payload_service = CreditPayloadService("config/credit_feature_schema.json")
debug_service = CreditDebugService("config/credit_response_examples.json")
identity_service = CreditHtmlIdentityService()
result_cache = {}
@router.post("/api/service/interface/invokeService/xfeature")
@@ -40,6 +41,27 @@ async def html_eval(
filename=remote_filename(remotePath),
subject_identity=subject_identity,
)
result_cache[serialNum] = payload
return debug_service.build_initiate_success_response(serialNum)
@router.post("/api/service/interface/invokeService/xfeatureResult")
async def html_eval_result(
serialNum: Optional[str] = Form(None),
orgCode: Optional[str] = Form(None),
runType: Optional[str] = Form(None),
):
error_response = debug_service.validate_result_request(
serial_num=serialNum,
org_code=orgCode,
run_type=runType,
)
if error_response:
return error_response
payload = result_cache.get(serialNum)
if payload is None:
return debug_service.build_result_not_found_response(serialNum)
return debug_service.build_success_response(payload)