大量优化修改扣积分规则
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
X
|
||||
} from "lucide-react";
|
||||
import type { AITask, Asset, ImageConversation, ImageConversationTask, ModelConfig, ModelEntity, Product, WorkbenchTask } from "../types";
|
||||
import { pointsPerImageFromCatalog } from "../components/free-create/constants";
|
||||
import { api } from "../api";
|
||||
import { useFileDrop } from "../components/use-file-drop";
|
||||
import { imageModelPickerOptions } from "../model-display";
|
||||
@@ -727,13 +728,13 @@ export function ImageWorkbenchPage({
|
||||
useEffect(() => {
|
||||
void api.billingConfig().then((cfg) => setPriceMultiplier(Number(cfg.team_price_multiplier) || 1)).catch(() => undefined);
|
||||
}, []);
|
||||
// 每张图实扣单价:取「当前选的生图模型」的 unit_price(火山/gpt-image),没匹配上用第一个图像模型,
|
||||
// 再兜底 20 积分(后端 quote_flat=unit_price 积分/张,默认模型 gpt-image-2=20 积分)。前端预估据此算,和后端实扣一致(PMC#20)。
|
||||
// 每张图实扣单价:优先后台挂牌 points_pricing.points_per_image,否则 unit_price,再兜底 20。
|
||||
// 与后端 quote_flat / image_points_per_unit 同口径(PMC#20)。
|
||||
const perImagePrice = (() => {
|
||||
const want = genModel === "gpt-image" ? "gpt-image" : genModel === "volcano" ? "seedream" : genModel;
|
||||
const m = imageModels.find((x) => x.name.toLowerCase().includes(want)) || imageModels[0];
|
||||
const p = Number(m?.unit_price);
|
||||
return Number.isFinite(p) && p > 0 ? p : 20;
|
||||
const listed = pointsPerImageFromCatalog(m);
|
||||
return listed != null && listed > 0 ? listed : 20;
|
||||
})();
|
||||
// 与后端逐张对齐:每张 = 挂牌单价取整 × 系数 → HALF_UP 最低 1,总价 = 张数 × 单张
|
||||
// (不能先乘张数再取整:0.85 系数 × 3 张会比后端逐张各取整少 1-2 积分,review 确认)
|
||||
|
||||
Reference in New Issue
Block a user