@seayoo-web/gamer-api 2.9.6 → 2.9.8
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/dist/index.js +389 -398
- package/package.json +5 -5
- package/types/src/community.d.ts +1 -1
- package/types/src/community.guards.d.ts +1 -1
- package/types/src/event.config/feature.lottery.d.ts +1 -1
- package/types/src/event.d.ts +2 -2
- package/types/src/event.engage/engage.lotteryDraw.d.ts +1 -1
- package/types/src/event.enums.d.ts +0 -12
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { isComboWebView as
|
|
2
|
-
import { isPlainObject as
|
|
1
|
+
import { isComboWebView as me } from "@seayoo-web/combo-webview";
|
|
2
|
+
import { isPlainObject as w, supportWx as b, useConsole as ue, usePromise as de, pruneURL as ge, supportWindow as pe, queryString as S, pruneObject as c, omitFields as k, parseJSON as _e, removePara as G } from "@seayoo-web/utils";
|
|
3
3
|
import { v as e, objectGuard as s } from "@seayoo-web/validator";
|
|
4
|
-
function
|
|
5
|
-
return
|
|
4
|
+
function be(i) {
|
|
5
|
+
return w(i, "gamer_token") && typeof i.gamer_token == "string";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function O(i) {
|
|
8
|
+
return w(i);
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
function
|
|
10
|
+
const R = ue("GamerApiSDK");
|
|
11
|
+
function ye(i) {
|
|
12
12
|
return /^\/[a-z\d-]+$/.test(i);
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
const { promise: i, resolve: t } =
|
|
14
|
+
async function fe() {
|
|
15
|
+
const { promise: i, resolve: t } = de();
|
|
16
16
|
return wx.login({
|
|
17
17
|
success(n) {
|
|
18
18
|
t(n.code);
|
|
@@ -22,7 +22,7 @@ async function we() {
|
|
|
22
22
|
}
|
|
23
23
|
}), await i;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const he = {
|
|
26
26
|
get(i) {
|
|
27
27
|
return localStorage.getItem(i) || "";
|
|
28
28
|
},
|
|
@@ -32,31 +32,31 @@ const ke = {
|
|
|
32
32
|
remove(i) {
|
|
33
33
|
localStorage.removeItem(i);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, we = {
|
|
36
36
|
get(i) {
|
|
37
37
|
try {
|
|
38
|
-
if (
|
|
38
|
+
if (b()) return wx.getStorageSync(i) || "";
|
|
39
39
|
} catch (t) {
|
|
40
|
-
|
|
40
|
+
R.error("getStorageSyncError", t);
|
|
41
41
|
}
|
|
42
42
|
return "";
|
|
43
43
|
},
|
|
44
44
|
set(i, t) {
|
|
45
45
|
try {
|
|
46
|
-
|
|
46
|
+
b() && wx.setStorageSync(i, t);
|
|
47
47
|
} catch (n) {
|
|
48
|
-
|
|
48
|
+
R.error("setStorageSyncError", n);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
remove(i) {
|
|
52
52
|
try {
|
|
53
|
-
|
|
53
|
+
b() && wx.removeStorageSync(i);
|
|
54
54
|
} catch (t) {
|
|
55
|
-
|
|
55
|
+
R.error("removeStorageSync", t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
},
|
|
59
|
-
class
|
|
58
|
+
}, y = "gamer_token";
|
|
59
|
+
class $r {
|
|
60
60
|
$NetRequest;
|
|
61
61
|
$idToken = "";
|
|
62
62
|
$weixinToken = "";
|
|
@@ -64,8 +64,8 @@ class Er {
|
|
|
64
64
|
req;
|
|
65
65
|
storage;
|
|
66
66
|
constructor(t, n) {
|
|
67
|
-
this.storage =
|
|
68
|
-
const r =
|
|
67
|
+
this.storage = b() ? we : he;
|
|
68
|
+
const r = ye(t) ? t : `https://${ge(t)}`;
|
|
69
69
|
if (this.$NetRequest = n, this.req = n({
|
|
70
70
|
baseURL: `${r}/v1`,
|
|
71
71
|
timeout: 1e4,
|
|
@@ -86,9 +86,9 @@ class Er {
|
|
|
86
86
|
requestTransformer: (a) => {
|
|
87
87
|
this.$gamerToken && (a.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
88
88
|
}
|
|
89
|
-
}),
|
|
90
|
-
const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o =
|
|
91
|
-
(
|
|
89
|
+
}), pe()) {
|
|
90
|
+
const a = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o = S("gamer_token");
|
|
91
|
+
(me() || a && o) && (this.$gamerToken = o);
|
|
92
92
|
}
|
|
93
93
|
this.$gamerToken || this.loadGamerTokenCache();
|
|
94
94
|
}
|
|
@@ -96,7 +96,7 @@ class Er {
|
|
|
96
96
|
return this.$NetRequest;
|
|
97
97
|
}
|
|
98
98
|
loadGamerTokenCache() {
|
|
99
|
-
const n = this.storage.get(
|
|
99
|
+
const n = this.storage.get(y).match(/^(\d{12,})#(.{8,})$/);
|
|
100
100
|
if (n) {
|
|
101
101
|
const r = parseInt(n[1]), a = n[2];
|
|
102
102
|
if (r > Date.now() - (24 * 3600 - 10) * 1e3) {
|
|
@@ -104,7 +104,7 @@ class Er {
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
this.storage.remove(
|
|
107
|
+
this.storage.remove(y);
|
|
108
108
|
}
|
|
109
109
|
/** 当前是否为登录状态,即是否拥有 gamerToken */
|
|
110
110
|
get isLoggedIn() {
|
|
@@ -138,7 +138,7 @@ class Er {
|
|
|
138
138
|
* 直接写入 Gamer Token,并更新缓存
|
|
139
139
|
*/
|
|
140
140
|
set gamerToken(t) {
|
|
141
|
-
this.$gamerToken = t, t ? this.storage.set(
|
|
141
|
+
this.$gamerToken = t, t ? this.storage.set(y, `${Date.now()}#${t}`) : this.storage.remove(y);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 退出登录,销毁相关 Token
|
|
@@ -165,13 +165,13 @@ class Er {
|
|
|
165
165
|
async autoLogin() {
|
|
166
166
|
if (this.gamerToken)
|
|
167
167
|
return !0;
|
|
168
|
-
const t =
|
|
168
|
+
const t = b();
|
|
169
169
|
if (!this.idToken || t && !this.weixinToken)
|
|
170
170
|
return !1;
|
|
171
171
|
const { code: n, data: r } = await this.req.post(
|
|
172
172
|
"login-with-token",
|
|
173
173
|
c({ id_token: this.idToken, weixin_token: t ? this.weixinToken : null }),
|
|
174
|
-
|
|
174
|
+
be,
|
|
175
175
|
{
|
|
176
176
|
message: !1,
|
|
177
177
|
cacheTTL: 300,
|
|
@@ -197,7 +197,7 @@ class Er {
|
|
|
197
197
|
*/
|
|
198
198
|
async getSession() {
|
|
199
199
|
if (!await this.autoLogin()) return null;
|
|
200
|
-
const { data: t } = await this.req.get("session",
|
|
200
|
+
const { data: t } = await this.req.get("session", O, {
|
|
201
201
|
message: !1
|
|
202
202
|
});
|
|
203
203
|
return t;
|
|
@@ -209,25 +209,25 @@ class Er {
|
|
|
209
209
|
*/
|
|
210
210
|
async authRealName(t) {
|
|
211
211
|
if (!await this.autoLogin()) return null;
|
|
212
|
-
const { data: n } = await this.req.post("auth-real-name", c(t),
|
|
212
|
+
const { data: n } = await this.req.post("auth-real-name", c(t), O);
|
|
213
213
|
return n;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const ke = {
|
|
217
217
|
/** 未知 */
|
|
218
218
|
Unknown: "unknown",
|
|
219
219
|
/** 男 */
|
|
220
220
|
Male: "male",
|
|
221
221
|
/** 女 */
|
|
222
222
|
Female: "female"
|
|
223
|
-
},
|
|
223
|
+
}, ve = e.string().enum(ke).lock(), Ce = {
|
|
224
224
|
/** 积分增加 */
|
|
225
225
|
Increase: "increase",
|
|
226
226
|
/** 积分减少 */
|
|
227
227
|
Decrease: "decrease",
|
|
228
228
|
/** 积分过期 */
|
|
229
229
|
Expired: "expired"
|
|
230
|
-
},
|
|
230
|
+
}, Ve = e.string().enum(Ce).lock(), Re = {
|
|
231
231
|
/** 游戏内购买 */
|
|
232
232
|
Order: "order",
|
|
233
233
|
/** 游戏内消耗 */
|
|
@@ -240,21 +240,21 @@ const Ce = {
|
|
|
240
240
|
Admin: "admin",
|
|
241
241
|
/** 运营活动 */
|
|
242
242
|
Event: "event"
|
|
243
|
-
},
|
|
243
|
+
}, je = e.string().enum(Re).lock(), Te = {
|
|
244
244
|
/** 游戏内奖励 */
|
|
245
245
|
GameReward: "game_reward",
|
|
246
246
|
/** 实物商品 */
|
|
247
247
|
Physical: "physical",
|
|
248
248
|
/** 虚拟商品 */
|
|
249
249
|
Virtual: "virtual"
|
|
250
|
-
},
|
|
250
|
+
}, H = e.string().enum(Te).lock(), qe = {
|
|
251
251
|
/** 待发放 */
|
|
252
252
|
Pending: "pending",
|
|
253
253
|
/** 已发放 */
|
|
254
254
|
Issued: "issued",
|
|
255
255
|
/** 发放失败 */
|
|
256
256
|
Failed: "failed"
|
|
257
|
-
},
|
|
257
|
+
}, xe = e.string().enum(qe).lock(), Se = e.object({
|
|
258
258
|
default_avatar_url: e.string(),
|
|
259
259
|
official_avatar_urls: e.array(e.string()),
|
|
260
260
|
default_nickname: e.string(),
|
|
@@ -272,7 +272,7 @@ const Ce = {
|
|
|
272
272
|
exp_description: e.string(),
|
|
273
273
|
credit_description: e.string(),
|
|
274
274
|
send_role_mail_rate_limit: e.number()
|
|
275
|
-
}).lock(),
|
|
275
|
+
}).lock(), Le = e.object({
|
|
276
276
|
member_id: e.string(),
|
|
277
277
|
player_id: e.string(),
|
|
278
278
|
exp: e.number(),
|
|
@@ -281,19 +281,19 @@ const Ce = {
|
|
|
281
281
|
credit_expiring: e.number(),
|
|
282
282
|
level_change_time: e.number(),
|
|
283
283
|
level_expire_time: e.number()
|
|
284
|
-
}).lock(),
|
|
284
|
+
}).lock(), Pe = e.object({
|
|
285
285
|
server_id: e.string(),
|
|
286
286
|
server_name: e.string()
|
|
287
|
-
}).lock(),
|
|
287
|
+
}).lock(), $e = e.object({
|
|
288
288
|
role_id: e.string(),
|
|
289
289
|
role_name: e.string()
|
|
290
|
-
}).lock(),
|
|
291
|
-
...Ue.shape,
|
|
290
|
+
}).lock(), z = e.object({
|
|
292
291
|
...$e.shape,
|
|
292
|
+
...Pe.shape,
|
|
293
293
|
role_level: e.number(),
|
|
294
294
|
last_login_time: e.number()
|
|
295
|
-
}).lock(),
|
|
296
|
-
...
|
|
295
|
+
}).lock(), Ee = e.object({
|
|
296
|
+
...z.shape,
|
|
297
297
|
/** 角色战力 */
|
|
298
298
|
role_fighting: e.number(),
|
|
299
299
|
/** 宗门 ID */
|
|
@@ -302,13 +302,13 @@ const Ce = {
|
|
|
302
302
|
kin_name: e.string().optional(),
|
|
303
303
|
/** 宗门职位 */
|
|
304
304
|
kin_position: e.string().optional()
|
|
305
|
-
}).lock(),
|
|
305
|
+
}).lock(), Fe = e.object({
|
|
306
306
|
name: e.string(),
|
|
307
307
|
avatar_url: e.string(),
|
|
308
308
|
bio: e.string(),
|
|
309
|
-
gender:
|
|
309
|
+
gender: ve,
|
|
310
310
|
birthday: e.object({ year: e.number(), month: e.number(), day: e.number() })
|
|
311
|
-
}).lock(),
|
|
311
|
+
}).lock(), J = e.object({
|
|
312
312
|
address_id: e.number(),
|
|
313
313
|
recipient: e.string(),
|
|
314
314
|
mobile: e.string(),
|
|
@@ -317,19 +317,19 @@ const Ce = {
|
|
|
317
317
|
district: e.string(),
|
|
318
318
|
address: e.string(),
|
|
319
319
|
is_default: e.bool()
|
|
320
|
-
}).lock(),
|
|
320
|
+
}).lock(), Ue = e.object({
|
|
321
321
|
increased_credit: e.number(),
|
|
322
322
|
decreased_credit: e.number(),
|
|
323
323
|
expired_credit: e.number(),
|
|
324
324
|
balance_credit: e.number()
|
|
325
|
-
}).lock(),
|
|
325
|
+
}).lock(), Ie = e.object({
|
|
326
326
|
id: e.number(),
|
|
327
|
-
change_type:
|
|
328
|
-
change_scene:
|
|
327
|
+
change_type: Ve,
|
|
328
|
+
change_scene: je,
|
|
329
329
|
change_credit: e.number(),
|
|
330
330
|
balance: e.number(),
|
|
331
331
|
change_time: e.number()
|
|
332
|
-
}).lock(),
|
|
332
|
+
}).lock(), Z = e.object({
|
|
333
333
|
benefit_id: e.number(),
|
|
334
334
|
name: e.string(),
|
|
335
335
|
img_url: e.string(),
|
|
@@ -338,11 +338,11 @@ const Ce = {
|
|
|
338
338
|
max_level: e.number(),
|
|
339
339
|
product_id: e.number(),
|
|
340
340
|
tag: e.string()
|
|
341
|
-
}).lock(),
|
|
341
|
+
}).lock(), X = e.object({
|
|
342
342
|
product_id: e.number(),
|
|
343
343
|
catalog_id: e.number(),
|
|
344
344
|
catalog_name: e.string(),
|
|
345
|
-
item_type:
|
|
345
|
+
item_type: H,
|
|
346
346
|
name: e.string(),
|
|
347
347
|
img_url: e.string(),
|
|
348
348
|
description: e.string(),
|
|
@@ -364,10 +364,10 @@ const Ce = {
|
|
|
364
364
|
created_at: e.number(),
|
|
365
365
|
updated_at: e.number(),
|
|
366
366
|
redeemable_quantity: e.number().optional()
|
|
367
|
-
}).lock(),
|
|
368
|
-
...
|
|
369
|
-
product:
|
|
370
|
-
}).lock(),
|
|
367
|
+
}).lock(), De = e.object({
|
|
368
|
+
...k(Z.shape, "tag"),
|
|
369
|
+
product: X.clone().optional()
|
|
370
|
+
}).lock(), Er = e.union(
|
|
371
371
|
e.object({
|
|
372
372
|
server_id: e.string(),
|
|
373
373
|
role_id: e.string()
|
|
@@ -375,7 +375,7 @@ const Ce = {
|
|
|
375
375
|
e.object({
|
|
376
376
|
address_id: e.number()
|
|
377
377
|
})
|
|
378
|
-
).satisfies().lock(),
|
|
378
|
+
).satisfies().lock(), Ae = e.object({
|
|
379
379
|
recipient: e.string(),
|
|
380
380
|
mobile: e.string(),
|
|
381
381
|
province: e.string(),
|
|
@@ -384,32 +384,32 @@ const Ce = {
|
|
|
384
384
|
address: e.string(),
|
|
385
385
|
express_company: e.string(),
|
|
386
386
|
express_number: e.string()
|
|
387
|
-
}).lock(),
|
|
387
|
+
}).lock(), Ge = e.object({
|
|
388
388
|
server_id: e.string(),
|
|
389
389
|
role_id: e.string(),
|
|
390
390
|
role_name: e.string()
|
|
391
|
-
}).lock(),
|
|
391
|
+
}).lock(), Oe = e.object({
|
|
392
392
|
redemption_id: e.number(),
|
|
393
393
|
player_id: e.string(),
|
|
394
394
|
product_id: e.number(),
|
|
395
395
|
name: e.string(),
|
|
396
396
|
img_url: e.string(),
|
|
397
|
-
item_type:
|
|
397
|
+
item_type: H,
|
|
398
398
|
catalog_id: e.number(),
|
|
399
399
|
catalog_name: e.string(),
|
|
400
400
|
quantity: e.number(),
|
|
401
401
|
amount: e.number(),
|
|
402
|
-
status:
|
|
402
|
+
status: xe,
|
|
403
403
|
created_at: e.number(),
|
|
404
|
-
extra_data: e.union(
|
|
405
|
-
}),
|
|
406
|
-
credit_logs: e.array(
|
|
404
|
+
extra_data: e.union(Ae.clone(), Ge.clone()).satisfies().optional()
|
|
405
|
+
}), Ne = e.guard(Se), N = s({ player: Le }), Qe = s({ roles: e.array(z) }), j = s({ role_card: Ee }), Q = e.guard(Fe), B = e.guard(J), Be = s({ addresses: e.array(J) }), Me = e.guard(Ue), Ke = s({
|
|
406
|
+
credit_logs: e.array(Ie),
|
|
407
407
|
next_token: e.string().optional()
|
|
408
|
-
}),
|
|
409
|
-
redemptions: e.array(
|
|
408
|
+
}), He = s({ products: e.array(X) }), ze = s({ benefits: e.array(Z) }), Je = s({ benefit: De }), Ze = s({
|
|
409
|
+
redemptions: e.array(Oe),
|
|
410
410
|
next_token: e.string().optional()
|
|
411
411
|
});
|
|
412
|
-
class
|
|
412
|
+
class Fr {
|
|
413
413
|
token;
|
|
414
414
|
req;
|
|
415
415
|
constructor(t) {
|
|
@@ -421,7 +421,7 @@ class Ur {
|
|
|
421
421
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
|
|
422
422
|
*/
|
|
423
423
|
async getConfig(t) {
|
|
424
|
-
const { data: n } = await this.req.get("club/config",
|
|
424
|
+
const { data: n } = await this.req.get("club/config", Ne, t);
|
|
425
425
|
return n;
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
@@ -431,7 +431,7 @@ class Ur {
|
|
|
431
431
|
*/
|
|
432
432
|
async getCurrentPlayer(t) {
|
|
433
433
|
await this.token.autoLogin();
|
|
434
|
-
const { data: n, code: r, message: a } = await this.req.get("club/current-player",
|
|
434
|
+
const { data: n, code: r, message: a } = await this.req.get("club/current-player", N, t);
|
|
435
435
|
return n?.player ?? {
|
|
436
436
|
message: a,
|
|
437
437
|
error: r
|
|
@@ -447,7 +447,7 @@ class Ur {
|
|
|
447
447
|
const { data: n, code: r, message: a } = await this.req.post(
|
|
448
448
|
"club/link-player",
|
|
449
449
|
{ id_token: this.token.idToken },
|
|
450
|
-
|
|
450
|
+
N,
|
|
451
451
|
t
|
|
452
452
|
);
|
|
453
453
|
return n?.player ?? {
|
|
@@ -462,7 +462,7 @@ class Ur {
|
|
|
462
462
|
*/
|
|
463
463
|
async getRoles(t, n, r) {
|
|
464
464
|
if (!await this.token.autoLogin()) return [];
|
|
465
|
-
const { data: a } = await this.req.get("club/roles",
|
|
465
|
+
const { data: a } = await this.req.get("club/roles", Qe, {
|
|
466
466
|
...r,
|
|
467
467
|
params: c({ player_id: t, refresh: n })
|
|
468
468
|
});
|
|
@@ -474,7 +474,7 @@ class Ur {
|
|
|
474
474
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=A1Wr7kUXnS
|
|
475
475
|
*/
|
|
476
476
|
async getRoleCard(t, n) {
|
|
477
|
-
const { data: r } = await this.req.get("club/role-card",
|
|
477
|
+
const { data: r } = await this.req.get("club/role-card", j, {
|
|
478
478
|
...n,
|
|
479
479
|
params: { member_id: t }
|
|
480
480
|
});
|
|
@@ -487,7 +487,7 @@ class Ur {
|
|
|
487
487
|
*/
|
|
488
488
|
async setRoleCard(t, n) {
|
|
489
489
|
if (!await this.token.autoLogin()) return null;
|
|
490
|
-
const { data: r } = await this.req.post("club/role-card", t,
|
|
490
|
+
const { data: r } = await this.req.post("club/role-card", t, j, n);
|
|
491
491
|
return r?.role_card ?? null;
|
|
492
492
|
}
|
|
493
493
|
/**
|
|
@@ -497,7 +497,7 @@ class Ur {
|
|
|
497
497
|
*/
|
|
498
498
|
async refreshRoleCard(t) {
|
|
499
499
|
if (!await this.token.autoLogin()) return null;
|
|
500
|
-
const { data: n } = await this.req.post("club/refresh-role-card", {},
|
|
500
|
+
const { data: n } = await this.req.post("club/refresh-role-card", {}, j, t);
|
|
501
501
|
return n?.role_card ?? null;
|
|
502
502
|
}
|
|
503
503
|
/**
|
|
@@ -506,7 +506,7 @@ class Ur {
|
|
|
506
506
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
|
|
507
507
|
*/
|
|
508
508
|
async getUserProfile(t, n) {
|
|
509
|
-
const { data: r } = await this.req.get("club/user-profile",
|
|
509
|
+
const { data: r } = await this.req.get("club/user-profile", Q, {
|
|
510
510
|
...n,
|
|
511
511
|
params: { member_id: t }
|
|
512
512
|
});
|
|
@@ -521,7 +521,7 @@ class Ur {
|
|
|
521
521
|
if (Object.keys(t).length === 0)
|
|
522
522
|
return { error: "OptionIsEmpty", message: "请提供需要修改的信息" };
|
|
523
523
|
await this.token.autoLogin();
|
|
524
|
-
const { data: r, code: a, message: o } = await this.req.post("club/user-profile", t,
|
|
524
|
+
const { data: r, code: a, message: o } = await this.req.post("club/user-profile", t, Q, n);
|
|
525
525
|
return r ?? {
|
|
526
526
|
message: o,
|
|
527
527
|
error: a
|
|
@@ -534,7 +534,7 @@ class Ur {
|
|
|
534
534
|
*/
|
|
535
535
|
async getAddresses(t) {
|
|
536
536
|
if (!await this.token.autoLogin()) return [];
|
|
537
|
-
const { data: n } = await this.req.get("club/addresses",
|
|
537
|
+
const { data: n } = await this.req.get("club/addresses", Be, t);
|
|
538
538
|
return n?.addresses ?? [];
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
@@ -544,7 +544,7 @@ class Ur {
|
|
|
544
544
|
*/
|
|
545
545
|
async addAddress(t, n) {
|
|
546
546
|
if (!await this.token.autoLogin()) return null;
|
|
547
|
-
const { data: r } = await this.req.post("/club/add-address", c(t),
|
|
547
|
+
const { data: r } = await this.req.post("/club/add-address", c(t), B, n);
|
|
548
548
|
return r;
|
|
549
549
|
}
|
|
550
550
|
/**
|
|
@@ -557,7 +557,7 @@ class Ur {
|
|
|
557
557
|
const { data: r, code: a, message: o } = await this.req.post(
|
|
558
558
|
"club/update-address",
|
|
559
559
|
c(t),
|
|
560
|
-
|
|
560
|
+
B,
|
|
561
561
|
n
|
|
562
562
|
);
|
|
563
563
|
return r ?? {
|
|
@@ -582,7 +582,7 @@ class Ur {
|
|
|
582
582
|
*/
|
|
583
583
|
async getUserCredit(t, n) {
|
|
584
584
|
await this.token.autoLogin();
|
|
585
|
-
const { data: r, code: a, message: o } = await this.req.get("club/user-credit",
|
|
585
|
+
const { data: r, code: a, message: o } = await this.req.get("club/user-credit", Me, {
|
|
586
586
|
...n,
|
|
587
587
|
params: c(t)
|
|
588
588
|
});
|
|
@@ -598,7 +598,7 @@ class Ur {
|
|
|
598
598
|
*/
|
|
599
599
|
async getCreditLogs(t, n) {
|
|
600
600
|
await this.token.autoLogin();
|
|
601
|
-
const { data: r } = await this.req.get("club/credit-logs",
|
|
601
|
+
const { data: r } = await this.req.get("club/credit-logs", Ke, {
|
|
602
602
|
...n,
|
|
603
603
|
params: c({ max_results: 20, ...t })
|
|
604
604
|
});
|
|
@@ -614,7 +614,7 @@ class Ur {
|
|
|
614
614
|
*/
|
|
615
615
|
async getBenefits(t) {
|
|
616
616
|
if (!await this.token.autoLogin()) return [];
|
|
617
|
-
const { data: n } = await this.req.get("club/benefits",
|
|
617
|
+
const { data: n } = await this.req.get("club/benefits", ze, t);
|
|
618
618
|
return n?.benefits || [];
|
|
619
619
|
}
|
|
620
620
|
/**
|
|
@@ -624,7 +624,7 @@ class Ur {
|
|
|
624
624
|
*/
|
|
625
625
|
async getBenefit(t, n) {
|
|
626
626
|
if (!await this.token.autoLogin()) return null;
|
|
627
|
-
const { data: r } = await this.req.get("club/benefit",
|
|
627
|
+
const { data: r } = await this.req.get("club/benefit", Je, {
|
|
628
628
|
...n,
|
|
629
629
|
params: { benefit_id: t }
|
|
630
630
|
});
|
|
@@ -636,7 +636,7 @@ class Ur {
|
|
|
636
636
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
|
|
637
637
|
*/
|
|
638
638
|
async getProducts(t, n) {
|
|
639
|
-
const { data: r } = await this.req.get("club/products",
|
|
639
|
+
const { data: r } = await this.req.get("club/products", He, {
|
|
640
640
|
...n,
|
|
641
641
|
params: t
|
|
642
642
|
});
|
|
@@ -662,7 +662,7 @@ class Ur {
|
|
|
662
662
|
*/
|
|
663
663
|
async getRedemptions(t, n) {
|
|
664
664
|
await this.token.autoLogin();
|
|
665
|
-
const { data: r } = await this.req.get("club/redemptions",
|
|
665
|
+
const { data: r } = await this.req.get("club/redemptions", Ze, {
|
|
666
666
|
...n,
|
|
667
667
|
params: c({ max_results: 20, ...t })
|
|
668
668
|
});
|
|
@@ -672,7 +672,7 @@ class Ur {
|
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const v = {
|
|
676
676
|
/** 活动道具 */
|
|
677
677
|
EventItem: "event_item",
|
|
678
678
|
/** 游戏内道具 */
|
|
@@ -693,17 +693,17 @@ const V = {
|
|
|
693
693
|
ExternalCode: "external_gift_code",
|
|
694
694
|
/** 空奖励 */
|
|
695
695
|
VoidItem: "void_item"
|
|
696
|
-
},
|
|
696
|
+
}, Y = e.string().enum(v).lock(), Ur = v, W = Y, Xe = {
|
|
697
697
|
/** 世游通行证 ID / Combo ID */
|
|
698
698
|
UserId: "user_id",
|
|
699
699
|
/** 游戏角色 ID */
|
|
700
700
|
RoleId: "role_id"
|
|
701
|
-
},
|
|
701
|
+
}, Ye = e.string().enum(Xe).lock(), We = {
|
|
702
702
|
None: "none",
|
|
703
703
|
Daily: "daily",
|
|
704
704
|
Weekly: "weekly",
|
|
705
705
|
Monthly: "monthly"
|
|
706
|
-
},
|
|
706
|
+
}, et = e.string().enum(We).lock(), l = {
|
|
707
707
|
/** 预约 */
|
|
708
708
|
Preregister: "preregister",
|
|
709
709
|
/** 抽奖 */
|
|
@@ -744,7 +744,7 @@ const V = {
|
|
|
744
744
|
ClaimActivationKey: "claim_activation_key",
|
|
745
745
|
/** 不朽箴言特有的 AI 聊天 */
|
|
746
746
|
ZeroChatgpt: "zero_chatgpt"
|
|
747
|
-
},
|
|
747
|
+
}, tt = e.string().enum(l).lock(), nt = {
|
|
748
748
|
/** 累计游戏内活跃值 */
|
|
749
749
|
Active: "player_active_points",
|
|
750
750
|
/** 累计登录,单位 人天 */
|
|
@@ -763,14 +763,14 @@ const V = {
|
|
|
763
763
|
PlayerLevel: "player_level",
|
|
764
764
|
/** 活动道具累计获取 */
|
|
765
765
|
EventItems: "event_items"
|
|
766
|
-
},
|
|
766
|
+
}, ee = e.string().enum(nt).lock(), rt = {
|
|
767
767
|
/** 官方上传 */
|
|
768
768
|
System: "system",
|
|
769
769
|
/** 用户投稿 */
|
|
770
770
|
UserSubmission: "user_submission",
|
|
771
771
|
/** 投票入围 */
|
|
772
772
|
Shortlisted: "shortlisted"
|
|
773
|
-
},
|
|
773
|
+
}, at = e.string().enum(rt).lock(), d = {
|
|
774
774
|
/** 未获得奖励 */
|
|
775
775
|
Ineligible: "ineligible",
|
|
776
776
|
/** 奖励未领取 */
|
|
@@ -781,49 +781,37 @@ const V = {
|
|
|
781
781
|
Failed: "failed",
|
|
782
782
|
/** 奖励已发货 */
|
|
783
783
|
Delivered: "delivered"
|
|
784
|
-
}, Ir = e.string().enum(
|
|
785
|
-
/**
|
|
786
|
-
* 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
|
|
787
|
-
*
|
|
788
|
-
* @deprecated
|
|
789
|
-
*/
|
|
790
|
-
UnclaimedErr: "unaccalimed",
|
|
784
|
+
}, Ir = e.string().enum(d).lock(), ot = {
|
|
791
785
|
/** 奖励未领取 */
|
|
792
|
-
Unclaimed:
|
|
786
|
+
Unclaimed: d.Unclaimed,
|
|
793
787
|
/** 奖励已领取 */
|
|
794
|
-
Received:
|
|
788
|
+
Received: d.Received,
|
|
795
789
|
/** 奖励发放失败 */
|
|
796
|
-
Failed:
|
|
790
|
+
Failed: d.Failed,
|
|
797
791
|
/** 奖励已发货 */
|
|
798
|
-
Delivered:
|
|
799
|
-
},
|
|
792
|
+
Delivered: d.Delivered
|
|
793
|
+
}, te = e.string().enum(ot).lock(), it = {
|
|
800
794
|
/** 未获得奖励 */
|
|
801
|
-
Ineligible:
|
|
802
|
-
/**
|
|
803
|
-
* 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
|
|
804
|
-
*
|
|
805
|
-
* @deprecated
|
|
806
|
-
*/
|
|
807
|
-
UnclaimedErr: "unaccalimed",
|
|
795
|
+
Ineligible: d.Ineligible,
|
|
808
796
|
/** 奖励未领取 */
|
|
809
|
-
Unclaimed:
|
|
797
|
+
Unclaimed: d.Unclaimed,
|
|
810
798
|
/** 奖励已领取 */
|
|
811
|
-
Received:
|
|
799
|
+
Received: d.Received,
|
|
812
800
|
/** 奖励发放失败 */
|
|
813
|
-
Failed:
|
|
801
|
+
Failed: d.Failed,
|
|
814
802
|
/** 奖励已发货 */
|
|
815
|
-
Delivered:
|
|
816
|
-
},
|
|
803
|
+
Delivered: d.Delivered
|
|
804
|
+
}, L = e.string().enum(it).lock(), st = {
|
|
817
805
|
/** 玩法产出奖励 */
|
|
818
806
|
Output: "output",
|
|
819
807
|
/** 玩法参与奖励 */
|
|
820
808
|
Engage: "engage"
|
|
821
|
-
},
|
|
809
|
+
}, P = e.string().enum(st).lock(), ct = {
|
|
822
810
|
/** 私有队伍 */
|
|
823
811
|
Private: "private",
|
|
824
812
|
/** 公开队伍 */
|
|
825
813
|
Public: "public"
|
|
826
|
-
},
|
|
814
|
+
}, lt = e.string().enum(ct).lock(), f = {
|
|
827
815
|
/** 未知状态 */
|
|
828
816
|
Unknown: "unknown",
|
|
829
817
|
/** 等待开奖 */
|
|
@@ -834,7 +822,7 @@ const V = {
|
|
|
834
822
|
Claimed: "claimed",
|
|
835
823
|
/** 领奖失败 */
|
|
836
824
|
Fail: "fail"
|
|
837
|
-
}, Dr = e.string().enum(
|
|
825
|
+
}, Dr = e.string().enum(f).lock(), mt = {
|
|
838
826
|
/** 发起组队 */
|
|
839
827
|
Assemble: "assemble",
|
|
840
828
|
/** 加入队伍 */
|
|
@@ -845,19 +833,19 @@ const V = {
|
|
|
845
833
|
ChangeVisibility: "change_visibility",
|
|
846
834
|
/** 查询组队信息 */
|
|
847
835
|
Query: "query"
|
|
848
|
-
}, Ar = e.string().enum(
|
|
836
|
+
}, Ar = e.string().enum(mt).lock(), ut = {
|
|
849
837
|
/** 查询抽奖券 */
|
|
850
838
|
Query: "query",
|
|
851
839
|
/** 开奖 */
|
|
852
840
|
Draw: "draw",
|
|
853
841
|
/** 领奖 */
|
|
854
842
|
Claim: "claim"
|
|
855
|
-
}, Gr = e.string().enum(
|
|
843
|
+
}, Gr = e.string().enum(ut).lock(), ne = {
|
|
856
844
|
/** 将所有队员的进度值求和,作为队伍进度值 */
|
|
857
845
|
Sum: "sum",
|
|
858
846
|
/** 以进度值倒序排名第 N 的队员的进度值,作为队伍进度值。如果队伍人数不足 N,则队伍进度值为 0。N 的值来自于配置字段 top_n */
|
|
859
847
|
TopN: "top_n"
|
|
860
|
-
}, Or = e.string().enum(
|
|
848
|
+
}, Or = e.string().enum(ne).lock(), dt = e.string().enum(ne).optional().lock(), gt = e.string().enum(k(v, "GiftCode", "LotteryTicket")), $ = e.object({
|
|
861
849
|
reward_item_id: e.number(),
|
|
862
850
|
reward_amount: e.number(),
|
|
863
851
|
reward_item_name: e.string(),
|
|
@@ -867,30 +855,30 @@ const V = {
|
|
|
867
855
|
reward_item_rating: e.number()
|
|
868
856
|
}).lock(), pt = e.object({
|
|
869
857
|
engage_count: e.number(),
|
|
870
|
-
rewards: e.array(
|
|
858
|
+
rewards: e.array($)
|
|
871
859
|
}).lock(), _t = e.union(
|
|
872
860
|
e.object({
|
|
873
861
|
feature_reward_type: e.string().enum("every"),
|
|
874
|
-
reward_details: e.array(
|
|
862
|
+
reward_details: e.array($)
|
|
875
863
|
}),
|
|
876
864
|
e.object({
|
|
877
865
|
feature_reward_type: e.string().enum("regular"),
|
|
878
866
|
reward_details: e.array(pt)
|
|
879
867
|
})
|
|
880
|
-
).satisfies().lock(),
|
|
868
|
+
).satisfies().lock(), m = e.object({
|
|
881
869
|
feature_name: e.string(),
|
|
882
870
|
feature_id: e.number(),
|
|
883
871
|
description: e.string(),
|
|
884
|
-
cycle:
|
|
872
|
+
cycle: et,
|
|
885
873
|
cycle_limit: e.number(),
|
|
886
874
|
limit: e.number(),
|
|
887
875
|
since: e.number(),
|
|
888
876
|
until: e.number(),
|
|
889
|
-
engage_account:
|
|
877
|
+
engage_account: Ye,
|
|
890
878
|
feature_rewards: _t.clone().optional(),
|
|
891
879
|
sort: e.number().optional()
|
|
892
|
-
}), bt =
|
|
893
|
-
...
|
|
880
|
+
}), bt = l.Cashback, yt = e.object({
|
|
881
|
+
...m.shape,
|
|
894
882
|
feature_type: e.string().enum(bt),
|
|
895
883
|
config: e.object({
|
|
896
884
|
order_start_time: e.number(),
|
|
@@ -898,24 +886,24 @@ const V = {
|
|
|
898
886
|
claim_rewards_start_time: e.number(),
|
|
899
887
|
claim_rewards_end_time: e.number()
|
|
900
888
|
})
|
|
901
|
-
}), ft =
|
|
902
|
-
...
|
|
889
|
+
}), ft = l.CheckIn, ht = e.object({
|
|
890
|
+
...m.shape,
|
|
903
891
|
feature_type: e.string().enum(ft)
|
|
904
|
-
}), wt =
|
|
905
|
-
...
|
|
892
|
+
}), wt = l.ClaimActivationKey, kt = e.object({
|
|
893
|
+
...m.shape,
|
|
906
894
|
feature_type: e.string().enum(wt)
|
|
907
|
-
}), vt =
|
|
908
|
-
...
|
|
895
|
+
}), vt = l.ClaimRewards, Ct = e.object({
|
|
896
|
+
...m.shape,
|
|
909
897
|
feature_type: e.string().enum(vt)
|
|
910
|
-
}), Vt =
|
|
911
|
-
...
|
|
898
|
+
}), Vt = l.Comment, Rt = e.object({
|
|
899
|
+
...m.shape,
|
|
912
900
|
feature_type: e.string().enum(Vt),
|
|
913
901
|
config: e.object({
|
|
914
902
|
comments: e.array(e.string()),
|
|
915
903
|
send_rate: e.number()
|
|
916
904
|
})
|
|
917
|
-
}), jt =
|
|
918
|
-
...
|
|
905
|
+
}), jt = l.Follow, Tt = e.object({
|
|
906
|
+
...m.shape,
|
|
919
907
|
feature_type: e.string().enum(jt),
|
|
920
908
|
config: e.object({
|
|
921
909
|
platform: e.string(),
|
|
@@ -924,61 +912,61 @@ const V = {
|
|
|
924
912
|
qr_code_url: e.string().optional(),
|
|
925
913
|
platform_desc: e.string().optional()
|
|
926
914
|
})
|
|
927
|
-
}), qt =
|
|
915
|
+
}), qt = l.GiftCode, xt = e.object({
|
|
928
916
|
name: e.string(),
|
|
929
917
|
icon_url: e.string(),
|
|
930
918
|
count: e.number()
|
|
931
919
|
}), St = e.object({
|
|
932
|
-
...
|
|
920
|
+
...m.shape,
|
|
933
921
|
feature_type: e.string().enum(qt),
|
|
934
922
|
config: e.object({
|
|
935
923
|
gift_items: e.array(xt),
|
|
936
924
|
mp_url: e.string().optional(),
|
|
937
925
|
mp_qrcode_url: e.string().optional()
|
|
938
926
|
})
|
|
939
|
-
}), Lt =
|
|
940
|
-
...
|
|
927
|
+
}), Lt = l.Invite, Pt = e.object({
|
|
928
|
+
...m.shape,
|
|
941
929
|
feature_type: e.string().enum(Lt),
|
|
942
930
|
config: e.object({
|
|
943
931
|
share_url: e.string()
|
|
944
932
|
})
|
|
945
|
-
}),
|
|
946
|
-
...
|
|
947
|
-
feature_type: e.string().enum(
|
|
948
|
-
}),
|
|
933
|
+
}), $t = l.InvitedRegister, Et = e.object({
|
|
934
|
+
...m.shape,
|
|
935
|
+
feature_type: e.string().enum($t)
|
|
936
|
+
}), Ft = e.string().enum(k(v, "GiftCode", "LotteryTicket")), Ut = l.Lottery, It = e.object({
|
|
949
937
|
reward_item_id: e.number(),
|
|
950
938
|
reward_item_name: e.string(),
|
|
951
|
-
reward_item_type:
|
|
939
|
+
reward_item_type: Ft,
|
|
952
940
|
reward_item_icon_url: e.string(),
|
|
953
941
|
reward_item_desc: e.string().optional(),
|
|
954
942
|
reward_amount: e.number(),
|
|
955
943
|
reward_remaining_stock: e.number()
|
|
956
944
|
}), Dt = e.object({
|
|
957
|
-
...
|
|
958
|
-
feature_type: e.string().enum(
|
|
945
|
+
...m.shape,
|
|
946
|
+
feature_type: e.string().enum(Ut),
|
|
959
947
|
config: e.object({
|
|
960
948
|
consume_item_id: e.number(),
|
|
961
949
|
consume_item_name: e.string(),
|
|
962
950
|
consume_item_icon_url: e.string(),
|
|
963
|
-
consume_item_count: e.number(),
|
|
951
|
+
consume_item_count: e.array(e.number()),
|
|
964
952
|
consume_item_desc: e.string().optional(),
|
|
965
953
|
rewards: e.array(It)
|
|
966
954
|
})
|
|
967
|
-
}), At =
|
|
968
|
-
...
|
|
955
|
+
}), At = l.LotteryDraw, Gt = e.object({
|
|
956
|
+
...m.shape,
|
|
969
957
|
feature_type: e.string().enum(At),
|
|
970
958
|
config: e.object({
|
|
971
959
|
draw_not_before: e.number(),
|
|
972
960
|
draw_not_after: e.number()
|
|
973
961
|
})
|
|
974
|
-
}), Ot =
|
|
975
|
-
...
|
|
962
|
+
}), Ot = l.Preregister, Nt = e.object({
|
|
963
|
+
...m.shape,
|
|
976
964
|
feature_type: e.string().enum(Ot)
|
|
977
|
-
}), Qt =
|
|
978
|
-
...
|
|
965
|
+
}), Qt = l.Quest, Bt = e.object({
|
|
966
|
+
...m.shape,
|
|
979
967
|
feature_type: e.string().enum(Qt),
|
|
980
968
|
config: e.object({
|
|
981
|
-
objective:
|
|
969
|
+
objective: ee,
|
|
982
970
|
completion_value: e.number(),
|
|
983
971
|
team: e.object({
|
|
984
972
|
feature_id: e.number().optional(),
|
|
@@ -993,38 +981,38 @@ const V = {
|
|
|
993
981
|
event_item_id: e.number().optional()
|
|
994
982
|
}).optional()
|
|
995
983
|
})
|
|
996
|
-
}), Mt =
|
|
997
|
-
...
|
|
984
|
+
}), Mt = l.Register, Kt = e.object({
|
|
985
|
+
...m.shape,
|
|
998
986
|
feature_type: e.string().enum(Mt)
|
|
999
|
-
}), Ht =
|
|
1000
|
-
...
|
|
987
|
+
}), Ht = l.Share, zt = e.object({
|
|
988
|
+
...m.shape,
|
|
1001
989
|
feature_type: e.string().enum(Ht),
|
|
1002
990
|
config: e.object({
|
|
1003
991
|
share_platform: e.string(),
|
|
1004
992
|
jump_url: e.string().optional(),
|
|
1005
993
|
icon_url: e.string().optional()
|
|
1006
994
|
})
|
|
1007
|
-
}), Jt =
|
|
1008
|
-
...
|
|
995
|
+
}), Jt = l.Subscribe, Zt = e.object({
|
|
996
|
+
...m.shape,
|
|
1009
997
|
feature_type: e.string().enum(Jt),
|
|
1010
998
|
config: e.object({
|
|
1011
999
|
weixin_template_ids: e.array(e.string())
|
|
1012
1000
|
})
|
|
1013
|
-
}), Xt =
|
|
1014
|
-
...
|
|
1001
|
+
}), Xt = l.Survey, Yt = e.object({
|
|
1002
|
+
...m.shape,
|
|
1015
1003
|
feature_type: e.string().enum(Xt),
|
|
1016
1004
|
config: e.object({
|
|
1017
1005
|
survey_id: e.string(),
|
|
1018
1006
|
survey_url: e.string()
|
|
1019
1007
|
})
|
|
1020
|
-
}), Wt =
|
|
1021
|
-
...
|
|
1008
|
+
}), Wt = l.Team, en = e.object({
|
|
1009
|
+
...m.shape,
|
|
1022
1010
|
feature_type: e.string().enum(Wt),
|
|
1023
1011
|
config: e.object({
|
|
1024
1012
|
max_members: e.number().min(1),
|
|
1025
1013
|
min_members: e.number().min(1)
|
|
1026
1014
|
})
|
|
1027
|
-
}), tn =
|
|
1015
|
+
}), tn = l.Vote, nn = e.object({
|
|
1028
1016
|
sn: e.string(),
|
|
1029
1017
|
name: e.string(),
|
|
1030
1018
|
img_urls: e.array(e.string()).optional(),
|
|
@@ -1035,18 +1023,18 @@ const V = {
|
|
|
1035
1023
|
finalists: e.bool(),
|
|
1036
1024
|
last_vote_time: e.number()
|
|
1037
1025
|
}), rn = e.object({
|
|
1038
|
-
...
|
|
1026
|
+
...m.shape,
|
|
1039
1027
|
feature_type: e.string().enum(tn),
|
|
1040
1028
|
config: e.object({
|
|
1041
1029
|
vote_feature_ids: e.array(e.number()),
|
|
1042
1030
|
submission_feature_ids: e.array(e.number()),
|
|
1043
1031
|
finalists_amount: e.number(),
|
|
1044
|
-
source:
|
|
1032
|
+
source: at,
|
|
1045
1033
|
options: e.array(nn),
|
|
1046
|
-
rewards: e.array(
|
|
1034
|
+
rewards: e.array($)
|
|
1047
1035
|
})
|
|
1048
|
-
}), an =
|
|
1049
|
-
...
|
|
1036
|
+
}), an = l.ZeroChatgpt, on = e.object({
|
|
1037
|
+
...m.shape,
|
|
1050
1038
|
feature_type: e.string().enum(an)
|
|
1051
1039
|
}), sn = e.union(
|
|
1052
1040
|
yt,
|
|
@@ -1056,7 +1044,7 @@ const V = {
|
|
|
1056
1044
|
Tt,
|
|
1057
1045
|
St,
|
|
1058
1046
|
Pt,
|
|
1059
|
-
|
|
1047
|
+
Et,
|
|
1060
1048
|
Dt,
|
|
1061
1049
|
Gt,
|
|
1062
1050
|
Nt,
|
|
@@ -1076,13 +1064,13 @@ const V = {
|
|
|
1076
1064
|
until: e.number(),
|
|
1077
1065
|
visit_count: e.number().optional(),
|
|
1078
1066
|
features: e.array(sn)
|
|
1079
|
-
}).lock(),
|
|
1080
|
-
order_total_amount:
|
|
1081
|
-
cashback_total_amount:
|
|
1082
|
-
game_item_count:
|
|
1083
|
-
}), ln = e.object({
|
|
1084
|
-
activation_key: e.string().disallow("")
|
|
1067
|
+
}).lock(), T = e.union(e.string().pattern("NumberString", /^\d+$/), e.number()), ln = e.object({
|
|
1068
|
+
order_total_amount: T,
|
|
1069
|
+
cashback_total_amount: T,
|
|
1070
|
+
game_item_count: T
|
|
1085
1071
|
}), mn = e.object({
|
|
1072
|
+
activation_key: e.string().disallow("")
|
|
1073
|
+
}), un = e.object({
|
|
1086
1074
|
gift_code: e.string()
|
|
1087
1075
|
}), dn = e.object({
|
|
1088
1076
|
user_id: e.string(),
|
|
@@ -1090,57 +1078,57 @@ const V = {
|
|
|
1090
1078
|
avatar_url: e.string().optional()
|
|
1091
1079
|
}), gn = e.object({
|
|
1092
1080
|
lottery_count: e.number()
|
|
1093
|
-
}),
|
|
1081
|
+
}), E = e.object({
|
|
1094
1082
|
reward_id: e.number(),
|
|
1095
1083
|
reward_item_id: e.number(),
|
|
1096
|
-
reward_source:
|
|
1084
|
+
reward_source: P,
|
|
1097
1085
|
reward_item_name: e.string(),
|
|
1098
|
-
reward_item_type:
|
|
1086
|
+
reward_item_type: Y,
|
|
1099
1087
|
reward_item_icon_url: e.string(),
|
|
1100
1088
|
reward_item_desc: e.string().optional(),
|
|
1101
1089
|
reward_item_rating: e.number(),
|
|
1102
1090
|
reward_amount: e.number(),
|
|
1103
|
-
reward_status:
|
|
1091
|
+
reward_status: L,
|
|
1104
1092
|
event_id: e.number(),
|
|
1105
1093
|
event_name: e.string(),
|
|
1106
1094
|
feature_id: e.number(),
|
|
1107
1095
|
engagement_id: e.number(),
|
|
1108
|
-
feature_type:
|
|
1096
|
+
feature_type: tt,
|
|
1109
1097
|
receive_time: e.number(),
|
|
1110
1098
|
extra_data: e.record(e.unknown()).optional()
|
|
1111
|
-
}), pn = e.string().enum(
|
|
1099
|
+
}), pn = e.string().enum(f.Unknown, f.Pending), _n = e.union(
|
|
1112
1100
|
e.object({
|
|
1113
1101
|
ticket: e.string(),
|
|
1114
1102
|
status: pn
|
|
1115
1103
|
}),
|
|
1116
1104
|
e.object({
|
|
1117
1105
|
ticket: e.string(),
|
|
1118
|
-
status: e.string().enum(
|
|
1119
|
-
reward:
|
|
1106
|
+
status: e.string().enum(k(f, "Unknown", "Pending")),
|
|
1107
|
+
reward: E
|
|
1120
1108
|
})
|
|
1121
1109
|
).satisfies(), bn = e.object({
|
|
1122
1110
|
tickets: e.array(_n)
|
|
1123
1111
|
}), yn = e.object({
|
|
1124
1112
|
platforms: e.array(e.string())
|
|
1125
|
-
}),
|
|
1113
|
+
}), re = e.object({
|
|
1126
1114
|
role_name: e.string(),
|
|
1127
1115
|
is_leader: e.bool(),
|
|
1128
1116
|
is_myself: e.bool().optional(),
|
|
1129
1117
|
progress: e.number().optional()
|
|
1130
1118
|
}).lock(), fn = e.object({
|
|
1131
|
-
objective:
|
|
1119
|
+
objective: ee,
|
|
1132
1120
|
progress: e.number(),
|
|
1133
1121
|
completion_value: e.number().optional(),
|
|
1134
1122
|
team: e.object({
|
|
1135
1123
|
progress: e.number(),
|
|
1136
1124
|
completion_value: e.number().optional(),
|
|
1137
|
-
players: e.array(
|
|
1125
|
+
players: e.array(re)
|
|
1138
1126
|
}).optional()
|
|
1139
1127
|
}), hn = e.object({
|
|
1140
1128
|
progress: e.number(),
|
|
1141
1129
|
team: e.object({
|
|
1142
1130
|
progress: e.number(),
|
|
1143
|
-
team_members: e.array(
|
|
1131
|
+
team_members: e.array(re).optional()
|
|
1144
1132
|
}).optional()
|
|
1145
1133
|
}), wn = e.object({
|
|
1146
1134
|
platform: e.string()
|
|
@@ -1159,7 +1147,7 @@ const V = {
|
|
|
1159
1147
|
server_name: e.string()
|
|
1160
1148
|
}), Vn = e.object({
|
|
1161
1149
|
team_code: e.string(),
|
|
1162
|
-
visibility:
|
|
1150
|
+
visibility: lt,
|
|
1163
1151
|
members: e.array(
|
|
1164
1152
|
e.object({
|
|
1165
1153
|
is_leader: e.bool(),
|
|
@@ -1181,7 +1169,7 @@ const V = {
|
|
|
1181
1169
|
comment: e.string(),
|
|
1182
1170
|
video_note: e.number(),
|
|
1183
1171
|
created_at: e.number()
|
|
1184
|
-
}),
|
|
1172
|
+
}), F = e.union(
|
|
1185
1173
|
yn,
|
|
1186
1174
|
gn,
|
|
1187
1175
|
vn,
|
|
@@ -1189,40 +1177,40 @@ const V = {
|
|
|
1189
1177
|
wn,
|
|
1190
1178
|
Rn,
|
|
1191
1179
|
kn,
|
|
1180
|
+
ln,
|
|
1192
1181
|
un,
|
|
1193
|
-
mn,
|
|
1194
1182
|
Vn,
|
|
1195
1183
|
fn,
|
|
1196
1184
|
bn,
|
|
1197
|
-
|
|
1185
|
+
mn,
|
|
1198
1186
|
Tn,
|
|
1199
1187
|
e.custom(
|
|
1200
1188
|
"EmptyObject",
|
|
1201
|
-
(i) =>
|
|
1189
|
+
(i) => w(i) && Object.keys(i).length === 0
|
|
1202
1190
|
)
|
|
1203
1191
|
).satisfies().lock(), xn = e.object({
|
|
1204
1192
|
reward_id: e.number(),
|
|
1205
1193
|
reward_item_id: e.number(),
|
|
1206
|
-
reward_item_type:
|
|
1194
|
+
reward_item_type: W,
|
|
1207
1195
|
reward_count: e.number(),
|
|
1208
|
-
reward_status:
|
|
1209
|
-
reward_source:
|
|
1196
|
+
reward_status: te,
|
|
1197
|
+
reward_source: P,
|
|
1210
1198
|
reward_item_name: e.string(),
|
|
1211
1199
|
reward_item_icon_url: e.string(),
|
|
1212
1200
|
reward_item_desc: e.string().optional(),
|
|
1213
1201
|
reward_item_rating: e.number(),
|
|
1214
1202
|
receive_time: e.number(),
|
|
1215
|
-
extra_data: e.union(...
|
|
1203
|
+
extra_data: e.union(...F.validators, e.record(e.unknown())).satisfies().optional()
|
|
1216
1204
|
}), Sn = e.object({
|
|
1217
1205
|
reward_id: e.number(),
|
|
1218
1206
|
reward_item_id: e.number(),
|
|
1219
1207
|
reward_item_name: e.string(),
|
|
1220
|
-
reward_item_type:
|
|
1208
|
+
reward_item_type: W,
|
|
1221
1209
|
reward_item_icon_url: e.string(),
|
|
1222
1210
|
reward_item_desc: e.string().optional(),
|
|
1223
1211
|
reward_amount: e.number(),
|
|
1224
|
-
reward_status:
|
|
1225
|
-
reward_source:
|
|
1212
|
+
reward_status: te,
|
|
1213
|
+
reward_source: P,
|
|
1226
1214
|
extra_data: e.record(e.unknown()).optional()
|
|
1227
1215
|
}), Ln = e.object({
|
|
1228
1216
|
engagement_id: e.number(),
|
|
@@ -1230,7 +1218,7 @@ const V = {
|
|
|
1230
1218
|
event_id: e.number(),
|
|
1231
1219
|
feature_id: e.number(),
|
|
1232
1220
|
sequence: e.number(),
|
|
1233
|
-
data:
|
|
1221
|
+
data: F.clone().optional(),
|
|
1234
1222
|
server_id: e.string().optional(),
|
|
1235
1223
|
role_id: e.string().optional(),
|
|
1236
1224
|
created_at: e.number(),
|
|
@@ -1238,40 +1226,40 @@ const V = {
|
|
|
1238
1226
|
}).lock(), Pn = e.object({
|
|
1239
1227
|
allowed: e.bool(),
|
|
1240
1228
|
registered: e.bool()
|
|
1241
|
-
}),
|
|
1229
|
+
}), $n = e.object({
|
|
1242
1230
|
feature_id: e.number(),
|
|
1243
1231
|
can_engage: e.bool(),
|
|
1244
1232
|
has_unclaimed_rewards: e.bool()
|
|
1245
|
-
}),
|
|
1233
|
+
}), En = e.object({
|
|
1246
1234
|
engagement_id: e.number(),
|
|
1247
1235
|
engagement: e.object({
|
|
1248
1236
|
engagement_id: e.number(),
|
|
1249
1237
|
sequence: e.number(),
|
|
1250
1238
|
feature_id: e.number(),
|
|
1251
|
-
data:
|
|
1239
|
+
data: F.clone().optional()
|
|
1252
1240
|
}).optional(),
|
|
1253
1241
|
rewards: e.array(Sn).optional(),
|
|
1254
1242
|
scan: e.bool().optional()
|
|
1255
|
-
}),
|
|
1243
|
+
}), Fn = e.object({
|
|
1256
1244
|
reward_id: e.number(),
|
|
1257
|
-
reward_status:
|
|
1258
|
-
}),
|
|
1245
|
+
reward_status: L
|
|
1246
|
+
}), Un = e.guard(cn), In = e.guard(Pn), q = s({ count: e.number() }), Dn = s({ first_visit: e.bool() }), An = s({
|
|
1259
1247
|
engagements: e.union(e.array(qn), e.array(Cn))
|
|
1260
1248
|
}), Gn = s({
|
|
1261
|
-
status: e.array(
|
|
1249
|
+
status: e.array($n)
|
|
1262
1250
|
}), On = s({
|
|
1263
1251
|
engagements_counts: e.record(e.number())
|
|
1264
1252
|
}), Nn = s({
|
|
1265
1253
|
engagements: e.array(Ln),
|
|
1266
1254
|
next_token: e.string().optional()
|
|
1267
|
-
}), Qn = e.guard(
|
|
1268
|
-
claimed_items: e.array(
|
|
1255
|
+
}), Qn = e.guard(En), Bn = s({
|
|
1256
|
+
claimed_items: e.array(Fn)
|
|
1269
1257
|
}), Mn = s({
|
|
1270
|
-
rewards: e.array(
|
|
1258
|
+
rewards: e.array(E)
|
|
1271
1259
|
}), Kn = s({
|
|
1272
|
-
reward_status:
|
|
1260
|
+
reward_status: L
|
|
1273
1261
|
}), Hn = s({
|
|
1274
|
-
user_rewards: e.array(
|
|
1262
|
+
user_rewards: e.array(E),
|
|
1275
1263
|
next_token: e.string().optional()
|
|
1276
1264
|
}), zn = s({
|
|
1277
1265
|
scene: e.string()
|
|
@@ -1305,7 +1293,7 @@ class Qr {
|
|
|
1305
1293
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
|
|
1306
1294
|
*/
|
|
1307
1295
|
async getConfig(t) {
|
|
1308
|
-
const { data: n } = await this.req.get(`event/${this.event}/event-config`,
|
|
1296
|
+
const { data: n } = await this.req.get(`event/${this.event}/event-config`, Un, t);
|
|
1309
1297
|
return n;
|
|
1310
1298
|
}
|
|
1311
1299
|
/**
|
|
@@ -1314,7 +1302,7 @@ class Qr {
|
|
|
1314
1302
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1315
1303
|
*/
|
|
1316
1304
|
async getEngagementsUserCount(t, n) {
|
|
1317
|
-
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`,
|
|
1305
|
+
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, q, {
|
|
1318
1306
|
...n,
|
|
1319
1307
|
params: { feature_id: t, type: "user" }
|
|
1320
1308
|
});
|
|
@@ -1326,7 +1314,7 @@ class Qr {
|
|
|
1326
1314
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1327
1315
|
*/
|
|
1328
1316
|
async getEngagementsCount(t, n) {
|
|
1329
|
-
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`,
|
|
1317
|
+
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, q, {
|
|
1330
1318
|
...n,
|
|
1331
1319
|
params: { feature_id: t, type: "engagement" }
|
|
1332
1320
|
});
|
|
@@ -1433,7 +1421,7 @@ class Qr {
|
|
|
1433
1421
|
*/
|
|
1434
1422
|
async engage(t, n, r, a) {
|
|
1435
1423
|
await this.token.autoLogin();
|
|
1436
|
-
const { data: o, code:
|
|
1424
|
+
const { data: o, code: g, message: p } = await this.req.post(
|
|
1437
1425
|
`event/${this.event}/engage`,
|
|
1438
1426
|
c({
|
|
1439
1427
|
feature_id: t,
|
|
@@ -1443,9 +1431,9 @@ class Qr {
|
|
|
1443
1431
|
Qn,
|
|
1444
1432
|
a
|
|
1445
1433
|
);
|
|
1446
|
-
return o
|
|
1447
|
-
message:
|
|
1448
|
-
error:
|
|
1434
|
+
return o ?? {
|
|
1435
|
+
message: p,
|
|
1436
|
+
error: g
|
|
1449
1437
|
// 激活码已领完
|
|
1450
1438
|
};
|
|
1451
1439
|
}
|
|
@@ -1466,8 +1454,8 @@ class Qr {
|
|
|
1466
1454
|
}),
|
|
1467
1455
|
Bn,
|
|
1468
1456
|
n
|
|
1469
|
-
)
|
|
1470
|
-
return
|
|
1457
|
+
);
|
|
1458
|
+
return r?.claimed_items || {
|
|
1471
1459
|
message: o,
|
|
1472
1460
|
error: a
|
|
1473
1461
|
};
|
|
@@ -1487,8 +1475,8 @@ class Qr {
|
|
|
1487
1475
|
}),
|
|
1488
1476
|
Mn,
|
|
1489
1477
|
n
|
|
1490
|
-
)
|
|
1491
|
-
return
|
|
1478
|
+
);
|
|
1479
|
+
return r?.rewards || {
|
|
1492
1480
|
message: o,
|
|
1493
1481
|
error: a
|
|
1494
1482
|
};
|
|
@@ -1506,7 +1494,7 @@ class Qr {
|
|
|
1506
1494
|
Kn,
|
|
1507
1495
|
n
|
|
1508
1496
|
);
|
|
1509
|
-
return r
|
|
1497
|
+
return r || {
|
|
1510
1498
|
message: o,
|
|
1511
1499
|
error: a
|
|
1512
1500
|
};
|
|
@@ -1548,7 +1536,7 @@ class Qr {
|
|
|
1548
1536
|
n
|
|
1549
1537
|
);
|
|
1550
1538
|
return {
|
|
1551
|
-
user_rewards:
|
|
1539
|
+
user_rewards: r?.user_rewards || [],
|
|
1552
1540
|
next_token: r?.next_token || ""
|
|
1553
1541
|
};
|
|
1554
1542
|
}
|
|
@@ -1559,7 +1547,7 @@ class Qr {
|
|
|
1559
1547
|
*/
|
|
1560
1548
|
async getUserItemCount(t, n) {
|
|
1561
1549
|
if (!await this.token.autoLogin()) return null;
|
|
1562
|
-
const { data: r } = await this.req.get(`event/${this.event}/user-item-count`,
|
|
1550
|
+
const { data: r } = await this.req.get(`event/${this.event}/user-item-count`, q, {
|
|
1563
1551
|
...n,
|
|
1564
1552
|
params: { item_id: t }
|
|
1565
1553
|
});
|
|
@@ -1659,14 +1647,14 @@ const Yn = {
|
|
|
1659
1647
|
Failed: "failed",
|
|
1660
1648
|
/** 嫌疑(仅自己可见) */
|
|
1661
1649
|
Suspect: "suspect"
|
|
1662
|
-
},
|
|
1650
|
+
}, ae = e.string().enum(er).lock(), tr = {
|
|
1663
1651
|
/** 系统通知 */
|
|
1664
1652
|
System: "system",
|
|
1665
1653
|
/** 评论我的 */
|
|
1666
1654
|
Comment: "comment",
|
|
1667
1655
|
/** 点赞通知 */
|
|
1668
1656
|
Like: "like"
|
|
1669
|
-
}, Br = e.string().enum(tr).lock(),
|
|
1657
|
+
}, Br = e.string().enum(tr).lock(), u = {
|
|
1670
1658
|
/** 系统通知 */
|
|
1671
1659
|
System: "system",
|
|
1672
1660
|
/** 帖子被置顶 */
|
|
@@ -1691,7 +1679,7 @@ const Yn = {
|
|
|
1691
1679
|
ReplyLiked: "reply_liked",
|
|
1692
1680
|
/** 回复被删除 */
|
|
1693
1681
|
ReplyDeleted: "reply_deleted"
|
|
1694
|
-
}, nr = e.string().enum(
|
|
1682
|
+
}, nr = e.string().enum(u).lock(), oe = e.object({
|
|
1695
1683
|
forum_id: e.number(),
|
|
1696
1684
|
icon_url: e.string(),
|
|
1697
1685
|
name: e.string(),
|
|
@@ -1699,16 +1687,16 @@ const Yn = {
|
|
|
1699
1687
|
sort: e.number(),
|
|
1700
1688
|
mode: Wn,
|
|
1701
1689
|
member_ids: e.array(e.number())
|
|
1702
|
-
}).lock(),
|
|
1690
|
+
}).lock(), U = e.object({
|
|
1703
1691
|
topic_id: e.number(),
|
|
1704
1692
|
cover_url: e.string(),
|
|
1705
1693
|
name: e.string(),
|
|
1706
1694
|
description: e.string(),
|
|
1707
1695
|
tags: e.array(e.string()),
|
|
1708
1696
|
post_num: e.number()
|
|
1709
|
-
}).lock(),
|
|
1697
|
+
}).lock(), I = e.object({
|
|
1710
1698
|
post_id: e.number(),
|
|
1711
|
-
forum:
|
|
1699
|
+
forum: oe,
|
|
1712
1700
|
posted_by: e.string(),
|
|
1713
1701
|
nickname: e.string(),
|
|
1714
1702
|
avatar_url: e.string(),
|
|
@@ -1720,13 +1708,13 @@ const Yn = {
|
|
|
1720
1708
|
comments_num: e.number(),
|
|
1721
1709
|
liked: e.bool(),
|
|
1722
1710
|
image_urls: e.array(e.string()),
|
|
1723
|
-
topics: e.array(
|
|
1711
|
+
topics: e.array(U),
|
|
1724
1712
|
event_ids: e.array(e.number()),
|
|
1725
1713
|
is_pinned: e.bool(),
|
|
1726
1714
|
is_highlighted: e.bool(),
|
|
1727
|
-
status:
|
|
1715
|
+
status: ae,
|
|
1728
1716
|
create_time: e.number()
|
|
1729
|
-
}).lock(),
|
|
1717
|
+
}).lock(), ie = e.object({
|
|
1730
1718
|
err_msg: e.string().optional()
|
|
1731
1719
|
}).optional().lock(), rr = e.object({
|
|
1732
1720
|
reply_id: e.number(),
|
|
@@ -1734,7 +1722,7 @@ const Yn = {
|
|
|
1734
1722
|
replied_by: e.string(),
|
|
1735
1723
|
nickname: e.string(),
|
|
1736
1724
|
avatar_url: e.string()
|
|
1737
|
-
}).lock(),
|
|
1725
|
+
}).lock(), C = e.object({
|
|
1738
1726
|
reply_id: e.number(),
|
|
1739
1727
|
comment_id: e.number(),
|
|
1740
1728
|
comment_content: e.string().optional(),
|
|
@@ -1749,7 +1737,7 @@ const Yn = {
|
|
|
1749
1737
|
liked: e.bool(),
|
|
1750
1738
|
reply_to: rr,
|
|
1751
1739
|
create_time: e.number()
|
|
1752
|
-
}).lock(),
|
|
1740
|
+
}).lock(), h = e.object({
|
|
1753
1741
|
comment_id: e.number(),
|
|
1754
1742
|
post_id: e.number(),
|
|
1755
1743
|
post_subject: e.string().optional(),
|
|
@@ -1767,13 +1755,13 @@ const Yn = {
|
|
|
1767
1755
|
liked: e.bool(),
|
|
1768
1756
|
image_url: e.string(),
|
|
1769
1757
|
create_time: e.number(),
|
|
1770
|
-
status:
|
|
1771
|
-
replies: e.array(
|
|
1758
|
+
status: ae,
|
|
1759
|
+
replies: e.array(C).optional()
|
|
1772
1760
|
}).lock(), ar = e.object({
|
|
1773
1761
|
image_url: e.string(),
|
|
1774
1762
|
upload_url: e.string(),
|
|
1775
1763
|
existed: e.bool()
|
|
1776
|
-
}).lock(),
|
|
1764
|
+
}).lock(), _ = e.object({
|
|
1777
1765
|
notification_id: e.string(),
|
|
1778
1766
|
notification_type: nr,
|
|
1779
1767
|
is_read: e.bool(),
|
|
@@ -1784,80 +1772,83 @@ const Yn = {
|
|
|
1784
1772
|
}).lock(), or = e.object({
|
|
1785
1773
|
system_message_subject: e.string(),
|
|
1786
1774
|
system_message_content: e.string()
|
|
1787
|
-
}).lock(),
|
|
1775
|
+
}).lock(), D = e.object({
|
|
1788
1776
|
post_id: e.number(),
|
|
1789
1777
|
post_subject: e.string(),
|
|
1790
1778
|
post_summary: e.string(),
|
|
1791
1779
|
post_image_url: e.string()
|
|
1792
|
-
}).lock(),
|
|
1780
|
+
}).lock(), V = e.object({
|
|
1793
1781
|
comment_id: e.number(),
|
|
1794
1782
|
comment_content: e.string()
|
|
1795
|
-
}).lock(),
|
|
1783
|
+
}).lock(), A = e.object({
|
|
1796
1784
|
reply_id: e.number(),
|
|
1797
1785
|
reply_content: e.string()
|
|
1798
1786
|
}).lock(), ir = e.object({
|
|
1799
|
-
...
|
|
1787
|
+
..._.shape,
|
|
1800
1788
|
...or.shape,
|
|
1801
|
-
notification_type: e.string().enum(
|
|
1789
|
+
notification_type: e.string().enum(u.System)
|
|
1802
1790
|
}), sr = e.object({
|
|
1803
|
-
...
|
|
1804
|
-
...
|
|
1791
|
+
..._.shape,
|
|
1792
|
+
...D.shape,
|
|
1805
1793
|
notification_type: e.string().enum(
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1794
|
+
u.PostPinned,
|
|
1795
|
+
u.PostHighlighted,
|
|
1796
|
+
u.PostDeleted,
|
|
1797
|
+
u.PostLiked
|
|
1810
1798
|
)
|
|
1811
1799
|
}), cr = e.object({
|
|
1812
|
-
...
|
|
1813
|
-
...
|
|
1814
|
-
...
|
|
1815
|
-
notification_type: e.string().enum(
|
|
1816
|
-
}), ur = e.object({
|
|
1817
|
-
...b.shape,
|
|
1818
|
-
...j.shape,
|
|
1819
|
-
...N.shape,
|
|
1820
|
-
notification_type: e.string().enum(g.CommentReplied)
|
|
1800
|
+
..._.shape,
|
|
1801
|
+
...D.shape,
|
|
1802
|
+
...V.shape,
|
|
1803
|
+
notification_type: e.string().enum(u.PostCommented)
|
|
1821
1804
|
}), lr = e.object({
|
|
1822
|
-
...
|
|
1823
|
-
...
|
|
1824
|
-
...
|
|
1825
|
-
notification_type: e.string().enum(
|
|
1805
|
+
..._.shape,
|
|
1806
|
+
...V.shape,
|
|
1807
|
+
...A.shape,
|
|
1808
|
+
notification_type: e.string().enum(u.CommentReplied)
|
|
1826
1809
|
}), mr = e.object({
|
|
1827
|
-
...
|
|
1828
|
-
...
|
|
1829
|
-
|
|
1810
|
+
..._.shape,
|
|
1811
|
+
...V.shape,
|
|
1812
|
+
...D.shape,
|
|
1813
|
+
notification_type: e.string().enum(u.CommentLiked, u.CommentDeleted)
|
|
1814
|
+
}), ur = e.object({
|
|
1815
|
+
..._.shape,
|
|
1816
|
+
...A.shape,
|
|
1817
|
+
notification_type: e.string().enum(u.ReplyReplied),
|
|
1830
1818
|
comment_id: e.number(),
|
|
1831
1819
|
reply_to_reply_id: e.number(),
|
|
1832
1820
|
reply_to_reply_content: e.string()
|
|
1833
1821
|
}), dr = e.object({
|
|
1834
|
-
...
|
|
1835
|
-
...
|
|
1836
|
-
...
|
|
1837
|
-
notification_type: e.string().enum(
|
|
1822
|
+
..._.shape,
|
|
1823
|
+
...A.shape,
|
|
1824
|
+
...V.shape,
|
|
1825
|
+
notification_type: e.string().enum(u.ReplyLiked, u.ReplyDeleted)
|
|
1838
1826
|
}), gr = e.union(
|
|
1839
1827
|
ir,
|
|
1840
1828
|
sr,
|
|
1841
1829
|
cr,
|
|
1842
|
-
ur,
|
|
1843
1830
|
lr,
|
|
1844
1831
|
mr,
|
|
1832
|
+
ur,
|
|
1845
1833
|
dr
|
|
1846
|
-
).satisfies().lock(), pr = s({ forums: e.array(
|
|
1847
|
-
posts: e.array(
|
|
1834
|
+
).satisfies().lock(), pr = s({ forums: e.array(oe) }), _r = s({ topics: e.array(U) }), br = s({ topic: U }), yr = s({ post: I }), M = s({
|
|
1835
|
+
posts: e.array(I),
|
|
1848
1836
|
next_token: e.string().optional()
|
|
1849
|
-
}), fr = s({
|
|
1850
|
-
|
|
1837
|
+
}), fr = s({
|
|
1838
|
+
post: I.clone().optional(),
|
|
1839
|
+
antispam: ie.clone().optional()
|
|
1840
|
+
}), hr = s({
|
|
1841
|
+
replies: e.array(C),
|
|
1851
1842
|
next_token: e.string().optional()
|
|
1852
|
-
}), wr = s({ reply:
|
|
1853
|
-
reply:
|
|
1854
|
-
antispam:
|
|
1855
|
-
}), vr = s({ comment:
|
|
1856
|
-
comments: e.array(
|
|
1843
|
+
}), wr = s({ reply: C }), kr = s({
|
|
1844
|
+
reply: C.clone().optional(),
|
|
1845
|
+
antispam: ie.clone().optional()
|
|
1846
|
+
}), vr = s({ comment: h }), Cr = s({
|
|
1847
|
+
comments: e.array(h),
|
|
1857
1848
|
next_token: e.string().optional()
|
|
1858
1849
|
}), Vr = s({
|
|
1859
|
-
comment:
|
|
1860
|
-
antispam:
|
|
1850
|
+
comment: h.clone().optional(),
|
|
1851
|
+
antispam: h.clone().optional()
|
|
1861
1852
|
}), Rr = e.guard(ar), jr = s({
|
|
1862
1853
|
notifications: e.array(gr),
|
|
1863
1854
|
next_token: e.string().optional()
|
|
@@ -1908,7 +1899,7 @@ class Mr {
|
|
|
1908
1899
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
|
|
1909
1900
|
*/
|
|
1910
1901
|
async getPosts(t, n) {
|
|
1911
|
-
const { data: r, code: a, message: o } = await this.req.get("community/posts",
|
|
1902
|
+
const { data: r, code: a, message: o } = await this.req.get("community/posts", M, {
|
|
1912
1903
|
...n,
|
|
1913
1904
|
params: c(t)
|
|
1914
1905
|
});
|
|
@@ -1923,13 +1914,13 @@ class Mr {
|
|
|
1923
1914
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
|
|
1924
1915
|
*/
|
|
1925
1916
|
async getPinnedPosts(t, n, r, a) {
|
|
1926
|
-
const { data: o, code:
|
|
1917
|
+
const { data: o, code: g, message: p } = await this.req.get("community/pinned-posts", M, {
|
|
1927
1918
|
...a,
|
|
1928
1919
|
params: c({ forum_id: t, max_results: n, next_token: r })
|
|
1929
1920
|
});
|
|
1930
1921
|
return o ?? {
|
|
1931
|
-
message:
|
|
1932
|
-
error:
|
|
1922
|
+
message: p,
|
|
1923
|
+
error: g
|
|
1933
1924
|
};
|
|
1934
1925
|
}
|
|
1935
1926
|
/**
|
|
@@ -2158,10 +2149,10 @@ const qr = s({
|
|
|
2158
2149
|
signature: e.string()
|
|
2159
2150
|
});
|
|
2160
2151
|
var xr = /* @__PURE__ */ ((i) => (i.RedirectUriDisMatch = "10003", i.AppidError = "10016", i.AuthorizationError = "10015", i.NoRightForScope = "10005", i.Frequently = "10009", i.AppBanded = "10004", i.ShouldFollow = "10006", i.ScopeNull = "10010", i.RedirectUriNull = "10011", i.AppidNull = "10012", i.StateNull = "10013", i))(xr || {});
|
|
2161
|
-
function
|
|
2162
|
-
return
|
|
2152
|
+
function x(i) {
|
|
2153
|
+
return w(i, "open_id", "union_id", "weixin_token");
|
|
2163
2154
|
}
|
|
2164
|
-
const
|
|
2155
|
+
const K = "wx_login_cache";
|
|
2165
2156
|
class Kr {
|
|
2166
2157
|
token;
|
|
2167
2158
|
$appid;
|
|
@@ -2193,11 +2184,11 @@ class Kr {
|
|
|
2193
2184
|
* 也可以直接调用 login 方法,并传入 weixin code 的读取函数
|
|
2194
2185
|
*/
|
|
2195
2186
|
async getLoginCache() {
|
|
2196
|
-
const t = this.token.storage.get(
|
|
2187
|
+
const t = this.token.storage.get(K);
|
|
2197
2188
|
if (!t)
|
|
2198
2189
|
return null;
|
|
2199
|
-
const n =
|
|
2200
|
-
return
|
|
2190
|
+
const n = _e(t);
|
|
2191
|
+
return x(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
|
|
2201
2192
|
}
|
|
2202
2193
|
/**
|
|
2203
2194
|
* 小程序页面微信静默登录,获取 weixinToken / open_id / union_id。
|
|
@@ -2217,19 +2208,19 @@ class Kr {
|
|
|
2217
2208
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
|
|
2218
2209
|
*/
|
|
2219
2210
|
async login(t) {
|
|
2220
|
-
if (!
|
|
2211
|
+
if (!b())
|
|
2221
2212
|
throw new Error("当前环境非微信小程序");
|
|
2222
2213
|
const n = await this.getLoginCache();
|
|
2223
2214
|
if (n)
|
|
2224
2215
|
return n;
|
|
2225
|
-
const r = await
|
|
2216
|
+
const r = await fe(), { data: a, code: o, message: g } = await this.req.post(
|
|
2226
2217
|
"weixin/login",
|
|
2227
2218
|
{ code: r, appid: this.appid },
|
|
2228
|
-
|
|
2219
|
+
x,
|
|
2229
2220
|
{ ...t, message: !1 }
|
|
2230
2221
|
);
|
|
2231
|
-
return a && (this.token.weixinToken = a.weixin_token, this.token.storage.set(
|
|
2232
|
-
message:
|
|
2222
|
+
return a && (this.token.weixinToken = a.weixin_token, this.token.storage.set(K, JSON.stringify(a))), a ?? {
|
|
2223
|
+
message: g,
|
|
2233
2224
|
error: o
|
|
2234
2225
|
};
|
|
2235
2226
|
}
|
|
@@ -2250,11 +2241,11 @@ class Kr {
|
|
|
2250
2241
|
* - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
|
|
2251
2242
|
*/
|
|
2252
2243
|
async webLogin(t = "snsapi_userinfo", n) {
|
|
2253
|
-
const r =
|
|
2244
|
+
const r = S("code"), a = Date.now(), o = +S("state");
|
|
2254
2245
|
if (!r || !o || o < a - 1e3 * 60 * 5 || o > a) {
|
|
2255
|
-
const
|
|
2246
|
+
const le = G(["code", "state"]);
|
|
2256
2247
|
location.replace(
|
|
2257
|
-
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(
|
|
2248
|
+
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(le)}&response_type=code&scope=${t}&state=${a}#wechat_redirect`
|
|
2258
2249
|
);
|
|
2259
2250
|
return;
|
|
2260
2251
|
}
|
|
@@ -2263,16 +2254,16 @@ class Kr {
|
|
|
2263
2254
|
message: "Error: " + r,
|
|
2264
2255
|
error: r
|
|
2265
2256
|
};
|
|
2266
|
-
const
|
|
2267
|
-
"replaceState" in history && history.replaceState({}, "",
|
|
2257
|
+
const g = G(["code", "state"]);
|
|
2258
|
+
"replaceState" in history && history.replaceState({}, "", g);
|
|
2268
2259
|
const {
|
|
2269
|
-
data:
|
|
2270
|
-
code:
|
|
2271
|
-
message:
|
|
2272
|
-
} = await this.req.post("weixin/login", { code: r, appid: this.appid },
|
|
2273
|
-
return
|
|
2274
|
-
message:
|
|
2275
|
-
error:
|
|
2260
|
+
data: p,
|
|
2261
|
+
code: se,
|
|
2262
|
+
message: ce
|
|
2263
|
+
} = await this.req.post("weixin/login", { code: r, appid: this.appid }, x, n);
|
|
2264
|
+
return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? {
|
|
2265
|
+
message: ce,
|
|
2266
|
+
error: se
|
|
2276
2267
|
};
|
|
2277
2268
|
}
|
|
2278
2269
|
/**
|
|
@@ -2318,37 +2309,37 @@ class Kr {
|
|
|
2318
2309
|
}
|
|
2319
2310
|
}
|
|
2320
2311
|
export {
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2312
|
+
ie as AntispamValidator,
|
|
2313
|
+
$r as AuthToken,
|
|
2314
|
+
ln as CashbackEngagementDataValidator,
|
|
2315
|
+
mn as ClaimActivationKeyEngagementDataValidator,
|
|
2316
|
+
it as ClaimRewardStatus,
|
|
2317
|
+
L as ClaimRewardStatusValidator,
|
|
2318
|
+
Fn as ClaimedItemValidator,
|
|
2319
|
+
J as ClubAddressValidator,
|
|
2320
|
+
Fr as ClubApi,
|
|
2321
|
+
Z as ClubBenefitSummaryValidator,
|
|
2322
|
+
De as ClubBenefitValidator,
|
|
2323
|
+
Re as ClubCreditChangeScene,
|
|
2324
|
+
je as ClubCreditChangeSceneValidator,
|
|
2325
|
+
Ce as ClubCreditChangeType,
|
|
2326
|
+
Ve as ClubCreditChangeTypeValidator,
|
|
2327
|
+
Ie as ClubCreditLogValidator,
|
|
2328
|
+
Se as ClubGlobalConfigValidator,
|
|
2329
|
+
Te as ClubItemType,
|
|
2330
|
+
H as ClubItemTypeValidator,
|
|
2331
|
+
Le as ClubPlayerValidator,
|
|
2332
|
+
X as ClubProductValidator,
|
|
2333
|
+
qe as ClubRedemptionStatus,
|
|
2334
|
+
xe as ClubRedemptionStatusValidator,
|
|
2335
|
+
Ue as ClubUserCreditValidator,
|
|
2336
|
+
Fe as ClubUserProfileValidator,
|
|
2346
2337
|
qn as CommentEngagementValidator,
|
|
2347
|
-
|
|
2338
|
+
h as CommentValidator,
|
|
2348
2339
|
Mr as CommunityApi,
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2340
|
+
Xe as EngageAccountType,
|
|
2341
|
+
Ye as EngageAccountTypeValidator,
|
|
2342
|
+
En as EngageResponseValidator,
|
|
2352
2343
|
Sn as EngageRewardValidator,
|
|
2353
2344
|
Qr as EventApi,
|
|
2354
2345
|
cn as EventConfigValidator,
|
|
@@ -2360,7 +2351,7 @@ export {
|
|
|
2360
2351
|
Tt as EventFeatureConfigOfFollowValidator,
|
|
2361
2352
|
St as EventFeatureConfigOfGiftCodeValidator,
|
|
2362
2353
|
Pt as EventFeatureConfigOfInviteValidator,
|
|
2363
|
-
|
|
2354
|
+
Et as EventFeatureConfigOfInvitedRegisterValidator,
|
|
2364
2355
|
Gt as EventFeatureConfigOfLotteryDrawValidator,
|
|
2365
2356
|
Dt as EventFeatureConfigOfLotteryValidator,
|
|
2366
2357
|
Nt as EventFeatureConfigOfPreregisterValidator,
|
|
@@ -2372,94 +2363,94 @@ export {
|
|
|
2372
2363
|
en as EventFeatureConfigOfTeamValidator,
|
|
2373
2364
|
rn as EventFeatureConfigOfVoteValidator,
|
|
2374
2365
|
sn as EventFeatureConfigValidator,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2366
|
+
We as EventPeriodType,
|
|
2367
|
+
et as EventPeriodTypeValidator,
|
|
2368
|
+
$ as EventRewardItemConfigValidator,
|
|
2369
|
+
Ge as ExtraGameRewardValidator,
|
|
2370
|
+
Ae as ExtraPhysicalShipmentValidator,
|
|
2380
2371
|
_t as FeatureRewardValidator,
|
|
2381
|
-
|
|
2382
|
-
|
|
2372
|
+
l as FeatureType,
|
|
2373
|
+
tt as FeatureTypeValidator,
|
|
2383
2374
|
Yn as ForumMode,
|
|
2384
2375
|
Wn as ForumModeValidator,
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2376
|
+
oe as ForumValidator,
|
|
2377
|
+
v as GamerItemType,
|
|
2378
|
+
Y as GamerItemTypeValidator,
|
|
2379
|
+
ke as Gender,
|
|
2380
|
+
ve as GenderValidator,
|
|
2381
|
+
un as GiftCodeEngagementDataValidator,
|
|
2391
2382
|
dn as InviteEngagementDataValidator,
|
|
2392
|
-
|
|
2383
|
+
ut as LotteryDrawAction,
|
|
2393
2384
|
Gr as LotteryDrawActionValidator,
|
|
2394
2385
|
bn as LotteryDrawEngagementDataValidator,
|
|
2395
2386
|
gn as LotteryEngagementDataValidator,
|
|
2396
|
-
|
|
2387
|
+
f as LotteryTicketStatus,
|
|
2397
2388
|
Dr as LotteryTicketStatusValidator,
|
|
2398
|
-
|
|
2389
|
+
_ as NotificationBaseValidator,
|
|
2399
2390
|
tr as NotificationCategory,
|
|
2400
2391
|
Br as NotificationCategoryValidator,
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2392
|
+
lr as NotificationCommentReplyValidator,
|
|
2393
|
+
mr as NotificationCommentValidator,
|
|
2394
|
+
V as NotificationPayloadCommentValidator,
|
|
2395
|
+
D as NotificationPayloadPostValidator,
|
|
2396
|
+
A as NotificationPayloadReplyValidator,
|
|
2406
2397
|
or as NotificationPayloadSystemValidator,
|
|
2407
2398
|
cr as NotificationPostCommentValidator,
|
|
2408
2399
|
sr as NotificationPostValidator,
|
|
2409
|
-
|
|
2400
|
+
ur as NotificationReplyRepliedValidator,
|
|
2410
2401
|
dr as NotificationReplyValidator,
|
|
2411
2402
|
ir as NotificationSystemValidator,
|
|
2412
|
-
|
|
2403
|
+
u as NotificationType,
|
|
2413
2404
|
nr as NotificationTypeValidator,
|
|
2414
2405
|
gr as NotificationValidator,
|
|
2415
|
-
|
|
2416
|
-
|
|
2406
|
+
Ee as PlayerRoleCardValidator,
|
|
2407
|
+
z as PlayerRoleValidator,
|
|
2417
2408
|
er as PostStatus,
|
|
2418
|
-
|
|
2419
|
-
|
|
2409
|
+
ae as PostStatusValidator,
|
|
2410
|
+
I as PostValidator,
|
|
2420
2411
|
yn as PreregisterEngagementDataValidator,
|
|
2421
2412
|
ar as PresignedUrlResponseValidator,
|
|
2422
2413
|
fn as QuestEngagementDataValidator,
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2414
|
+
nt as QuestObjective,
|
|
2415
|
+
ee as QuestObjectiveValidator,
|
|
2416
|
+
ne as QuestProgressAlgorithm,
|
|
2426
2417
|
dt as QuestProgressAlgorithmOptionalValidator,
|
|
2427
2418
|
Or as QuestProgressAlgorithmValidator,
|
|
2428
2419
|
hn as QuestProgressValidator,
|
|
2429
|
-
|
|
2430
|
-
|
|
2420
|
+
Er as RedeemParamsValidator,
|
|
2421
|
+
Oe as RedemptionValidator,
|
|
2431
2422
|
pt as RegularRewardValidator,
|
|
2432
2423
|
rr as ReplyToValidator,
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2424
|
+
C as ReplyValidator,
|
|
2425
|
+
Ur as RewardItemType,
|
|
2426
|
+
W as RewardItemTypeValidator,
|
|
2436
2427
|
st as RewardSource,
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2428
|
+
P as RewardSourceValidator,
|
|
2429
|
+
d as RewardStatus,
|
|
2430
|
+
ot as RewardStatusSuffix,
|
|
2431
|
+
te as RewardStatusSuffixValidator,
|
|
2441
2432
|
Ir as RewardStatusValidator,
|
|
2442
2433
|
xn as RewardValidator,
|
|
2443
|
-
|
|
2444
|
-
|
|
2434
|
+
$e as RoleBaseInfoValidator,
|
|
2435
|
+
Pe as ServerBaseInfoValidator,
|
|
2445
2436
|
wn as ShareEngagementDataValidator,
|
|
2446
2437
|
vn as SurveyEngagementDataValidator,
|
|
2447
|
-
|
|
2438
|
+
mt as TeamAction,
|
|
2448
2439
|
Ar as TeamActionValidator,
|
|
2449
2440
|
Vn as TeamEngagementDataValidator,
|
|
2450
2441
|
Cn as TeamEngagementValidator,
|
|
2451
2442
|
Nr as TeamMemberValidator,
|
|
2452
2443
|
ct as TeamVisibility,
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2444
|
+
lt as TeamVisibilityValidator,
|
|
2445
|
+
U as TopicValidator,
|
|
2446
|
+
F as UserEngagementDataValidator,
|
|
2456
2447
|
Ln as UserEngagementValidator,
|
|
2457
|
-
|
|
2458
|
-
|
|
2448
|
+
$n as UserFeatureStatusValidator,
|
|
2449
|
+
E as UserRewardValidator,
|
|
2459
2450
|
Pn as VerifyMobileResultValidator,
|
|
2460
2451
|
Rn as VoteEngagementDataValidator,
|
|
2461
|
-
|
|
2462
|
-
|
|
2452
|
+
rt as VoteOptionSource,
|
|
2453
|
+
at as VoteOptionSourceValidator,
|
|
2463
2454
|
Kr as WeixinApi,
|
|
2464
2455
|
kn as WeixinSubscribeEngagementDataValidator,
|
|
2465
2456
|
xr as WeixinWebLoginErrorCode,
|