koishi-plugin-prism-neo 0.0.13 → 0.0.14
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 +18 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -228,6 +228,17 @@ var formatBilling = /* @__PURE__ */ __name((res) => {
|
|
|
228
228
|
message.push("--- 账单详情 ---");
|
|
229
229
|
message.push(`入场: ${formatDateTime(res.session.createdAt)}`);
|
|
230
230
|
message.push(`结算: ${formatDateTime(res.billing.endTime)}`);
|
|
231
|
+
const startTime = new Date(res.session.createdAt).getTime();
|
|
232
|
+
const endTime = new Date(res.billing.endTime).getTime();
|
|
233
|
+
const durationMs = endTime - startTime;
|
|
234
|
+
const totalMinutes = Math.floor(durationMs / (1e3 * 60));
|
|
235
|
+
let durationStr = `${totalMinutes}分钟`;
|
|
236
|
+
if (totalMinutes >= 60) {
|
|
237
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
238
|
+
const mins = totalMinutes % 60;
|
|
239
|
+
durationStr = `${hours}小时${mins}分钟`;
|
|
240
|
+
}
|
|
241
|
+
message.push(`时长: ${durationStr}`);
|
|
231
242
|
message.push("---");
|
|
232
243
|
const originalCost = res.discount ? res.discount.originalCost : res.billing.totalCost;
|
|
233
244
|
let finalCost = res.discount ? res.discount.finalCost : res.billing.totalCost;
|
|
@@ -267,8 +278,15 @@ var formatBilling = /* @__PURE__ */ __name((res) => {
|
|
|
267
278
|
} else {
|
|
268
279
|
timeString = `${formatDate(start)} ${formatTime(start)} - ${formatDate(end)} ${formatTime(end)}`;
|
|
269
280
|
}
|
|
281
|
+
let segDurationStr = `${seg.durationMinutes}分钟`;
|
|
282
|
+
if (seg.durationMinutes >= 60) {
|
|
283
|
+
const hours = Math.floor(seg.durationMinutes / 60);
|
|
284
|
+
const mins = seg.durationMinutes % 60;
|
|
285
|
+
segDurationStr = `${hours}小时${mins}分钟`;
|
|
286
|
+
}
|
|
270
287
|
message.push(`- ${seg.ruleName}`);
|
|
271
288
|
message.push(` 时段: ${timeString}`);
|
|
289
|
+
message.push(` 时长: ${segDurationStr}`);
|
|
272
290
|
message.push(` 费用: ${seg.cost} 月饼 ${seg.isCapped ? "(已封顶)" : ""}`);
|
|
273
291
|
}
|
|
274
292
|
});
|