koishi-plugin-prism 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +7 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -388,7 +388,7 @@ class PrismKoishiService {
|
|
|
388
388
|
const total = Number(rawAmount);
|
|
389
389
|
if (!Number.isFinite(total) || total < 0)
|
|
390
390
|
return "金额必须为非负数";
|
|
391
|
-
const reason = cleanText(rawReason) || "
|
|
391
|
+
const reason = cleanText(rawReason) || "管理员调价";
|
|
392
392
|
const result = (await this.client.checkoutWithOverrideByIdentity(this.identity(sender), total, reason));
|
|
393
393
|
const playerId = String(result?.playerSettlement?.playerId ?? result?.settlement?.playerId ?? "");
|
|
394
394
|
if (playerId)
|
|
@@ -1035,11 +1035,15 @@ class PrismKoishiService {
|
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
|
-
const visibleCheckoutAdjustments = checkoutAdjustments.filter((adjustment) =>
|
|
1038
|
+
const visibleCheckoutAdjustments = checkoutAdjustments.filter((adjustment) => {
|
|
1039
|
+
const amount = toNumber(firstDefined(adjustment ?? {}, "amount", "saved", 0));
|
|
1040
|
+
const isOverride = cleanText(adjustment?.source).startsWith("staff.override:");
|
|
1041
|
+
return amount !== 0 && !isOverride;
|
|
1042
|
+
});
|
|
1039
1043
|
lines.push("");
|
|
1040
1044
|
const cappedTotal = Math.max(0, toNumber(subtotal) + pricingCapAdjustments.reduce((sum, adjustment) => sum + toNumber(adjustment?.amount ?? 0), 0));
|
|
1041
1045
|
lines.push(`计费总价:${formatNumber(cappedTotal)}${currency}`);
|
|
1042
|
-
const hasManualAdjustment =
|
|
1046
|
+
const hasManualAdjustment = checkoutAdjustments.some((adjustment) => cleanText(adjustment?.source).startsWith("staff.override:"));
|
|
1043
1047
|
if (visibleCheckoutAdjustments.length > 0) {
|
|
1044
1048
|
lines.push("");
|
|
1045
1049
|
for (const adjustment of visibleCheckoutAdjustments) {
|