统一前后端代码格式化配置
This commit is contained in:
@@ -61,7 +61,9 @@ async function requireExecutorAction<T>(
|
||||
}
|
||||
|
||||
function isKuaishouCloudBindingReady(flow: ReturnType<typeof normalizeKuaishouCloudFlow>) {
|
||||
return flow.binding.prepareStatus === 'ready' && Boolean(String(flow.binding.bindUrl || '').trim())
|
||||
return (
|
||||
flow.binding.prepareStatus === 'ready' && Boolean(String(flow.binding.bindUrl || '').trim())
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,9 +162,10 @@ async function verifyIndustryVoucherTicket(
|
||||
shopId: context.order.shop_id,
|
||||
shopName: context.order.shop_name,
|
||||
autoConsumeEnabled: true,
|
||||
consumedAt: voucherContext.status === 'CONSUMED'
|
||||
? voucherContext.consumedAt || flow.consume.consumedAt || now
|
||||
: flow.consume.consumedAt,
|
||||
consumedAt:
|
||||
voucherContext.status === 'CONSUMED'
|
||||
? voucherContext.consumedAt || flow.consume.consumedAt || now
|
||||
: flow.consume.consumedAt,
|
||||
},
|
||||
certInfo: {
|
||||
certExpireType,
|
||||
@@ -242,8 +245,10 @@ export async function getKuaishouCloudClaimDetail(token: unknown): Promise<Claim
|
||||
// 已核销也要走 verify:内部会补 prepare 绑定资源
|
||||
if (flow.consume.status !== 'success' || !isKuaishouCloudBindingReady(flow)) {
|
||||
const now = nowIso()
|
||||
const prepared: ClaimDetailPayload | null = await verifyIndustryVoucherTicket(context, now)
|
||||
.catch(() => null)
|
||||
const prepared: ClaimDetailPayload | null = await verifyIndustryVoucherTicket(
|
||||
context,
|
||||
now,
|
||||
).catch(() => null)
|
||||
if (prepared) {
|
||||
return prepared
|
||||
}
|
||||
@@ -255,15 +260,14 @@ export async function getKuaishouCloudClaimDetail(token: unknown): Promise<Claim
|
||||
const flow = normalizeKuaishouCloudFlow(taskContext.kuaishouCloudFulfillment)
|
||||
const needsIndustryVoucherPrepare =
|
||||
hasUsableIndustryVoucher(taskContext) &&
|
||||
(
|
||||
flow.ticket.status !== 'verified' ||
|
||||
!isKuaishouCloudBindingReady(flow)
|
||||
)
|
||||
(flow.ticket.status !== 'verified' || !isKuaishouCloudBindingReady(flow))
|
||||
|
||||
if (needsIndustryVoucherPrepare) {
|
||||
const now = nowIso()
|
||||
const prepared: ClaimDetailPayload | null = await verifyIndustryVoucherTicket(context, now)
|
||||
.catch(() => null)
|
||||
const prepared: ClaimDetailPayload | null = await verifyIndustryVoucherTicket(
|
||||
context,
|
||||
now,
|
||||
).catch(() => null)
|
||||
if (prepared) {
|
||||
return prepared
|
||||
}
|
||||
@@ -273,7 +277,8 @@ export async function getKuaishouCloudClaimDetail(token: unknown): Promise<Claim
|
||||
if (!isKuaishouCloudMockTask(task)) {
|
||||
const latestFlow = normalizeKuaishouCloudFlow(parseTaskContext(task).kuaishouCloudFulfillment)
|
||||
if (
|
||||
(latestFlow.ticket.status === 'verified' || hasUsableIndustryVoucher(parseTaskContext(task))) &&
|
||||
(latestFlow.ticket.status === 'verified' ||
|
||||
hasUsableIndustryVoucher(parseTaskContext(task))) &&
|
||||
!isKuaishouCloudBindingReady(latestFlow)
|
||||
) {
|
||||
task = await ensureKuaishouCloudBindingPrepared(task, {
|
||||
@@ -816,8 +821,8 @@ async function refreshAffiliateDashBindState(task: TaskRow): Promise<TaskRow | n
|
||||
// (不依赖平台 mismatch 字段,防止平台未标记但实际账号不一致的情况)。
|
||||
const localMismatch = Boolean(
|
||||
boundAccount &&
|
||||
expectedGameAccount &&
|
||||
normalizeUid(boundAccount) !== normalizeUid(expectedGameAccount),
|
||||
expectedGameAccount &&
|
||||
normalizeUid(boundAccount) !== normalizeUid(expectedGameAccount),
|
||||
)
|
||||
const nextFlow = {
|
||||
...flow,
|
||||
@@ -923,10 +928,11 @@ function hasUsableIndustryVoucher(context: JsonObject = {}) {
|
||||
}
|
||||
|
||||
function normalizeIndustryVoucherContext(value: unknown): JsonObject {
|
||||
const source = value && typeof value === 'object' && !Array.isArray(value)
|
||||
? value as JsonObject
|
||||
: {}
|
||||
const status = String(source.status || 'UNUSED').trim().toUpperCase()
|
||||
const source =
|
||||
value && typeof value === 'object' && !Array.isArray(value) ? (value as JsonObject) : {}
|
||||
const status = String(source.status || 'UNUSED')
|
||||
.trim()
|
||||
.toUpperCase()
|
||||
|
||||
return {
|
||||
...source,
|
||||
|
||||
Reference in New Issue
Block a user