贴标申请,仓储转运
This commit is contained in:
@@ -6,7 +6,10 @@ import { dirname, join, resolve } from 'node:path'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const domestic = process.env.ADMIN_TEST_GATEWAY || 'http://127.0.0.1:9000'
|
||||
const overseas = process.env.ADMIN_OVERSEAS_GATEWAY || 'http://127.0.0.1:9300'
|
||||
// Unified gateway is the only public entry point after the architecture cutover.
|
||||
// Keep an explicit override for older local runs, but never default acceptance
|
||||
// to the retired standalone overseas gateway.
|
||||
const overseas = process.env.ADMIN_OVERSEAS_GATEWAY || domestic
|
||||
const store = process.env.CODEX_BROWSER_LOCAL_STORAGE || join(process.env.APPDATA || '', 'Codex', 'web', 'Codex', 'Default', 'Partitions', 'codex-browser-app', 'Local Storage', 'leveldb')
|
||||
const outputDir = resolve(process.env.OVERSEAS_CURRENT_SESSION_OUTPUT_DIR || 'reports/current-session-overseas-relabel')
|
||||
const adminLoginId = process.env.ADMIN_TEST_USERNAME || 'platform_admin'
|
||||
@@ -114,6 +117,9 @@ async function createPda(adminToken, warehouseId, onCreated) {
|
||||
}
|
||||
|
||||
async function merchantSessionForTenant(adminToken, tenantId) {
|
||||
// Tenant 0 is the platform scope, not a merchant tenant and cannot be impersonated.
|
||||
assert(/^\d+$/.test(id(tenantId)) && BigInt(tenantId) > 0n,
|
||||
`Invalid merchant tenant for impersonation: ${id(tenantId) || 'missing'}`)
|
||||
const ticket = await api(domestic, adminToken, 'POST',
|
||||
`/api/platform/v1/iam/tenants/${tenantId}/impersonation`, { reason: `${marker} 海外换标真实验收` })
|
||||
return api(domestic, '', 'POST', '/api/auth/impersonations/exchange', { code: ticket.code })
|
||||
@@ -165,9 +171,13 @@ try {
|
||||
try {
|
||||
preferredMerchant = await refreshStoredSession('cc-client-refresh-token', 'merchant')
|
||||
} catch {
|
||||
if (storedCustomerId) preferredMerchant = await merchantSessionForTenant(admin.accessToken, storedCustomerId)
|
||||
if (storedCustomerId && BigInt(storedCustomerId) > 0n) {
|
||||
try { preferredMerchant = await merchantSessionForTenant(admin.accessToken, storedCustomerId) } catch {}
|
||||
}
|
||||
}
|
||||
assert(admin.accessToken && admin.overseasAccessToken, 'Platform refresh response did not contain both regional tokens')
|
||||
// Domestic gateway architecture issues one platform access token; an overseas
|
||||
// token is only required for the PDA session created below.
|
||||
assert(admin.accessToken, 'Platform login/refresh response did not contain an access token')
|
||||
const resume = process.env.OVERSEAS_RESUME_FULFILLMENT === 'true'
|
||||
if (resume && (!process.env.OVERSEAS_TEST_CUSTOMER_ID || !process.env.OVERSEAS_TEST_WAREHOUSE_ID)) throw new Error('Resume requires explicit customer and warehouse from the saved run')
|
||||
const scope = resume ? {
|
||||
|
||||
Reference in New Issue
Block a user