This commit is contained in:
2026-08-14 10:57:05 +08:00
parent 66089f9b99
commit 91e781b3ff
16 changed files with 219 additions and 119 deletions
@@ -179,7 +179,7 @@ async function prepareInboundStatus(context, target) {
const isMeasurementQuery = method === 'GET' && path.includes(`/inbounds/${inboundId}/measurement?`)
if (isMeasurementQuery) {
const response = await originalRequest.call(context, method, path, body, token, headers)
if (target === 'MEASURING' && data(response)?.processStatus === 'MEASURING') throw stop
if (target === 'MEASURING' && ok(response) && data(response)?.measurementId) throw stop
return response
}
if (target === 'MEASURE_PENDING' && isSubmit) {
@@ -192,11 +192,11 @@ async function prepareInboundStatus(context, target) {
if (!ok(submitted)) throw new Error(`MEASURE_REJECTED 提交失败: HTTP=${submitted?.http}, code=${submitted?.body?.code}`)
const latest = await originalRequest.call(context, 'GET', detailPath, undefined, token)
const version = Number(data(latest)?.summary?.version)
const rejected = await originalRequest.call(context, 'POST',
path.replace('/measurement/submit', '/measurements/reject'),
const rejectPath = `/api/platform/v1/inbounds/${query(inboundId)}/measurements/reject?tenantId=${query(tenantId)}`
const rejected = await originalRequest.call(context, 'POST', rejectPath,
{ measurementId: body?.measurementId, expectedVersion: version, reason: `${fixtureMarker} 保留审核驳回样本` },
token, { 'Idempotency-Key': `${fixtureMarker}-reject`.slice(0, 128) })
if (!ok(rejected)) throw new Error(`MEASURE_REJECTED 审核驳回失败: HTTP=${rejected?.http}, code=${rejected?.body?.code}`)
if (!ok(rejected)) throw new Error(`MEASURE_REJECTED 审核驳回失败: HTTP=${rejected?.http}, code=${rejected?.body?.code}, requestId=${rejected?.requestId || 'missing'}, traceId=${rejected?.traceId || 'missing'}`)
throw stop
}
return originalRequest.call(context, method, path, body, token, headers)