fix: simplify recharge copy
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-04-27 22:57:02 +08:00
parent dfec8d7ee3
commit 35c4c02579
3 changed files with 12 additions and 4 deletions

View File

@ -172,7 +172,7 @@ async function handleNotify(request: NextRequest) {
userId: paidOrder.userId,
amount: paidOrder.points,
reason: "recharge",
note: `DuluPay 充值 (${paidOrder.outTradeNo})`,
note: "充值积分",
});
}
});

View File

@ -32,6 +32,15 @@ function mapLedgerReasonLabel(reason: string) {
return reason || "积分变动";
}
function formatLedgerDetail(reason: string, note: string | null | undefined) {
if (reason === "recharge") {
return "充值积分";
}
const trimmedNote = typeof note === "string" ? note.trim() : "";
return trimmedNote || mapLedgerReasonLabel(reason);
}
export async function GET() {
try {
const session = await auth();
@ -92,7 +101,7 @@ export async function GET() {
const usageRecords = ledger.map((item) => ({
id: item.id,
detail: item.note || mapLedgerReasonLabel(item.reason),
detail: formatLedgerDetail(item.reason, item.note),
status: item.amount < 0 ? "consumed" : "earned",
amount: item.amount,
createdAt: item.createdAt?.toISOString() || new Date().toISOString(),

View File

@ -2774,9 +2774,8 @@ export function LovartHome({
{siteSettingsData?.dulupayConfig?.enabled === true &&
enabledPointsPackages.length > 0 ? (
<section className="mb-5 rounded-2xl border border-black/10 bg-white p-3.5 dark:border-white/10 dark:bg-[#17171b]">
<div className="mb-2 flex items-center justify-between">
<div className="mb-2 flex items-center">
<h4 className="text-base font-semibold text-black dark:text-white">积分充值</h4>
<span className="text-[11px] text-black/45 dark:text-white/45">支持 DuluPay 即时到账</span>
</div>
<div className="grid grid-cols-1 gap-2.5 md:grid-cols-3">
{enabledPointsPackages.map((pkg) => {