diff --git a/apps/web/src/pages/generate/GeneratePage.tsx b/apps/web/src/pages/generate/GeneratePage.tsx index e41a8da8c..e7ca18edd 100644 --- a/apps/web/src/pages/generate/GeneratePage.tsx +++ b/apps/web/src/pages/generate/GeneratePage.tsx @@ -39,7 +39,7 @@ const GeneratePage: React.FC = () => { /* ── 表单状态 ── */ const formState = useGenerateFormState() /* ── 积分状态 ── */ - const { balance, init: initPoints } = usePointsStore() + const { balance, dailyUsage, rules, init: initPoints } = usePointsStore() useEffect(() => { initPoints() }, [initPoints]) @@ -358,7 +358,14 @@ const GeneratePage: React.FC = () => { const handleConfirmGenerate = useCallback(async () => { // 积分预检查 const units = isBatch ? Math.max(selectedVariantIds.length, 1) : 1 - const check = hasEnoughPoints(balance ?? null, units) + const check = hasEnoughPoints( + balance ?? null, + units, + dailyUsage ?? null, + [], + "free", + rules?.free_user_multiplier ?? 1.15, + ) if (!check.sufficient) { message.error(check.reason ?? "积分不足,请充值") return @@ -397,6 +404,8 @@ const GeneratePage: React.FC = () => { handleGenerate, setCurrentStep, balance, + dailyUsage, + rules, ]) /* ── 步骤导航 ── */ @@ -423,8 +432,16 @@ const GeneratePage: React.FC = () => { /* ── 积分消耗估算(步骤3确认生成展示用) ── */ const unitsForCost = isBatch ? Math.max(selectedVariantIds.length, 1) : 1 const pointsEstimate = useMemo( - () => hasEnoughPoints(balance ?? null, unitsForCost), - [unitsForCost, balance], + () => + hasEnoughPoints( + balance ?? null, + unitsForCost, + dailyUsage ?? null, + [], + "free", + rules?.free_user_multiplier ?? 1.15, + ), + [unitsForCost, balance, dailyUsage, rules], ) const insufficientPoints = !pointsEstimate.sufficient