koishi-plugin-prism-neo 0.0.4 → 0.0.6
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 -6
- package/lib/model.d.ts +127 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -305,7 +305,7 @@ async function handleLogoutCmd(context, user) {
|
|
|
305
305
|
messagePrefix,
|
|
306
306
|
`入场时间: ${formatDateTime(res.session.createdAt)}`,
|
|
307
307
|
`离场时间: ${formatDateTime(res.session.closedAt)}`,
|
|
308
|
-
`消费: ${res.
|
|
308
|
+
`消费: ${res.session.finalCost} 月饼`
|
|
309
309
|
].join("\n");
|
|
310
310
|
} else {
|
|
311
311
|
const billingRes = await billing(context, targetUserId);
|
|
@@ -331,13 +331,25 @@ async function handleListCmd(context, user) {
|
|
|
331
331
|
if (!users || users.length === 0) {
|
|
332
332
|
return "窝里目前没有玩家呢";
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const userIds = users.map((user2) => {
|
|
335
335
|
const qqBind = user2.binds.find((bind) => bind.type === "QQ");
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
336
|
+
if (qqBind) {
|
|
337
|
+
const id = qqBind.bid;
|
|
338
|
+
const entryDate = formatDateTime(user2.sessions[0].createdAt);
|
|
339
|
+
return { id, entryDate };
|
|
340
|
+
}
|
|
340
341
|
});
|
|
342
|
+
const platformUsers = await Promise.all(
|
|
343
|
+
userIds.map((id) => {
|
|
344
|
+
return context.session.bot.getUser(id.id);
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
const userReports = platformUsers.map(
|
|
348
|
+
(u, idx) => {
|
|
349
|
+
return `玩家: ${u.name}
|
|
350
|
+
入场时间: ${userIds[idx].entryDate}`;
|
|
351
|
+
}
|
|
352
|
+
);
|
|
341
353
|
return `窝里目前共有 ${users.length} 人
|
|
342
354
|
|
|
343
355
|
${userReports.join("\n\n")}`;
|
package/lib/model.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export interface Bind {
|
|
2
|
+
type: string;
|
|
3
|
+
bid: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SessionInfo {
|
|
6
|
+
createdAt: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LoggedInUser {
|
|
9
|
+
binds: Bind[];
|
|
10
|
+
sessions: SessionInfo[];
|
|
11
|
+
}
|
|
12
|
+
export type ListResponse = LoggedInUser[];
|
|
13
|
+
export interface LogoutSession {
|
|
14
|
+
createdAt: string;
|
|
15
|
+
closedAt: string;
|
|
16
|
+
costOverwrite?: number;
|
|
17
|
+
finalCost: number;
|
|
18
|
+
}
|
|
19
|
+
export interface LogoutBilling {
|
|
20
|
+
totalCost: number;
|
|
21
|
+
}
|
|
22
|
+
export interface BillingSegment {
|
|
23
|
+
ruleId: number;
|
|
24
|
+
ruleName: string;
|
|
25
|
+
startTime: string;
|
|
26
|
+
endTime: string;
|
|
27
|
+
durationMinutes: number;
|
|
28
|
+
cost: number;
|
|
29
|
+
isCapped: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface DiscountLog {
|
|
32
|
+
asset: string;
|
|
33
|
+
saved: number;
|
|
34
|
+
}
|
|
35
|
+
export interface DiscountInfo {
|
|
36
|
+
finalCost: number;
|
|
37
|
+
originalCost: number;
|
|
38
|
+
appliedLogs: DiscountLog[];
|
|
39
|
+
}
|
|
40
|
+
export interface Wallet {
|
|
41
|
+
total: {
|
|
42
|
+
available: number;
|
|
43
|
+
all: number;
|
|
44
|
+
};
|
|
45
|
+
paid: {
|
|
46
|
+
available: number;
|
|
47
|
+
all: number;
|
|
48
|
+
details?: {
|
|
49
|
+
available: UserAsset[];
|
|
50
|
+
unavailable: UserAsset[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
free: {
|
|
54
|
+
available: number;
|
|
55
|
+
all: number;
|
|
56
|
+
details?: {
|
|
57
|
+
available: UserAsset[];
|
|
58
|
+
unavailable: UserAsset[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
tickets: {
|
|
62
|
+
available: number;
|
|
63
|
+
all: number;
|
|
64
|
+
details?: {
|
|
65
|
+
available: UserAssetWithDef[];
|
|
66
|
+
unavailable: UserAssetWithDef[];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
passes: {
|
|
70
|
+
available: number;
|
|
71
|
+
all: number;
|
|
72
|
+
details?: {
|
|
73
|
+
available: UserAssetWithDef[];
|
|
74
|
+
unavailable: UserAssetWithDef[];
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface UserAsset {
|
|
79
|
+
id: number;
|
|
80
|
+
userId: number;
|
|
81
|
+
assetDefId: number;
|
|
82
|
+
assetType: string;
|
|
83
|
+
assetId: number;
|
|
84
|
+
asset: Asset | null;
|
|
85
|
+
addAt: Date;
|
|
86
|
+
activeAt: Date | null;
|
|
87
|
+
expireAt: Date | null;
|
|
88
|
+
comment: string;
|
|
89
|
+
count: number;
|
|
90
|
+
}
|
|
91
|
+
export interface Asset {
|
|
92
|
+
type: string;
|
|
93
|
+
id: number;
|
|
94
|
+
assetId: number;
|
|
95
|
+
name: string;
|
|
96
|
+
expireAt: Date | null;
|
|
97
|
+
activeAt: Date | null;
|
|
98
|
+
description: string | null;
|
|
99
|
+
valid: boolean;
|
|
100
|
+
}
|
|
101
|
+
export type UserAssetWithDef = UserAsset & {
|
|
102
|
+
asset: Asset;
|
|
103
|
+
};
|
|
104
|
+
export interface LogoutResponse {
|
|
105
|
+
session: LogoutSession;
|
|
106
|
+
billing: LogoutBilling;
|
|
107
|
+
}
|
|
108
|
+
export interface BillingInfo {
|
|
109
|
+
startTime: string;
|
|
110
|
+
endTime: string;
|
|
111
|
+
totalCost: number;
|
|
112
|
+
segments: BillingSegment[];
|
|
113
|
+
}
|
|
114
|
+
export interface BillingResponse {
|
|
115
|
+
session: LogoutSession;
|
|
116
|
+
billing: BillingInfo;
|
|
117
|
+
discount?: DiscountInfo;
|
|
118
|
+
wallet: Wallet;
|
|
119
|
+
}
|
|
120
|
+
export interface ApiErrorData {
|
|
121
|
+
message: string;
|
|
122
|
+
}
|
|
123
|
+
export interface ApiError {
|
|
124
|
+
response: {
|
|
125
|
+
data: ApiErrorData;
|
|
126
|
+
};
|
|
127
|
+
}
|