重构
This commit is contained in:
@@ -92,19 +92,30 @@ export async function syncWc2026OutrightMarket(
|
||||
startTime: new Date('2027-07-01T00:00:00Z'),
|
||||
status: 'PUBLISHED',
|
||||
publishTime: new Date(),
|
||||
isHot: true,
|
||||
isHot: false,
|
||||
displayOrder: 0,
|
||||
},
|
||||
});
|
||||
} else if (match.status === 'DRAFT' || match.status === 'SETTLED' || match.status === 'CLOSED') {
|
||||
match = await prisma.match.update({
|
||||
where: { id: match.id },
|
||||
data: {
|
||||
status: 'PUBLISHED',
|
||||
publishTime: match.publishTime ?? new Date(),
|
||||
closeTime: null,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const shouldPublish =
|
||||
match.status === 'DRAFT' || match.status === 'SETTLED' || match.status === 'CLOSED';
|
||||
if (match.isHot || shouldPublish) {
|
||||
const updateData: {
|
||||
isHot: boolean;
|
||||
status?: string;
|
||||
publishTime?: Date;
|
||||
closeTime?: null;
|
||||
} = { isHot: false };
|
||||
if (shouldPublish) {
|
||||
updateData.status = 'PUBLISHED';
|
||||
updateData.publishTime = match.publishTime ?? new Date();
|
||||
updateData.closeTime = null;
|
||||
}
|
||||
match = await prisma.match.update({
|
||||
where: { id: match.id },
|
||||
data: updateData,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let market = await prisma.market.findFirst({
|
||||
|
||||
Reference in New Issue
Block a user