@seayoo-web/gamer-api 2.4.2 → 2.4.3
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 +561 -498
- package/package.json +6 -6
- package/types/src/club.d.ts +6 -0
- package/types/src/community.d.ts +13 -6
- package/types/src/event.d.ts +8 -2
- package/types/src/weixin.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
var le = Object.defineProperty;
|
|
2
|
-
var me = (
|
|
3
|
-
var m = (
|
|
2
|
+
var me = (a, t, r) => t in a ? le(a, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[t] = r;
|
|
3
|
+
var m = (a, t, r) => me(a, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { isComboWebView as de } from "@seayoo-web/combo-webview";
|
|
5
|
-
import { isPlainObject as
|
|
6
|
-
function ye(
|
|
7
|
-
return
|
|
5
|
+
import { isPlainObject as R, useConsole as ge, Support as y, usePromise as pe, pruneURL as _e, queryString as E, pruneObject as c, v as e, omitFields as V, typedObjectGuard as s, parseJSON as be, removePara as B } from "@seayoo-web/utils";
|
|
6
|
+
function ye(a) {
|
|
7
|
+
return R(a, "gamer_token") && typeof a.gamer_token == "string";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function M(a) {
|
|
10
|
+
return R(a);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function fe(
|
|
14
|
-
return /^\/[a-z\d-]+$/.test(
|
|
12
|
+
const w = ge("GamerApiSDK");
|
|
13
|
+
function fe(a) {
|
|
14
|
+
return /^\/[a-z\d-]+$/.test(a);
|
|
15
15
|
}
|
|
16
16
|
async function he() {
|
|
17
|
-
const { promise:
|
|
17
|
+
const { promise: a, resolve: t } = pe();
|
|
18
18
|
return wx.login({
|
|
19
|
-
success(
|
|
20
|
-
t(
|
|
19
|
+
success(r) {
|
|
20
|
+
t(r.code);
|
|
21
21
|
},
|
|
22
22
|
fail() {
|
|
23
23
|
t("");
|
|
24
24
|
}
|
|
25
|
-
}), await
|
|
25
|
+
}), await a;
|
|
26
26
|
}
|
|
27
27
|
const we = {
|
|
28
|
-
get(
|
|
29
|
-
return localStorage.getItem(
|
|
28
|
+
get(a) {
|
|
29
|
+
return localStorage.getItem(a) || "";
|
|
30
30
|
},
|
|
31
|
-
set(
|
|
32
|
-
localStorage.setItem(
|
|
31
|
+
set(a, t) {
|
|
32
|
+
localStorage.setItem(a, t);
|
|
33
33
|
},
|
|
34
|
-
remove(
|
|
35
|
-
localStorage.removeItem(
|
|
34
|
+
remove(a) {
|
|
35
|
+
localStorage.removeItem(a);
|
|
36
36
|
}
|
|
37
37
|
}, ke = {
|
|
38
|
-
get(
|
|
38
|
+
get(a) {
|
|
39
39
|
try {
|
|
40
|
-
if (y.wx) return wx.getStorageSync(
|
|
40
|
+
if (y.wx) return wx.getStorageSync(a) || "";
|
|
41
41
|
} catch (t) {
|
|
42
|
-
|
|
42
|
+
w.error("getStorageSyncError", t);
|
|
43
43
|
}
|
|
44
44
|
return "";
|
|
45
45
|
},
|
|
46
|
-
set(
|
|
46
|
+
set(a, t) {
|
|
47
47
|
try {
|
|
48
|
-
y.wx && wx.setStorageSync(
|
|
49
|
-
} catch (
|
|
50
|
-
|
|
48
|
+
y.wx && wx.setStorageSync(a, t);
|
|
49
|
+
} catch (r) {
|
|
50
|
+
w.error("setStorageSyncError", r);
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
remove(
|
|
53
|
+
remove(a) {
|
|
54
54
|
try {
|
|
55
|
-
y.wx && wx.removeStorageSync(
|
|
55
|
+
y.wx && wx.removeStorageSync(a);
|
|
56
56
|
} catch (t) {
|
|
57
|
-
|
|
57
|
+
w.error("removeStorageSync", t);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, k = "gamer_token";
|
|
61
61
|
class Cr {
|
|
62
|
-
constructor(t,
|
|
62
|
+
constructor(t, r) {
|
|
63
63
|
m(this, "$NetRequest");
|
|
64
64
|
m(this, "$idToken", "");
|
|
65
65
|
m(this, "$weixinToken", "");
|
|
@@ -67,14 +67,14 @@ class Cr {
|
|
|
67
67
|
m(this, "req");
|
|
68
68
|
m(this, "storage");
|
|
69
69
|
this.storage = y.wx ? ke : we;
|
|
70
|
-
const
|
|
71
|
-
this.$NetRequest =
|
|
72
|
-
baseURL: `${
|
|
70
|
+
const n = fe(t) ? t : `https://${_e(t)}`;
|
|
71
|
+
this.$NetRequest = r, this.req = r({
|
|
72
|
+
baseURL: `${n}/v1`,
|
|
73
73
|
timeout: 1e4,
|
|
74
74
|
maxRetry: 2,
|
|
75
75
|
retryInterval: "2EB",
|
|
76
|
-
retryResolve({ method:
|
|
77
|
-
return
|
|
76
|
+
retryResolve({ method: p, status: d }) {
|
|
77
|
+
return p === "GET" && d < 0;
|
|
78
78
|
},
|
|
79
79
|
responseRule: {
|
|
80
80
|
ok: { resolve: "body" },
|
|
@@ -85,26 +85,26 @@ class Cr {
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
// 使用箭头函数绑定执行上下文
|
|
88
|
-
requestTransformer: (
|
|
89
|
-
this.$gamerToken && (
|
|
88
|
+
requestTransformer: (p) => {
|
|
89
|
+
this.$gamerToken && (p.headers.Authorization = `Bearer ${this.$gamerToken}`);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
const i = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host),
|
|
93
|
-
(de() || i &&
|
|
92
|
+
const i = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), o = E("gamer_token");
|
|
93
|
+
(de() || i && o) && (this.$gamerToken = o), this.$gamerToken || this.loadGamerTokenCache();
|
|
94
94
|
}
|
|
95
95
|
get NetRequest() {
|
|
96
96
|
return this.$NetRequest;
|
|
97
97
|
}
|
|
98
98
|
loadGamerTokenCache() {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
99
|
+
const r = this.storage.get(k).match(/^(\d{12,})#(.{8,})$/);
|
|
100
|
+
if (r) {
|
|
101
|
+
const n = parseInt(r[1]), i = r[2];
|
|
102
|
+
if (n > Date.now() - (24 * 3600 - 10) * 1e3) {
|
|
103
103
|
this.$gamerToken = i;
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
this.storage.remove(
|
|
107
|
+
this.storage.remove(k);
|
|
108
108
|
}
|
|
109
109
|
/** 当前是否为登录状态,即是否拥有 gamerToken */
|
|
110
110
|
get isLoggedIn() {
|
|
@@ -138,7 +138,7 @@ class Cr {
|
|
|
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(k, `${Date.now()}#${t}`) : this.storage.remove(k);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 退出登录,销毁相关 Token
|
|
@@ -166,12 +166,12 @@ class Cr {
|
|
|
166
166
|
if (this.gamerToken)
|
|
167
167
|
return !0;
|
|
168
168
|
if (!this.idToken)
|
|
169
|
-
return
|
|
169
|
+
return w.error("Missing idToken when call autoLogin()"), !1;
|
|
170
170
|
if (y.wx && !this.weixinToken)
|
|
171
|
-
return
|
|
172
|
-
const { code: t, data:
|
|
171
|
+
return w.error("Missing weixinToken when call autoLogin()"), !1;
|
|
172
|
+
const { code: t, data: r } = await this.req.post(
|
|
173
173
|
"login-with-token",
|
|
174
|
-
|
|
174
|
+
c({ id_token: this.idToken, weixin_token: y.wx ? this.weixinToken : null }),
|
|
175
175
|
ye,
|
|
176
176
|
{ message: !1 }
|
|
177
177
|
);
|
|
@@ -183,7 +183,7 @@ class Cr {
|
|
|
183
183
|
this.weixinToken = "";
|
|
184
184
|
break;
|
|
185
185
|
}
|
|
186
|
-
return this.gamerToken = (
|
|
186
|
+
return this.gamerToken = (r == null ? void 0 : r.gamer_token) || "", !!this.gamerToken;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* 获取当前登录用户的 Session 的信息
|
|
@@ -194,7 +194,7 @@ class Cr {
|
|
|
194
194
|
*/
|
|
195
195
|
async getSession() {
|
|
196
196
|
if (!await this.autoLogin()) return null;
|
|
197
|
-
const { data: t } = await this.req.get("session",
|
|
197
|
+
const { data: t } = await this.req.get("session", M, {
|
|
198
198
|
message: !1
|
|
199
199
|
});
|
|
200
200
|
return t;
|
|
@@ -206,8 +206,8 @@ class Cr {
|
|
|
206
206
|
*/
|
|
207
207
|
async authRealName(t) {
|
|
208
208
|
if (!await this.autoLogin()) return null;
|
|
209
|
-
const { data:
|
|
210
|
-
return
|
|
209
|
+
const { data: r } = await this.req.post("auth-real-name", c(t), M);
|
|
210
|
+
return r;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
const ve = {
|
|
@@ -244,7 +244,7 @@ const ve = {
|
|
|
244
244
|
Physical: "physical",
|
|
245
245
|
/** 虚拟商品 */
|
|
246
246
|
Virtual: "virtual"
|
|
247
|
-
},
|
|
247
|
+
}, X = e.string().enum(qe).lock(), xe = {
|
|
248
248
|
/** 待发放 */
|
|
249
249
|
Pending: "pending",
|
|
250
250
|
/** 已发放 */
|
|
@@ -284,13 +284,13 @@ const ve = {
|
|
|
284
284
|
}).lock(), $e = e.object({
|
|
285
285
|
role_id: e.string(),
|
|
286
286
|
role_name: e.string()
|
|
287
|
-
}).lock(),
|
|
287
|
+
}).lock(), Y = e.object({
|
|
288
288
|
...$e.shape,
|
|
289
289
|
...Ee.shape,
|
|
290
290
|
role_level: e.number(),
|
|
291
291
|
last_login_time: e.number()
|
|
292
292
|
}).lock(), Ue = e.object({
|
|
293
|
-
...
|
|
293
|
+
...Y.shape,
|
|
294
294
|
/** 角色战力 */
|
|
295
295
|
role_fighting: e.number(),
|
|
296
296
|
/** 宗门 ID */
|
|
@@ -305,7 +305,7 @@ const ve = {
|
|
|
305
305
|
bio: e.string(),
|
|
306
306
|
gender: Ce,
|
|
307
307
|
birthday: e.object({ year: e.number(), month: e.number(), day: e.number() })
|
|
308
|
-
}).lock(),
|
|
308
|
+
}).lock(), Z = e.object({
|
|
309
309
|
address_id: e.number(),
|
|
310
310
|
recipient: e.string(),
|
|
311
311
|
mobile: e.string(),
|
|
@@ -326,7 +326,7 @@ const ve = {
|
|
|
326
326
|
change_credit: e.number(),
|
|
327
327
|
balance: e.number(),
|
|
328
328
|
change_time: e.number()
|
|
329
|
-
}).lock(),
|
|
329
|
+
}).lock(), W = e.object({
|
|
330
330
|
benefit_id: e.number(),
|
|
331
331
|
name: e.string(),
|
|
332
332
|
img_url: e.string(),
|
|
@@ -335,11 +335,11 @@ const ve = {
|
|
|
335
335
|
max_level: e.number(),
|
|
336
336
|
product_id: e.number(),
|
|
337
337
|
tag: e.string()
|
|
338
|
-
}).lock(),
|
|
338
|
+
}).lock(), ee = e.object({
|
|
339
339
|
product_id: e.number(),
|
|
340
340
|
catalog_id: e.number(),
|
|
341
341
|
catalog_name: e.string(),
|
|
342
|
-
item_type:
|
|
342
|
+
item_type: X,
|
|
343
343
|
name: e.string(),
|
|
344
344
|
img_url: e.string(),
|
|
345
345
|
description: e.string(),
|
|
@@ -362,8 +362,8 @@ const ve = {
|
|
|
362
362
|
updated_at: e.number(),
|
|
363
363
|
redeemable_quantity: e.number().optional()
|
|
364
364
|
}).lock(), Ge = e.object({
|
|
365
|
-
...
|
|
366
|
-
product:
|
|
365
|
+
...V(W.shape, "tag"),
|
|
366
|
+
product: ee.clone().optional()
|
|
367
367
|
}).lock(), Rr = e.union(
|
|
368
368
|
e.object({
|
|
369
369
|
server_id: e.string(),
|
|
@@ -391,7 +391,7 @@ const ve = {
|
|
|
391
391
|
product_id: e.number(),
|
|
392
392
|
name: e.string(),
|
|
393
393
|
img_url: e.string(),
|
|
394
|
-
item_type:
|
|
394
|
+
item_type: X,
|
|
395
395
|
catalog_id: e.number(),
|
|
396
396
|
catalog_name: e.string(),
|
|
397
397
|
quantity: e.number(),
|
|
@@ -399,10 +399,10 @@ const ve = {
|
|
|
399
399
|
status: Se,
|
|
400
400
|
created_at: e.number(),
|
|
401
401
|
extra_data: e.union(Ae.clone(), Ne.clone()).satisfies().optional()
|
|
402
|
-
}), Be = e.guard(Le),
|
|
402
|
+
}), Be = e.guard(Le), Q = s({ player: Pe }), Me = s({ roles: e.array(Y) }), x = s({ role_card: Ue }), K = e.guard(Fe), H = e.guard(Z), Qe = s({ addresses: e.array(Z) }), Ke = e.guard(De), He = s({
|
|
403
403
|
credit_logs: e.array(Ie),
|
|
404
404
|
next_token: e.string().optional()
|
|
405
|
-
}), ze =
|
|
405
|
+
}), ze = s({ products: e.array(ee) }), Je = s({ benefits: e.array(W) }), Xe = s({ benefit: Ge }), Ye = s({
|
|
406
406
|
redemptions: e.array(Oe),
|
|
407
407
|
next_token: e.string().optional()
|
|
408
408
|
});
|
|
@@ -418,8 +418,8 @@ class Vr {
|
|
|
418
418
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
|
|
419
419
|
*/
|
|
420
420
|
async getConfig(t) {
|
|
421
|
-
const { data:
|
|
422
|
-
return
|
|
421
|
+
const { data: r } = await this.req.get("club/config", Be, t);
|
|
422
|
+
return r;
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
425
425
|
* 用于游戏内嵌 Web 页面和微信小程序获取当前登录的游戏账号在俱乐部中的信息。
|
|
@@ -428,8 +428,11 @@ class Vr {
|
|
|
428
428
|
*/
|
|
429
429
|
async getCurrentPlayer(t) {
|
|
430
430
|
await this.token.autoLogin();
|
|
431
|
-
const { data:
|
|
432
|
-
return (
|
|
431
|
+
const { data: r, code: n, message: i } = await this.req.get("club/current-player", Q, t);
|
|
432
|
+
return (r == null ? void 0 : r.player) ?? {
|
|
433
|
+
message: i,
|
|
434
|
+
error: n
|
|
435
|
+
};
|
|
433
436
|
}
|
|
434
437
|
/**
|
|
435
438
|
* 俱乐部用户关联游戏账号
|
|
@@ -438,16 +441,15 @@ class Vr {
|
|
|
438
441
|
*/
|
|
439
442
|
async linkPlayer(t) {
|
|
440
443
|
await this.token.autoLogin();
|
|
441
|
-
const { data:
|
|
444
|
+
const { data: r, code: n, message: i } = await this.req.post(
|
|
442
445
|
"club/link-player",
|
|
443
|
-
{
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
M,
|
|
446
|
+
{ id_token: this.token.idToken },
|
|
447
|
+
Q,
|
|
447
448
|
t
|
|
448
449
|
);
|
|
449
|
-
return (
|
|
450
|
-
|
|
450
|
+
return (r == null ? void 0 : r.player) ?? {
|
|
451
|
+
message: i,
|
|
452
|
+
error: n
|
|
451
453
|
};
|
|
452
454
|
}
|
|
453
455
|
/**
|
|
@@ -455,11 +457,11 @@ class Vr {
|
|
|
455
457
|
*
|
|
456
458
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=nwu4FiGM9V
|
|
457
459
|
*/
|
|
458
|
-
async getRoles(t,
|
|
460
|
+
async getRoles(t, r, n) {
|
|
459
461
|
if (!await this.token.autoLogin()) return [];
|
|
460
462
|
const { data: i } = await this.req.get("club/roles", Me, {
|
|
461
|
-
...
|
|
462
|
-
params:
|
|
463
|
+
...n,
|
|
464
|
+
params: c({ player_id: t, refresh: r })
|
|
463
465
|
});
|
|
464
466
|
return (i == null ? void 0 : i.roles) || [];
|
|
465
467
|
}
|
|
@@ -468,22 +470,22 @@ class Vr {
|
|
|
468
470
|
*
|
|
469
471
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=A1Wr7kUXnS
|
|
470
472
|
*/
|
|
471
|
-
async getRoleCard(t,
|
|
472
|
-
const { data:
|
|
473
|
-
...
|
|
473
|
+
async getRoleCard(t, r) {
|
|
474
|
+
const { data: n } = await this.req.get("club/role-card", x, {
|
|
475
|
+
...r,
|
|
474
476
|
params: { member_id: t }
|
|
475
477
|
});
|
|
476
|
-
return (
|
|
478
|
+
return (n == null ? void 0 : n.role_card) ?? null;
|
|
477
479
|
}
|
|
478
480
|
/**
|
|
479
481
|
* 设置自己的角色卡片
|
|
480
482
|
*
|
|
481
483
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XgMf6OFE5i
|
|
482
484
|
*/
|
|
483
|
-
async setRoleCard(t,
|
|
485
|
+
async setRoleCard(t, r) {
|
|
484
486
|
if (!await this.token.autoLogin()) return null;
|
|
485
|
-
const { data:
|
|
486
|
-
return (
|
|
487
|
+
const { data: n } = await this.req.post("club/role-card", t, x, r);
|
|
488
|
+
return (n == null ? void 0 : n.role_card) ?? null;
|
|
487
489
|
}
|
|
488
490
|
/**
|
|
489
491
|
* 强制刷新自己的角色卡片,从游戏内获取最新数据
|
|
@@ -492,30 +494,31 @@ class Vr {
|
|
|
492
494
|
*/
|
|
493
495
|
async refreshRoleCard(t) {
|
|
494
496
|
if (!await this.token.autoLogin()) return null;
|
|
495
|
-
const { data:
|
|
496
|
-
return (
|
|
497
|
+
const { data: r } = await this.req.post("club/refresh-role-card", {}, x, t);
|
|
498
|
+
return (r == null ? void 0 : r.role_card) ?? null;
|
|
497
499
|
}
|
|
498
500
|
/**
|
|
499
501
|
* 获取俱乐部用户的信息
|
|
500
502
|
*
|
|
501
503
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
|
|
502
504
|
*/
|
|
503
|
-
async getUserProfile(t,
|
|
504
|
-
const { data:
|
|
505
|
-
...
|
|
505
|
+
async getUserProfile(t, r) {
|
|
506
|
+
const { data: n } = await this.req.get("club/user-profile", K, {
|
|
507
|
+
...r,
|
|
506
508
|
params: { member_id: t }
|
|
507
509
|
});
|
|
508
|
-
return
|
|
510
|
+
return n;
|
|
509
511
|
}
|
|
510
512
|
/**
|
|
511
513
|
* 修改自己的俱乐部用户信息
|
|
512
514
|
*
|
|
513
515
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Qt822A57jd
|
|
514
516
|
*/
|
|
515
|
-
async updateUserProfile(t,
|
|
517
|
+
async updateUserProfile(t, r) {
|
|
516
518
|
await this.token.autoLogin();
|
|
517
|
-
const { data:
|
|
518
|
-
return
|
|
519
|
+
const { data: n, code: i, message: o } = await this.req.post("club/user-profile", t, K, r);
|
|
520
|
+
return n ?? {
|
|
521
|
+
message: o,
|
|
519
522
|
error: i
|
|
520
523
|
};
|
|
521
524
|
}
|
|
@@ -526,69 +529,78 @@ class Vr {
|
|
|
526
529
|
*/
|
|
527
530
|
async getAddresses(t) {
|
|
528
531
|
if (!await this.token.autoLogin()) return [];
|
|
529
|
-
const { data:
|
|
530
|
-
return (
|
|
532
|
+
const { data: r } = await this.req.get("club/addresses", Qe, t);
|
|
533
|
+
return (r == null ? void 0 : r.addresses) ?? [];
|
|
531
534
|
}
|
|
532
535
|
/**
|
|
533
536
|
* 增加俱乐部收货地址
|
|
534
537
|
*
|
|
535
538
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TaGIIYDRYA
|
|
536
539
|
*/
|
|
537
|
-
async addAddress(t,
|
|
540
|
+
async addAddress(t, r) {
|
|
538
541
|
if (!await this.token.autoLogin()) return null;
|
|
539
|
-
const { data:
|
|
540
|
-
return
|
|
542
|
+
const { data: n } = await this.req.post("/club/add-address", c(t), H, r);
|
|
543
|
+
return n;
|
|
541
544
|
}
|
|
542
545
|
/**
|
|
543
546
|
* 修改自己的俱乐部收货地址
|
|
544
547
|
*
|
|
545
548
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=p9FlJhHnWN
|
|
546
549
|
*/
|
|
547
|
-
async updateAddress(t,
|
|
550
|
+
async updateAddress(t, r) {
|
|
548
551
|
await this.token.autoLogin();
|
|
549
|
-
const { data:
|
|
552
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
550
553
|
"club/update-address",
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
+
c(t),
|
|
555
|
+
H,
|
|
556
|
+
r
|
|
554
557
|
);
|
|
555
|
-
return
|
|
558
|
+
return n ?? {
|
|
559
|
+
message: o,
|
|
560
|
+
error: i
|
|
561
|
+
};
|
|
556
562
|
}
|
|
557
563
|
/**
|
|
558
564
|
* 删除自己的俱乐部收货地址
|
|
559
565
|
*
|
|
560
566
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=MEEOBdf8rm
|
|
561
567
|
*/
|
|
562
|
-
async deleteAddress(t,
|
|
568
|
+
async deleteAddress(t, r) {
|
|
563
569
|
if (!await this.token.autoLogin()) return null;
|
|
564
|
-
const { ok:
|
|
565
|
-
return
|
|
570
|
+
const { ok: n } = await this.req.post("club/delete-address", { address_id: t }, null, r);
|
|
571
|
+
return n;
|
|
566
572
|
}
|
|
567
573
|
/**
|
|
568
574
|
* 获取俱乐部积分统计信息
|
|
569
575
|
*
|
|
570
576
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=x4uxtGstRL
|
|
571
577
|
*/
|
|
572
|
-
async getUserCredit(t,
|
|
578
|
+
async getUserCredit(t, r) {
|
|
573
579
|
await this.token.autoLogin();
|
|
574
|
-
const { data:
|
|
575
|
-
...
|
|
576
|
-
params:
|
|
580
|
+
const { data: n, code: i, message: o } = await this.req.get("club/user-credit", Ke, {
|
|
581
|
+
...r,
|
|
582
|
+
params: c(t)
|
|
577
583
|
});
|
|
578
|
-
return
|
|
584
|
+
return n ?? {
|
|
585
|
+
message: o,
|
|
586
|
+
error: i
|
|
587
|
+
};
|
|
579
588
|
}
|
|
580
589
|
/**
|
|
581
590
|
* 获取自己的俱乐部积分变动记录
|
|
582
591
|
*
|
|
583
592
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=lQFgF689P8
|
|
584
593
|
*/
|
|
585
|
-
async getCreditLogs(t,
|
|
594
|
+
async getCreditLogs(t, r) {
|
|
586
595
|
await this.token.autoLogin();
|
|
587
|
-
const { data:
|
|
588
|
-
...
|
|
589
|
-
params:
|
|
596
|
+
const { data: n } = await this.req.get("club/credit-logs", He, {
|
|
597
|
+
...r,
|
|
598
|
+
params: c({ max_results: 20, ...t })
|
|
590
599
|
});
|
|
591
|
-
return {
|
|
600
|
+
return {
|
|
601
|
+
credit_logs: (n == null ? void 0 : n.credit_logs) || [],
|
|
602
|
+
next_token: n == null ? void 0 : n.next_token
|
|
603
|
+
};
|
|
592
604
|
}
|
|
593
605
|
/**
|
|
594
606
|
* 获取自己的俱乐部权益列表
|
|
@@ -597,43 +609,44 @@ class Vr {
|
|
|
597
609
|
*/
|
|
598
610
|
async getBenefits(t) {
|
|
599
611
|
if (!await this.token.autoLogin()) return [];
|
|
600
|
-
const { data:
|
|
601
|
-
return (
|
|
612
|
+
const { data: r } = await this.req.get("club/benefits", Je, t);
|
|
613
|
+
return (r == null ? void 0 : r.benefits) || [];
|
|
602
614
|
}
|
|
603
615
|
/**
|
|
604
616
|
* 获取某个权益详细信息
|
|
605
617
|
*
|
|
606
618
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XKto0MeaHF
|
|
607
619
|
*/
|
|
608
|
-
async getBenefit(t,
|
|
620
|
+
async getBenefit(t, r) {
|
|
609
621
|
if (!await this.token.autoLogin()) return null;
|
|
610
|
-
const { data:
|
|
611
|
-
...
|
|
622
|
+
const { data: n } = await this.req.get("club/benefit", Xe, {
|
|
623
|
+
...r,
|
|
612
624
|
params: { benefit_id: t }
|
|
613
625
|
});
|
|
614
|
-
return (
|
|
626
|
+
return (n == null ? void 0 : n.benefit) || null;
|
|
615
627
|
}
|
|
616
628
|
/**
|
|
617
629
|
* 获取商城商品列表
|
|
618
630
|
*
|
|
619
631
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
|
|
620
632
|
*/
|
|
621
|
-
async getProducts(t,
|
|
622
|
-
const { data:
|
|
623
|
-
...
|
|
633
|
+
async getProducts(t, r) {
|
|
634
|
+
const { data: n } = await this.req.get("club/products", ze, {
|
|
635
|
+
...r,
|
|
624
636
|
params: t
|
|
625
637
|
});
|
|
626
|
-
return (
|
|
638
|
+
return (n == null ? void 0 : n.products) || [];
|
|
627
639
|
}
|
|
628
640
|
/**
|
|
629
641
|
* 兑换商城商品
|
|
630
642
|
*
|
|
631
643
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=LWcMVwX3OY
|
|
632
644
|
*/
|
|
633
|
-
async redeemProduct(t,
|
|
645
|
+
async redeemProduct(t, r) {
|
|
634
646
|
await this.token.autoLogin();
|
|
635
|
-
const { ok:
|
|
636
|
-
return
|
|
647
|
+
const { ok: n, code: i, message: o } = await this.req.post("club/redeem-product", c(t), null, r);
|
|
648
|
+
return n || {
|
|
649
|
+
message: o,
|
|
637
650
|
error: i
|
|
638
651
|
};
|
|
639
652
|
}
|
|
@@ -642,16 +655,19 @@ class Vr {
|
|
|
642
655
|
*
|
|
643
656
|
* https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Ml6mLgT4cM
|
|
644
657
|
*/
|
|
645
|
-
async getRedemptions(t,
|
|
658
|
+
async getRedemptions(t, r) {
|
|
646
659
|
await this.token.autoLogin();
|
|
647
|
-
const { data:
|
|
648
|
-
...
|
|
649
|
-
params:
|
|
660
|
+
const { data: n } = await this.req.get("club/redemptions", Ye, {
|
|
661
|
+
...r,
|
|
662
|
+
params: c({ max_results: 20, ...t })
|
|
650
663
|
});
|
|
651
|
-
return {
|
|
664
|
+
return {
|
|
665
|
+
redemptions: (n == null ? void 0 : n.redemptions) || [],
|
|
666
|
+
next_token: n == null ? void 0 : n.next_token
|
|
667
|
+
};
|
|
652
668
|
}
|
|
653
669
|
}
|
|
654
|
-
const
|
|
670
|
+
const j = {
|
|
655
671
|
/** 活动道具 */
|
|
656
672
|
EventItem: "event_item",
|
|
657
673
|
/** 游戏内道具 */
|
|
@@ -670,7 +686,7 @@ const V = {
|
|
|
670
686
|
ExternalCode: "external_gift_code",
|
|
671
687
|
/** 空奖励 */
|
|
672
688
|
VoidItem: "void_item"
|
|
673
|
-
},
|
|
689
|
+
}, te = e.string().enum(j).lock(), jr = j, ne = te, Ze = {
|
|
674
690
|
/** 世游通行证 ID / Combo ID */
|
|
675
691
|
UserId: "user_id",
|
|
676
692
|
/** 游戏角色 ID */
|
|
@@ -680,7 +696,7 @@ const V = {
|
|
|
680
696
|
Daily: "daily",
|
|
681
697
|
Weekly: "weekly",
|
|
682
698
|
Monthly: "monthly"
|
|
683
|
-
}, tt = e.string().enum(et).lock(),
|
|
699
|
+
}, tt = e.string().enum(et).lock(), u = {
|
|
684
700
|
/** 预约 */
|
|
685
701
|
Preregister: "preregister",
|
|
686
702
|
/** 抽奖 */
|
|
@@ -719,7 +735,7 @@ const V = {
|
|
|
719
735
|
CheckIn: "check_in",
|
|
720
736
|
/** 领取激活码 */
|
|
721
737
|
ClaimActivationKey: "claim_activation_key"
|
|
722
|
-
}, nt = e.string().enum(
|
|
738
|
+
}, nt = e.string().enum(u).lock(), rt = {
|
|
723
739
|
/** 累计游戏内活跃值 */
|
|
724
740
|
Active: "player_active_points",
|
|
725
741
|
/** 累计登录,单位 人天 */
|
|
@@ -734,7 +750,7 @@ const V = {
|
|
|
734
750
|
MatchCounts: "player_match_counts",
|
|
735
751
|
/** 游戏对局天数 */
|
|
736
752
|
MatchDays: "player_match_days"
|
|
737
|
-
},
|
|
753
|
+
}, re = e.string().enum(rt).lock(), it = {
|
|
738
754
|
/** 官方上传 */
|
|
739
755
|
System: "system",
|
|
740
756
|
/** 用户投稿 */
|
|
@@ -752,7 +768,7 @@ const V = {
|
|
|
752
768
|
Failed: "failed",
|
|
753
769
|
/** 奖励已发货 */
|
|
754
770
|
Delivered: "delivered"
|
|
755
|
-
}, Tr = e.string().enum(_).lock(),
|
|
771
|
+
}, Tr = e.string().enum(_).lock(), $ = {
|
|
756
772
|
/**
|
|
757
773
|
* 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
|
|
758
774
|
*
|
|
@@ -767,7 +783,7 @@ const V = {
|
|
|
767
783
|
Failed: _.Failed,
|
|
768
784
|
/** 奖励已发货 */
|
|
769
785
|
Delivered: _.Delivered
|
|
770
|
-
},
|
|
786
|
+
}, ie = e.string().enum($).lock(), b = {
|
|
771
787
|
/** 未获得奖励 */
|
|
772
788
|
Ineligible: _.Ineligible,
|
|
773
789
|
/**
|
|
@@ -784,17 +800,17 @@ const V = {
|
|
|
784
800
|
Failed: _.Failed,
|
|
785
801
|
/** 奖励已发货 */
|
|
786
802
|
Delivered: _.Delivered
|
|
787
|
-
},
|
|
803
|
+
}, U = e.string().enum(b).lock(), at = {
|
|
788
804
|
/** 玩法产出奖励 */
|
|
789
805
|
Output: "output",
|
|
790
806
|
/** 玩法参与奖励 */
|
|
791
807
|
Engage: "engage"
|
|
792
|
-
},
|
|
808
|
+
}, F = e.string().enum(at).lock(), st = {
|
|
793
809
|
/** 私有队伍 */
|
|
794
810
|
Private: "private",
|
|
795
811
|
/** 公开队伍 */
|
|
796
812
|
Public: "public"
|
|
797
|
-
}, ct = e.string().enum(st).lock(),
|
|
813
|
+
}, ct = e.string().enum(st).lock(), v = {
|
|
798
814
|
/** 未知状态 */
|
|
799
815
|
Unknown: "unknown",
|
|
800
816
|
/** 等待开奖 */
|
|
@@ -805,7 +821,7 @@ const V = {
|
|
|
805
821
|
Claimed: "claimed",
|
|
806
822
|
/** 领奖失败 */
|
|
807
823
|
Fail: "fail"
|
|
808
|
-
}, qr = e.string().enum(
|
|
824
|
+
}, qr = e.string().enum(v).lock(), ut = {
|
|
809
825
|
/** 发起组队 */
|
|
810
826
|
Assemble: "assemble",
|
|
811
827
|
/** 加入队伍 */
|
|
@@ -823,7 +839,7 @@ const V = {
|
|
|
823
839
|
Draw: "draw",
|
|
824
840
|
/** 领奖 */
|
|
825
841
|
Claim: "claim"
|
|
826
|
-
}, Sr = e.string().enum(lt).lock(), mt = e.string().enum(
|
|
842
|
+
}, Sr = e.string().enum(lt).lock(), mt = e.string().enum(V(j, "GiftCode", "LotteryTicket")), D = e.object({
|
|
827
843
|
reward_item_id: e.number(),
|
|
828
844
|
reward_amount: e.number(),
|
|
829
845
|
reward_item_name: e.string(),
|
|
@@ -833,17 +849,17 @@ const V = {
|
|
|
833
849
|
reward_item_rating: e.number()
|
|
834
850
|
}).lock(), dt = e.object({
|
|
835
851
|
engage_count: e.number(),
|
|
836
|
-
rewards: e.array(
|
|
852
|
+
rewards: e.array(D)
|
|
837
853
|
}).lock(), gt = e.union(
|
|
838
854
|
e.object({
|
|
839
855
|
feature_reward_type: e.string().enum("every"),
|
|
840
|
-
reward_details: e.array(
|
|
856
|
+
reward_details: e.array(D)
|
|
841
857
|
}),
|
|
842
858
|
e.object({
|
|
843
859
|
feature_reward_type: e.string().enum("regular"),
|
|
844
860
|
reward_details: e.array(dt)
|
|
845
861
|
})
|
|
846
|
-
).satisfies().lock(),
|
|
862
|
+
).satisfies().lock(), l = e.object({
|
|
847
863
|
feature_name: e.string(),
|
|
848
864
|
feature_id: e.number(),
|
|
849
865
|
description: e.string(),
|
|
@@ -853,8 +869,8 @@ const V = {
|
|
|
853
869
|
until: e.number(),
|
|
854
870
|
engage_account: We,
|
|
855
871
|
feature_rewards: gt.clone().optional()
|
|
856
|
-
}), pt =
|
|
857
|
-
...
|
|
872
|
+
}), pt = u.Cashback, _t = e.object({
|
|
873
|
+
...l.shape,
|
|
858
874
|
feature_type: e.string().enum(pt),
|
|
859
875
|
config: e.object({
|
|
860
876
|
order_start_time: e.number(),
|
|
@@ -862,24 +878,24 @@ const V = {
|
|
|
862
878
|
claim_rewards_start_time: e.number(),
|
|
863
879
|
claim_rewards_end_time: e.number()
|
|
864
880
|
})
|
|
865
|
-
}), bt =
|
|
866
|
-
...
|
|
881
|
+
}), bt = u.CheckIn, yt = e.object({
|
|
882
|
+
...l.shape,
|
|
867
883
|
feature_type: e.string().enum(bt)
|
|
868
|
-
}), ft =
|
|
869
|
-
...
|
|
884
|
+
}), ft = u.ClaimActivationKey, ht = e.object({
|
|
885
|
+
...l.shape,
|
|
870
886
|
feature_type: e.string().enum(ft)
|
|
871
|
-
}), wt =
|
|
872
|
-
...
|
|
887
|
+
}), wt = u.ClaimRewards, kt = e.object({
|
|
888
|
+
...l.shape,
|
|
873
889
|
feature_type: e.string().enum(wt)
|
|
874
|
-
}), vt =
|
|
875
|
-
...
|
|
890
|
+
}), vt = u.Comment, Ct = e.object({
|
|
891
|
+
...l.shape,
|
|
876
892
|
feature_type: e.string().enum(vt),
|
|
877
893
|
config: e.object({
|
|
878
894
|
comments: e.array(e.string()),
|
|
879
895
|
send_rate: e.number()
|
|
880
896
|
})
|
|
881
|
-
}), Rt =
|
|
882
|
-
...
|
|
897
|
+
}), Rt = u.Follow, Vt = e.object({
|
|
898
|
+
...l.shape,
|
|
883
899
|
feature_type: e.string().enum(Rt),
|
|
884
900
|
config: e.object({
|
|
885
901
|
platform: e.string(),
|
|
@@ -888,28 +904,28 @@ const V = {
|
|
|
888
904
|
qr_code_url: e.string().optional(),
|
|
889
905
|
platform_desc: e.string().optional()
|
|
890
906
|
})
|
|
891
|
-
}), jt =
|
|
907
|
+
}), jt = u.GiftCode, Tt = e.object({
|
|
892
908
|
name: e.string(),
|
|
893
909
|
icon_url: e.string(),
|
|
894
910
|
count: e.number()
|
|
895
911
|
}), qt = e.object({
|
|
896
|
-
...
|
|
912
|
+
...l.shape,
|
|
897
913
|
feature_type: e.string().enum(jt),
|
|
898
914
|
config: e.object({
|
|
899
915
|
gift_items: e.array(Tt),
|
|
900
916
|
mp_url: e.string().optional(),
|
|
901
917
|
mp_qrcode_url: e.string().optional()
|
|
902
918
|
})
|
|
903
|
-
}), xt =
|
|
904
|
-
...
|
|
919
|
+
}), xt = u.Invite, St = e.object({
|
|
920
|
+
...l.shape,
|
|
905
921
|
feature_type: e.string().enum(xt),
|
|
906
922
|
config: e.object({
|
|
907
923
|
share_url: e.string()
|
|
908
924
|
})
|
|
909
|
-
}), Lt =
|
|
910
|
-
...
|
|
925
|
+
}), Lt = u.InvitedRegister, Pt = e.object({
|
|
926
|
+
...l.shape,
|
|
911
927
|
feature_type: e.string().enum(Lt)
|
|
912
|
-
}), Et = e.string().enum(
|
|
928
|
+
}), Et = e.string().enum(V(j, "GiftCode", "LotteryTicket")), $t = u.Lottery, Ut = e.object({
|
|
913
929
|
reward_item_id: e.number(),
|
|
914
930
|
reward_item_name: e.string(),
|
|
915
931
|
reward_item_type: Et,
|
|
@@ -918,7 +934,7 @@ const V = {
|
|
|
918
934
|
reward_amount: e.number(),
|
|
919
935
|
reward_remaining_stock: e.number()
|
|
920
936
|
}), Ft = e.object({
|
|
921
|
-
...
|
|
937
|
+
...l.shape,
|
|
922
938
|
feature_type: e.string().enum($t),
|
|
923
939
|
config: e.object({
|
|
924
940
|
consume_item_id: e.number(),
|
|
@@ -928,21 +944,21 @@ const V = {
|
|
|
928
944
|
consume_item_desc: e.string().optional(),
|
|
929
945
|
rewards: e.array(Ut)
|
|
930
946
|
})
|
|
931
|
-
}), Dt =
|
|
932
|
-
...
|
|
947
|
+
}), Dt = u.LotteryDraw, It = e.object({
|
|
948
|
+
...l.shape,
|
|
933
949
|
feature_type: e.string().enum(Dt),
|
|
934
950
|
config: e.object({
|
|
935
951
|
draw_not_before: e.number(),
|
|
936
952
|
draw_not_after: e.number()
|
|
937
953
|
})
|
|
938
|
-
}), Gt =
|
|
939
|
-
...
|
|
954
|
+
}), Gt = u.Preregister, At = e.object({
|
|
955
|
+
...l.shape,
|
|
940
956
|
feature_type: e.string().enum(Gt)
|
|
941
|
-
}), Nt =
|
|
942
|
-
...
|
|
957
|
+
}), Nt = u.Quest, Ot = e.object({
|
|
958
|
+
...l.shape,
|
|
943
959
|
feature_type: e.string().enum(Nt),
|
|
944
960
|
config: e.object({
|
|
945
|
-
objective:
|
|
961
|
+
objective: re,
|
|
946
962
|
completion_value: e.number(),
|
|
947
963
|
team: e.object({
|
|
948
964
|
feature_id: e.number().optional(),
|
|
@@ -954,38 +970,38 @@ const V = {
|
|
|
954
970
|
required_matches: e.number().min(1).optional()
|
|
955
971
|
}).optional()
|
|
956
972
|
})
|
|
957
|
-
}), Bt =
|
|
958
|
-
...
|
|
973
|
+
}), Bt = u.Register, Mt = e.object({
|
|
974
|
+
...l.shape,
|
|
959
975
|
feature_type: e.string().enum(Bt)
|
|
960
|
-
}), Qt =
|
|
961
|
-
...
|
|
976
|
+
}), Qt = u.Share, Kt = e.object({
|
|
977
|
+
...l.shape,
|
|
962
978
|
feature_type: e.string().enum(Qt),
|
|
963
979
|
config: e.object({
|
|
964
980
|
share_platform: e.string(),
|
|
965
981
|
jump_url: e.string().optional(),
|
|
966
982
|
icon_url: e.string().optional()
|
|
967
983
|
})
|
|
968
|
-
}), Ht =
|
|
969
|
-
...
|
|
984
|
+
}), Ht = u.Subscribe, zt = e.object({
|
|
985
|
+
...l.shape,
|
|
970
986
|
feature_type: e.string().enum(Ht),
|
|
971
987
|
config: e.object({
|
|
972
988
|
weixin_template_ids: e.array(e.string())
|
|
973
989
|
})
|
|
974
|
-
}), Jt =
|
|
975
|
-
...
|
|
990
|
+
}), Jt = u.Survey, Xt = e.object({
|
|
991
|
+
...l.shape,
|
|
976
992
|
feature_type: e.string().enum(Jt),
|
|
977
993
|
config: e.object({
|
|
978
994
|
survey_id: e.string(),
|
|
979
995
|
survey_url: e.string()
|
|
980
996
|
})
|
|
981
|
-
}), Yt =
|
|
982
|
-
...
|
|
997
|
+
}), Yt = u.Team, Zt = e.object({
|
|
998
|
+
...l.shape,
|
|
983
999
|
feature_type: e.string().enum(Yt),
|
|
984
1000
|
config: e.object({
|
|
985
1001
|
max_members: e.number().min(1),
|
|
986
1002
|
min_members: e.number().min(1)
|
|
987
1003
|
})
|
|
988
|
-
}), Wt =
|
|
1004
|
+
}), Wt = u.Vote, en = e.object({
|
|
989
1005
|
sn: e.string(),
|
|
990
1006
|
name: e.string(),
|
|
991
1007
|
img_urls: e.array(e.string()).optional(),
|
|
@@ -996,7 +1012,7 @@ const V = {
|
|
|
996
1012
|
finalists: e.bool(),
|
|
997
1013
|
last_vote_time: e.number()
|
|
998
1014
|
}), tn = e.object({
|
|
999
|
-
...
|
|
1015
|
+
...l.shape,
|
|
1000
1016
|
feature_type: e.string().enum(Wt),
|
|
1001
1017
|
config: e.object({
|
|
1002
1018
|
vote_feature_ids: e.array(e.number()),
|
|
@@ -1004,7 +1020,7 @@ const V = {
|
|
|
1004
1020
|
finalists_amount: e.number(),
|
|
1005
1021
|
source: ot,
|
|
1006
1022
|
options: e.array(en),
|
|
1007
|
-
rewards: e.array(
|
|
1023
|
+
rewards: e.array(D)
|
|
1008
1024
|
})
|
|
1009
1025
|
}), nn = e.union(
|
|
1010
1026
|
_t,
|
|
@@ -1033,10 +1049,10 @@ const V = {
|
|
|
1033
1049
|
until: e.number(),
|
|
1034
1050
|
visit_count: e.number().optional(),
|
|
1035
1051
|
features: e.array(nn)
|
|
1036
|
-
}).lock(),
|
|
1037
|
-
order_total_amount:
|
|
1038
|
-
cashback_total_amount:
|
|
1039
|
-
game_item_count:
|
|
1052
|
+
}).lock(), S = e.union(e.string().pattern("NumberString", /^\d+$/), e.number()), on = e.object({
|
|
1053
|
+
order_total_amount: S,
|
|
1054
|
+
cashback_total_amount: S,
|
|
1055
|
+
game_item_count: S
|
|
1040
1056
|
}), an = e.object({
|
|
1041
1057
|
activation_key: e.string().disallow("")
|
|
1042
1058
|
}), sn = e.object({
|
|
@@ -1047,17 +1063,17 @@ const V = {
|
|
|
1047
1063
|
avatar_url: e.string().optional()
|
|
1048
1064
|
}), un = e.object({
|
|
1049
1065
|
lottery_count: e.number()
|
|
1050
|
-
}),
|
|
1066
|
+
}), oe = e.object({
|
|
1051
1067
|
reward_id: e.number(),
|
|
1052
1068
|
reward_item_id: e.number(),
|
|
1053
|
-
reward_source:
|
|
1069
|
+
reward_source: F,
|
|
1054
1070
|
reward_item_name: e.string(),
|
|
1055
|
-
reward_item_type:
|
|
1071
|
+
reward_item_type: te,
|
|
1056
1072
|
reward_item_icon_url: e.string(),
|
|
1057
1073
|
reward_item_desc: e.string().optional(),
|
|
1058
1074
|
reward_item_rating: e.number(),
|
|
1059
1075
|
reward_amount: e.number(),
|
|
1060
|
-
reward_status:
|
|
1076
|
+
reward_status: U,
|
|
1061
1077
|
event_id: e.number(),
|
|
1062
1078
|
event_name: e.string(),
|
|
1063
1079
|
feature_id: e.number(),
|
|
@@ -1067,22 +1083,22 @@ const V = {
|
|
|
1067
1083
|
// https://kdocs.cn/l/ckWFDcOsYEUA?linkname=merUzJsVYH
|
|
1068
1084
|
// 后续会格式化为具体的类型,此处的校验需要对应增加
|
|
1069
1085
|
extra_data: e.record(e.unknown()).optional()
|
|
1070
|
-
}), ln = e.string().enum(
|
|
1086
|
+
}), ln = e.string().enum(v.Unknown, v.Pending), mn = e.union(
|
|
1071
1087
|
e.object({
|
|
1072
1088
|
ticket: e.string(),
|
|
1073
1089
|
status: ln
|
|
1074
1090
|
}),
|
|
1075
1091
|
e.object({
|
|
1076
1092
|
ticket: e.string(),
|
|
1077
|
-
status: e.string().enum(
|
|
1078
|
-
reward:
|
|
1093
|
+
status: e.string().enum(V(v, "Unknown", "Pending")),
|
|
1094
|
+
reward: oe
|
|
1079
1095
|
})
|
|
1080
1096
|
).satisfies(), dn = e.object({
|
|
1081
1097
|
tickets: e.array(mn)
|
|
1082
1098
|
}), gn = e.object({
|
|
1083
1099
|
platforms: e.array(e.string())
|
|
1084
1100
|
}), pn = e.object({
|
|
1085
|
-
objective:
|
|
1101
|
+
objective: re,
|
|
1086
1102
|
progress: e.number(),
|
|
1087
1103
|
completion_value: e.number().optional(),
|
|
1088
1104
|
team: e.object({
|
|
@@ -1131,7 +1147,7 @@ const V = {
|
|
|
1131
1147
|
comment: e.string(),
|
|
1132
1148
|
video_note: e.number(),
|
|
1133
1149
|
created_at: e.number()
|
|
1134
|
-
}),
|
|
1150
|
+
}), I = e.union(
|
|
1135
1151
|
gn,
|
|
1136
1152
|
un,
|
|
1137
1153
|
yn,
|
|
@@ -1147,31 +1163,31 @@ const V = {
|
|
|
1147
1163
|
an,
|
|
1148
1164
|
e.custom(
|
|
1149
1165
|
"EmptyObject",
|
|
1150
|
-
(
|
|
1166
|
+
(a) => R(a) && Object.keys(a).length === 0
|
|
1151
1167
|
)
|
|
1152
1168
|
).satisfies().lock(), vn = e.object({
|
|
1153
1169
|
reward_id: e.number(),
|
|
1154
1170
|
reward_item_id: e.number(),
|
|
1155
|
-
reward_item_type:
|
|
1171
|
+
reward_item_type: ne,
|
|
1156
1172
|
reward_count: e.number(),
|
|
1157
|
-
reward_status:
|
|
1158
|
-
reward_source:
|
|
1173
|
+
reward_status: ie,
|
|
1174
|
+
reward_source: F,
|
|
1159
1175
|
reward_item_name: e.string(),
|
|
1160
1176
|
reward_item_icon_url: e.string(),
|
|
1161
1177
|
reward_item_desc: e.string().optional(),
|
|
1162
1178
|
reward_item_rating: e.number(),
|
|
1163
1179
|
receive_time: e.number(),
|
|
1164
|
-
extra_data: e.union(...
|
|
1180
|
+
extra_data: e.union(...I.validators, e.record(e.unknown())).satisfies().optional()
|
|
1165
1181
|
}), Cn = e.object({
|
|
1166
1182
|
reward_id: e.number(),
|
|
1167
1183
|
reward_item_id: e.number(),
|
|
1168
1184
|
reward_item_name: e.string(),
|
|
1169
|
-
reward_item_type:
|
|
1185
|
+
reward_item_type: ne,
|
|
1170
1186
|
reward_item_icon_url: e.string(),
|
|
1171
1187
|
reward_item_desc: e.string().optional(),
|
|
1172
1188
|
reward_amount: e.number(),
|
|
1173
|
-
reward_status:
|
|
1174
|
-
reward_source:
|
|
1189
|
+
reward_status: ie,
|
|
1190
|
+
reward_source: F,
|
|
1175
1191
|
extra_data: e.record(e.unknown()).optional()
|
|
1176
1192
|
}), Rn = e.object({
|
|
1177
1193
|
engagement_id: e.number(),
|
|
@@ -1179,7 +1195,7 @@ const V = {
|
|
|
1179
1195
|
event_id: e.number(),
|
|
1180
1196
|
feature_id: e.number(),
|
|
1181
1197
|
sequence: e.number(),
|
|
1182
|
-
data:
|
|
1198
|
+
data: I.clone().optional(),
|
|
1183
1199
|
server_id: e.string().optional(),
|
|
1184
1200
|
role_id: e.string().optional(),
|
|
1185
1201
|
created_at: e.number(),
|
|
@@ -1197,50 +1213,50 @@ const V = {
|
|
|
1197
1213
|
engagement_id: e.number(),
|
|
1198
1214
|
sequence: e.number(),
|
|
1199
1215
|
feature_id: e.number(),
|
|
1200
|
-
data:
|
|
1216
|
+
data: I.clone().optional()
|
|
1201
1217
|
}).optional(),
|
|
1202
1218
|
rewards: e.array(Cn).optional(),
|
|
1203
1219
|
scan: e.bool().optional()
|
|
1204
1220
|
}), qn = e.object({
|
|
1205
1221
|
reward_id: e.number(),
|
|
1206
|
-
reward_status:
|
|
1207
|
-
}), xn = e.guard(rn), Sn = e.guard(Vn),
|
|
1222
|
+
reward_status: U
|
|
1223
|
+
}), xn = e.guard(rn), Sn = e.guard(Vn), L = s({ count: e.number() }), Ln = s({ first_visit: e.bool() }), Pn = s({
|
|
1208
1224
|
engagements: e.union(e.array(kn), e.array(fn))
|
|
1209
|
-
}), En =
|
|
1225
|
+
}), En = s({
|
|
1210
1226
|
status: e.array(jn)
|
|
1211
|
-
}), $n =
|
|
1227
|
+
}), $n = s({
|
|
1212
1228
|
engagements: e.array(Rn),
|
|
1213
1229
|
next_token: e.string().optional()
|
|
1214
|
-
}), Un = e.guard(Tn), Fn =
|
|
1230
|
+
}), Un = e.guard(Tn), Fn = s({
|
|
1215
1231
|
claimed_items: e.array(qn)
|
|
1216
|
-
}), Dn =
|
|
1217
|
-
reward_status:
|
|
1218
|
-
}), In =
|
|
1219
|
-
user_rewards: e.array(
|
|
1232
|
+
}), Dn = s({
|
|
1233
|
+
reward_status: U
|
|
1234
|
+
}), In = s({
|
|
1235
|
+
user_rewards: e.array(oe),
|
|
1220
1236
|
next_token: e.string().optional()
|
|
1221
|
-
}), Gn =
|
|
1237
|
+
}), Gn = s({
|
|
1222
1238
|
scene: e.string()
|
|
1223
|
-
}), An =
|
|
1239
|
+
}), An = s({
|
|
1224
1240
|
params: e.string()
|
|
1225
|
-
}), Nn =
|
|
1241
|
+
}), Nn = s({
|
|
1226
1242
|
img: e.string()
|
|
1227
1243
|
});
|
|
1228
1244
|
class Pr {
|
|
1229
|
-
constructor(t,
|
|
1245
|
+
constructor(t, r) {
|
|
1230
1246
|
m(this, "token");
|
|
1231
1247
|
m(this, "event", 0);
|
|
1232
1248
|
m(this, "req");
|
|
1233
|
-
this.token = t, this.event = +
|
|
1249
|
+
this.token = t, this.event = +r, this.req = t.req;
|
|
1234
1250
|
}
|
|
1235
1251
|
/**
|
|
1236
1252
|
* 根据手机号白名单,检查手机号是否允许登录某个游戏
|
|
1237
1253
|
*
|
|
1238
1254
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
|
|
1239
1255
|
*/
|
|
1240
|
-
async verifyMobileAllowed(t,
|
|
1256
|
+
async verifyMobileAllowed(t, r, n) {
|
|
1241
1257
|
const { data: i } = await this.req.get("verify-mobile-allowed", Sn, {
|
|
1242
|
-
...
|
|
1243
|
-
params: { game_id: t, mobile:
|
|
1258
|
+
...n,
|
|
1259
|
+
params: { game_id: t, mobile: r }
|
|
1244
1260
|
});
|
|
1245
1261
|
return i;
|
|
1246
1262
|
}
|
|
@@ -1250,32 +1266,32 @@ class Pr {
|
|
|
1250
1266
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
|
|
1251
1267
|
*/
|
|
1252
1268
|
async getConfig(t) {
|
|
1253
|
-
const { data:
|
|
1254
|
-
return
|
|
1269
|
+
const { data: r } = await this.req.get(`event/${this.event}/event-config`, xn, t);
|
|
1270
|
+
return r;
|
|
1255
1271
|
}
|
|
1256
1272
|
/**
|
|
1257
1273
|
* 获取某个玩法参与用户数量
|
|
1258
1274
|
*
|
|
1259
1275
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1260
1276
|
*/
|
|
1261
|
-
async getEngagementsUserCount(t,
|
|
1262
|
-
const { data:
|
|
1263
|
-
...
|
|
1277
|
+
async getEngagementsUserCount(t, r) {
|
|
1278
|
+
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, L, {
|
|
1279
|
+
...r,
|
|
1264
1280
|
params: { feature_id: t, type: "user" }
|
|
1265
1281
|
});
|
|
1266
|
-
return (
|
|
1282
|
+
return (n == null ? void 0 : n.count) ?? null;
|
|
1267
1283
|
}
|
|
1268
1284
|
/**
|
|
1269
1285
|
* 获取某个玩法参与次数
|
|
1270
1286
|
*
|
|
1271
1287
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1272
1288
|
*/
|
|
1273
|
-
async getEngagementsCount(t,
|
|
1274
|
-
const { data:
|
|
1275
|
-
...
|
|
1289
|
+
async getEngagementsCount(t, r) {
|
|
1290
|
+
const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, L, {
|
|
1291
|
+
...r,
|
|
1276
1292
|
params: { feature_id: t, type: "engagement" }
|
|
1277
1293
|
});
|
|
1278
|
-
return (
|
|
1294
|
+
return (n == null ? void 0 : n.count) ?? null;
|
|
1279
1295
|
}
|
|
1280
1296
|
/**
|
|
1281
1297
|
* 获取某个玩法的参与记录(和特定用户无关)
|
|
@@ -1284,27 +1300,28 @@ class Pr {
|
|
|
1284
1300
|
*
|
|
1285
1301
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=THtZ4ewIQW
|
|
1286
1302
|
*/
|
|
1287
|
-
async getEngagements(t,
|
|
1288
|
-
const { data:
|
|
1289
|
-
...
|
|
1303
|
+
async getEngagements(t, r) {
|
|
1304
|
+
const { data: n } = await this.req.get(`event/${this.event}/feature-engagements`, Pn, {
|
|
1305
|
+
...r,
|
|
1290
1306
|
params: { feature_id: t }
|
|
1291
1307
|
});
|
|
1292
|
-
return (
|
|
1308
|
+
return (n == null ? void 0 : n.engagements) || [];
|
|
1293
1309
|
}
|
|
1294
1310
|
/**
|
|
1295
1311
|
* 用户访问某个活动或玩法
|
|
1296
1312
|
*
|
|
1297
1313
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=DWtJrnrBCn
|
|
1298
1314
|
*/
|
|
1299
|
-
async visit(t,
|
|
1315
|
+
async visit(t, r) {
|
|
1300
1316
|
await this.token.autoLogin();
|
|
1301
|
-
const { data:
|
|
1317
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1302
1318
|
`event/${this.event}/visit`,
|
|
1303
|
-
|
|
1319
|
+
c(t || {}),
|
|
1304
1320
|
Ln,
|
|
1305
|
-
|
|
1321
|
+
r
|
|
1306
1322
|
);
|
|
1307
|
-
return
|
|
1323
|
+
return n ?? {
|
|
1324
|
+
message: o,
|
|
1308
1325
|
error: i
|
|
1309
1326
|
};
|
|
1310
1327
|
}
|
|
@@ -1317,14 +1334,14 @@ class Pr {
|
|
|
1317
1334
|
*
|
|
1318
1335
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WzX5BrMNpL
|
|
1319
1336
|
*/
|
|
1320
|
-
async getUserFeatureStatus(t,
|
|
1337
|
+
async getUserFeatureStatus(t, r) {
|
|
1321
1338
|
if (!await this.token.autoLogin()) return [];
|
|
1322
|
-
const { data:
|
|
1323
|
-
...
|
|
1339
|
+
const { data: n } = await this.req.get("event/user-feature-status", En, {
|
|
1340
|
+
...r,
|
|
1324
1341
|
message: !1,
|
|
1325
|
-
params:
|
|
1342
|
+
params: c({ ...t, event_id: this.event })
|
|
1326
1343
|
});
|
|
1327
|
-
return (
|
|
1344
|
+
return (n == null ? void 0 : n.status) || [];
|
|
1328
1345
|
}
|
|
1329
1346
|
/**
|
|
1330
1347
|
* 获取当前登录用户参与某个玩法的记录
|
|
@@ -1333,13 +1350,17 @@ class Pr {
|
|
|
1333
1350
|
*
|
|
1334
1351
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=NFDdV1dwWb
|
|
1335
1352
|
*/
|
|
1336
|
-
async getUserEngagements(t,
|
|
1337
|
-
if (!await this.token.autoLogin())
|
|
1353
|
+
async getUserEngagements(t, r, n) {
|
|
1354
|
+
if (!await this.token.autoLogin())
|
|
1355
|
+
return {
|
|
1356
|
+
engagements: [],
|
|
1357
|
+
next_token: ""
|
|
1358
|
+
};
|
|
1338
1359
|
const { data: i } = await this.req.get("event/user-engagements", $n, {
|
|
1339
|
-
...
|
|
1340
|
-
params:
|
|
1360
|
+
...n,
|
|
1361
|
+
params: c({
|
|
1341
1362
|
max_results: 20,
|
|
1342
|
-
...
|
|
1363
|
+
...r,
|
|
1343
1364
|
event_id: this.event,
|
|
1344
1365
|
feature_id: t
|
|
1345
1366
|
})
|
|
@@ -1358,20 +1379,21 @@ class Pr {
|
|
|
1358
1379
|
*
|
|
1359
1380
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=vuOyrcry3S
|
|
1360
1381
|
*/
|
|
1361
|
-
async engage(t,
|
|
1382
|
+
async engage(t, r, n, i) {
|
|
1362
1383
|
await this.token.autoLogin();
|
|
1363
|
-
const { data:
|
|
1384
|
+
const { data: o, code: p, message: d } = await this.req.post(
|
|
1364
1385
|
`event/${this.event}/engage`,
|
|
1365
|
-
|
|
1386
|
+
c({
|
|
1366
1387
|
feature_id: t,
|
|
1367
|
-
engagement:
|
|
1368
|
-
...
|
|
1388
|
+
engagement: r,
|
|
1389
|
+
...n
|
|
1369
1390
|
}),
|
|
1370
1391
|
Un,
|
|
1371
1392
|
i
|
|
1372
1393
|
);
|
|
1373
|
-
return
|
|
1374
|
-
|
|
1394
|
+
return o && o.rewards && (o.rewards = o.rewards.map((h) => (h.reward_status = h.reward_status === $.UnclaimedErr ? $.Unclaimed : h.reward_status, h))), o ?? {
|
|
1395
|
+
message: d,
|
|
1396
|
+
error: p
|
|
1375
1397
|
// 没有可领取的激活码
|
|
1376
1398
|
};
|
|
1377
1399
|
}
|
|
@@ -1380,15 +1402,16 @@ class Pr {
|
|
|
1380
1402
|
*
|
|
1381
1403
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=lCGuqgvUDP
|
|
1382
1404
|
*/
|
|
1383
|
-
async claimRewards(t,
|
|
1405
|
+
async claimRewards(t, r) {
|
|
1384
1406
|
await this.token.autoLogin();
|
|
1385
|
-
const { data:
|
|
1407
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1386
1408
|
"event/claim-rewards",
|
|
1387
|
-
|
|
1409
|
+
c(t),
|
|
1388
1410
|
Fn,
|
|
1389
|
-
|
|
1390
|
-
),
|
|
1391
|
-
return
|
|
1411
|
+
r
|
|
1412
|
+
), p = n == null ? void 0 : n.claimed_items;
|
|
1413
|
+
return p ? p.map((d) => (d.reward_status = d.reward_status === b.UnclaimedErr ? b.Unclaimed : d.reward_status, d)) : {
|
|
1414
|
+
message: o,
|
|
1392
1415
|
error: i
|
|
1393
1416
|
};
|
|
1394
1417
|
}
|
|
@@ -1397,15 +1420,16 @@ class Pr {
|
|
|
1397
1420
|
*
|
|
1398
1421
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=aQLhlOAB4Q
|
|
1399
1422
|
*/
|
|
1400
|
-
async claimWeixinHongbao(t,
|
|
1423
|
+
async claimWeixinHongbao(t, r) {
|
|
1401
1424
|
await this.token.autoLogin();
|
|
1402
|
-
const { data:
|
|
1425
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1403
1426
|
"event/claim-weixin-hongbao",
|
|
1404
1427
|
{ reward_id: t },
|
|
1405
1428
|
Dn,
|
|
1406
|
-
|
|
1429
|
+
r
|
|
1407
1430
|
);
|
|
1408
|
-
return
|
|
1431
|
+
return n ? (n.reward_status = n.reward_status === b.UnclaimedErr ? b.Unclaimed : n.reward_status, n) : {
|
|
1432
|
+
message: o,
|
|
1409
1433
|
error: i
|
|
1410
1434
|
};
|
|
1411
1435
|
}
|
|
@@ -1414,18 +1438,17 @@ class Pr {
|
|
|
1414
1438
|
*
|
|
1415
1439
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=B4xwTbDzhn
|
|
1416
1440
|
*/
|
|
1417
|
-
async verifyActivationKey(t,
|
|
1441
|
+
async verifyActivationKey(t, r) {
|
|
1418
1442
|
if (!this.token.isLoggedIn)
|
|
1419
1443
|
return { error: "not_logged_in" };
|
|
1420
|
-
const { ok:
|
|
1444
|
+
const { ok: n, code: i, message: o } = await this.req.post(
|
|
1421
1445
|
"verify-activation-key",
|
|
1422
|
-
{
|
|
1423
|
-
activation_key: t
|
|
1424
|
-
},
|
|
1446
|
+
{ activation_key: t },
|
|
1425
1447
|
null,
|
|
1426
|
-
{ message: !1, ...
|
|
1448
|
+
{ message: !1, ...r }
|
|
1427
1449
|
);
|
|
1428
|
-
return
|
|
1450
|
+
return n || {
|
|
1451
|
+
message: o,
|
|
1429
1452
|
error: i
|
|
1430
1453
|
};
|
|
1431
1454
|
}
|
|
@@ -1434,17 +1457,21 @@ class Pr {
|
|
|
1434
1457
|
*
|
|
1435
1458
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=qj12eIgYQG
|
|
1436
1459
|
*/
|
|
1437
|
-
async getUserRewards(t,
|
|
1438
|
-
if (!await this.token.autoLogin())
|
|
1439
|
-
|
|
1460
|
+
async getUserRewards(t, r) {
|
|
1461
|
+
if (!await this.token.autoLogin())
|
|
1462
|
+
return {
|
|
1463
|
+
user_rewards: [],
|
|
1464
|
+
next_token: ""
|
|
1465
|
+
};
|
|
1466
|
+
const { data: n } = await this.req.post(
|
|
1440
1467
|
"event/user-rewards",
|
|
1441
|
-
|
|
1468
|
+
c({ max_results: 20, ...t, event_id: this.event }),
|
|
1442
1469
|
In,
|
|
1443
|
-
|
|
1470
|
+
r
|
|
1444
1471
|
);
|
|
1445
1472
|
return {
|
|
1446
|
-
user_rewards: ((
|
|
1447
|
-
next_token: (
|
|
1473
|
+
user_rewards: ((n == null ? void 0 : n.user_rewards) || []).map((i) => (i.reward_status = i.reward_status === b.UnclaimedErr ? b.Unclaimed : i.reward_status, i)),
|
|
1474
|
+
next_token: (n == null ? void 0 : n.next_token) || ""
|
|
1448
1475
|
};
|
|
1449
1476
|
}
|
|
1450
1477
|
/**
|
|
@@ -1452,23 +1479,23 @@ class Pr {
|
|
|
1452
1479
|
*
|
|
1453
1480
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=mnGCTeTgMb
|
|
1454
1481
|
*/
|
|
1455
|
-
async getUserItemCount(t,
|
|
1482
|
+
async getUserItemCount(t, r) {
|
|
1456
1483
|
if (!await this.token.autoLogin()) return null;
|
|
1457
|
-
const { data:
|
|
1458
|
-
...
|
|
1484
|
+
const { data: n } = await this.req.get(`event/${this.event}/user-item-count`, L, {
|
|
1485
|
+
...r,
|
|
1459
1486
|
params: { item_id: t }
|
|
1460
1487
|
});
|
|
1461
|
-
return (
|
|
1488
|
+
return (n == null ? void 0 : n.count) ?? null;
|
|
1462
1489
|
}
|
|
1463
1490
|
/**
|
|
1464
|
-
*
|
|
1491
|
+
* 填写实物奖励收货地址,返回 null 表示未登录
|
|
1465
1492
|
*
|
|
1466
1493
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=QIwGhnaexb
|
|
1467
1494
|
*/
|
|
1468
|
-
async submitUserRewardAddress(t,
|
|
1495
|
+
async submitUserRewardAddress(t, r) {
|
|
1469
1496
|
if (!await this.token.autoLogin()) return null;
|
|
1470
|
-
const { ok:
|
|
1471
|
-
return
|
|
1497
|
+
const { ok: n } = await this.req.post(`event/${this.event}/user-reward-address`, t, null, r);
|
|
1498
|
+
return n;
|
|
1472
1499
|
}
|
|
1473
1500
|
/**
|
|
1474
1501
|
* 小程序码携带参数最多 32 个可见字符,若前端携带参数过长,则将参数保存在 api 中,并返回符合小程序码要求的 scene
|
|
@@ -1477,13 +1504,13 @@ class Pr {
|
|
|
1477
1504
|
*
|
|
1478
1505
|
* @param params - 前端扫描二维码打开小程序所需参数
|
|
1479
1506
|
*/
|
|
1480
|
-
async getUnlimitQrcodeScene(t,
|
|
1507
|
+
async getUnlimitQrcodeScene(t, r) {
|
|
1481
1508
|
if (!await this.token.autoLogin()) return null;
|
|
1482
|
-
const { data:
|
|
1483
|
-
...
|
|
1509
|
+
const { data: n } = await this.req.get("event/unlimit-qrcode-scene", Gn, {
|
|
1510
|
+
...r,
|
|
1484
1511
|
params: { params: t }
|
|
1485
1512
|
});
|
|
1486
|
-
return (
|
|
1513
|
+
return (n == null ? void 0 : n.scene) ?? null;
|
|
1487
1514
|
}
|
|
1488
1515
|
/**
|
|
1489
1516
|
* 根据小程序码携带 scene 值,获取对应的前端所需参数
|
|
@@ -1492,27 +1519,27 @@ class Pr {
|
|
|
1492
1519
|
*
|
|
1493
1520
|
* @param scene - 小程序码 scene 值
|
|
1494
1521
|
*/
|
|
1495
|
-
async getParamsByQrcodeScene(t,
|
|
1496
|
-
const { data:
|
|
1497
|
-
...
|
|
1522
|
+
async getParamsByQrcodeScene(t, r) {
|
|
1523
|
+
const { data: n } = await this.req.get("event/params-by-qrcode-scene", An, {
|
|
1524
|
+
...r,
|
|
1498
1525
|
params: { scene: t }
|
|
1499
1526
|
});
|
|
1500
|
-
return (
|
|
1527
|
+
return (n == null ? void 0 : n.params) ?? null;
|
|
1501
1528
|
}
|
|
1502
1529
|
/**
|
|
1503
1530
|
* 生成不限制的带参数的小程序码(dataURI 格式的小程序码图片)
|
|
1504
1531
|
*
|
|
1505
1532
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=Rvmoq8iIy0
|
|
1506
1533
|
*/
|
|
1507
|
-
async generateUnlimitQrcode(t,
|
|
1534
|
+
async generateUnlimitQrcode(t, r) {
|
|
1508
1535
|
if (!await this.token.autoLogin()) return null;
|
|
1509
|
-
const { data:
|
|
1536
|
+
const { data: n } = await this.req.post(
|
|
1510
1537
|
"event/unlimit-qrcode",
|
|
1511
|
-
|
|
1538
|
+
c(t),
|
|
1512
1539
|
Nn,
|
|
1513
|
-
|
|
1540
|
+
r
|
|
1514
1541
|
);
|
|
1515
|
-
return (
|
|
1542
|
+
return (n == null ? void 0 : n.img) ?? null;
|
|
1516
1543
|
}
|
|
1517
1544
|
}
|
|
1518
1545
|
const On = {
|
|
@@ -1529,7 +1556,7 @@ const On = {
|
|
|
1529
1556
|
Failed: "failed",
|
|
1530
1557
|
/** 嫌疑(仅自己可见) */
|
|
1531
1558
|
Suspect: "suspect"
|
|
1532
|
-
},
|
|
1559
|
+
}, ae = e.string().enum(Mn).lock(), Qn = {
|
|
1533
1560
|
/** 系统通知 */
|
|
1534
1561
|
System: "system",
|
|
1535
1562
|
/** 评论我的 */
|
|
@@ -1561,7 +1588,7 @@ const On = {
|
|
|
1561
1588
|
ReplyLiked: "reply_liked",
|
|
1562
1589
|
/** 回复被删除 */
|
|
1563
1590
|
ReplyDeleted: "reply_deleted"
|
|
1564
|
-
}, Kn = e.string().enum(g).lock(),
|
|
1591
|
+
}, Kn = e.string().enum(g).lock(), se = e.object({
|
|
1565
1592
|
forum_id: e.number(),
|
|
1566
1593
|
icon_url: e.string(),
|
|
1567
1594
|
name: e.string(),
|
|
@@ -1569,16 +1596,16 @@ const On = {
|
|
|
1569
1596
|
sort: e.number(),
|
|
1570
1597
|
mode: Bn,
|
|
1571
1598
|
member_ids: e.array(e.number())
|
|
1572
|
-
}).lock(),
|
|
1599
|
+
}).lock(), G = e.object({
|
|
1573
1600
|
topic_id: e.number(),
|
|
1574
1601
|
cover_url: e.string(),
|
|
1575
1602
|
name: e.string(),
|
|
1576
1603
|
description: e.string(),
|
|
1577
1604
|
tags: e.array(e.string()),
|
|
1578
1605
|
post_num: e.number()
|
|
1579
|
-
}).lock(),
|
|
1606
|
+
}).lock(), A = e.object({
|
|
1580
1607
|
post_id: e.number(),
|
|
1581
|
-
forum:
|
|
1608
|
+
forum: se,
|
|
1582
1609
|
posted_by: e.string(),
|
|
1583
1610
|
nickname: e.string(),
|
|
1584
1611
|
avatar_url: e.string(),
|
|
@@ -1590,13 +1617,13 @@ const On = {
|
|
|
1590
1617
|
comments_num: e.number(),
|
|
1591
1618
|
liked: e.bool(),
|
|
1592
1619
|
image_urls: e.array(e.string()),
|
|
1593
|
-
topics: e.array(
|
|
1620
|
+
topics: e.array(G),
|
|
1594
1621
|
event_ids: e.array(e.number()),
|
|
1595
1622
|
is_pinned: e.bool(),
|
|
1596
1623
|
is_highlighted: e.bool(),
|
|
1597
|
-
status:
|
|
1624
|
+
status: ae,
|
|
1598
1625
|
create_time: e.number()
|
|
1599
|
-
}).lock(),
|
|
1626
|
+
}).lock(), ce = e.object({
|
|
1600
1627
|
err_msg: e.string().optional()
|
|
1601
1628
|
}).lock(), Hn = e.object({
|
|
1602
1629
|
reply_id: e.number(),
|
|
@@ -1604,7 +1631,7 @@ const On = {
|
|
|
1604
1631
|
replied_by: e.string(),
|
|
1605
1632
|
nickname: e.string(),
|
|
1606
1633
|
avatar_url: e.string()
|
|
1607
|
-
}).lock(),
|
|
1634
|
+
}).lock(), T = e.object({
|
|
1608
1635
|
reply_id: e.number(),
|
|
1609
1636
|
comment_id: e.number(),
|
|
1610
1637
|
comment_content: e.string().optional(),
|
|
@@ -1619,7 +1646,7 @@ const On = {
|
|
|
1619
1646
|
liked: e.bool(),
|
|
1620
1647
|
reply_to: Hn,
|
|
1621
1648
|
create_time: e.number()
|
|
1622
|
-
}).lock(),
|
|
1649
|
+
}).lock(), C = e.object({
|
|
1623
1650
|
comment_id: e.number(),
|
|
1624
1651
|
post_id: e.number(),
|
|
1625
1652
|
post_subject: e.string().optional(),
|
|
@@ -1637,8 +1664,8 @@ const On = {
|
|
|
1637
1664
|
liked: e.bool(),
|
|
1638
1665
|
image_url: e.string(),
|
|
1639
1666
|
create_time: e.number(),
|
|
1640
|
-
status:
|
|
1641
|
-
replies: e.array(
|
|
1667
|
+
status: ae,
|
|
1668
|
+
replies: e.array(T).optional()
|
|
1642
1669
|
}).lock(), zn = e.object({
|
|
1643
1670
|
image_url: e.string(),
|
|
1644
1671
|
upload_url: e.string(),
|
|
@@ -1654,15 +1681,15 @@ const On = {
|
|
|
1654
1681
|
}).lock(), Jn = e.object({
|
|
1655
1682
|
system_message_subject: e.string(),
|
|
1656
1683
|
system_message_content: e.string()
|
|
1657
|
-
}).lock(),
|
|
1684
|
+
}).lock(), N = e.object({
|
|
1658
1685
|
post_id: e.number(),
|
|
1659
1686
|
post_subject: e.string(),
|
|
1660
1687
|
post_summary: e.string(),
|
|
1661
1688
|
post_image_url: e.string()
|
|
1662
|
-
}).lock(),
|
|
1689
|
+
}).lock(), q = e.object({
|
|
1663
1690
|
comment_id: e.number(),
|
|
1664
1691
|
comment_content: e.string()
|
|
1665
|
-
}).lock(),
|
|
1692
|
+
}).lock(), O = e.object({
|
|
1666
1693
|
reply_id: e.number(),
|
|
1667
1694
|
reply_content: e.string()
|
|
1668
1695
|
}).lock(), Xn = e.object({
|
|
@@ -1671,7 +1698,7 @@ const On = {
|
|
|
1671
1698
|
notification_type: e.string().enum(g.System)
|
|
1672
1699
|
}), Yn = e.object({
|
|
1673
1700
|
...f.shape,
|
|
1674
|
-
...
|
|
1701
|
+
...N.shape,
|
|
1675
1702
|
notification_type: e.string().enum(
|
|
1676
1703
|
g.PostPinned,
|
|
1677
1704
|
g.PostHighlighted,
|
|
@@ -1680,30 +1707,30 @@ const On = {
|
|
|
1680
1707
|
)
|
|
1681
1708
|
}), Zn = e.object({
|
|
1682
1709
|
...f.shape,
|
|
1683
|
-
...
|
|
1684
|
-
...
|
|
1710
|
+
...N.shape,
|
|
1711
|
+
...q.shape,
|
|
1685
1712
|
notification_type: e.string().enum(g.PostCommented)
|
|
1686
1713
|
}), Wn = e.object({
|
|
1687
1714
|
...f.shape,
|
|
1688
|
-
...
|
|
1689
|
-
...
|
|
1715
|
+
...q.shape,
|
|
1716
|
+
...O.shape,
|
|
1690
1717
|
notification_type: e.string().enum(g.CommentReplied)
|
|
1691
1718
|
}), er = e.object({
|
|
1692
1719
|
...f.shape,
|
|
1693
|
-
...
|
|
1694
|
-
...
|
|
1720
|
+
...q.shape,
|
|
1721
|
+
...N.shape,
|
|
1695
1722
|
notification_type: e.string().enum(g.CommentLiked, g.CommentDeleted)
|
|
1696
1723
|
}), tr = e.object({
|
|
1697
1724
|
...f.shape,
|
|
1698
|
-
...
|
|
1725
|
+
...O.shape,
|
|
1699
1726
|
notification_type: e.string().enum(g.ReplyReplied),
|
|
1700
1727
|
comment_id: e.number(),
|
|
1701
1728
|
reply_to_reply_id: e.number(),
|
|
1702
1729
|
reply_to_reply_content: e.string()
|
|
1703
1730
|
}), nr = e.object({
|
|
1704
1731
|
...f.shape,
|
|
1705
|
-
...
|
|
1706
|
-
...
|
|
1732
|
+
...O.shape,
|
|
1733
|
+
...q.shape,
|
|
1707
1734
|
notification_type: e.string().enum(g.ReplyLiked, g.ReplyDeleted)
|
|
1708
1735
|
}), rr = e.union(
|
|
1709
1736
|
Xn,
|
|
@@ -1713,25 +1740,25 @@ const On = {
|
|
|
1713
1740
|
er,
|
|
1714
1741
|
tr,
|
|
1715
1742
|
nr
|
|
1716
|
-
).satisfies().lock(), ir =
|
|
1717
|
-
posts: e.array(
|
|
1743
|
+
).satisfies().lock(), ir = s({ forums: e.array(se) }), or = s({ topics: e.array(G) }), ar = s({ topic: G }), sr = s({ post: A }), z = s({
|
|
1744
|
+
posts: e.array(A),
|
|
1718
1745
|
next_token: e.string().optional()
|
|
1719
|
-
}), cr =
|
|
1720
|
-
replies: e.array(
|
|
1746
|
+
}), cr = s({ post: A, antispam: ce }), ur = s({
|
|
1747
|
+
replies: e.array(T),
|
|
1721
1748
|
next_token: e.string().optional()
|
|
1722
|
-
}), lr =
|
|
1723
|
-
reply:
|
|
1724
|
-
antispam:
|
|
1725
|
-
}), dr =
|
|
1726
|
-
comments: e.array(
|
|
1749
|
+
}), lr = s({ reply: T }), mr = s({
|
|
1750
|
+
reply: T.clone().optional(),
|
|
1751
|
+
antispam: ce.clone().optional()
|
|
1752
|
+
}), dr = s({ comment: C }), gr = s({
|
|
1753
|
+
comments: e.array(C),
|
|
1727
1754
|
next_token: e.string().optional()
|
|
1728
|
-
}), pr =
|
|
1729
|
-
comment:
|
|
1730
|
-
antispam:
|
|
1731
|
-
}), _r = e.guard(zn), br =
|
|
1755
|
+
}), pr = s({
|
|
1756
|
+
comment: C.clone().optional(),
|
|
1757
|
+
antispam: C.clone().optional()
|
|
1758
|
+
}), _r = e.guard(zn), br = s({
|
|
1732
1759
|
notifications: e.array(rr),
|
|
1733
1760
|
next_token: e.string().optional()
|
|
1734
|
-
}), yr =
|
|
1761
|
+
}), yr = s({
|
|
1735
1762
|
system: e.number(),
|
|
1736
1763
|
comment: e.number(),
|
|
1737
1764
|
like: e.number()
|
|
@@ -1748,8 +1775,8 @@ class $r {
|
|
|
1748
1775
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0
|
|
1749
1776
|
*/
|
|
1750
1777
|
async getForums(t) {
|
|
1751
|
-
const { data:
|
|
1752
|
-
return (
|
|
1778
|
+
const { data: r } = await this.req.get("community/forums", ir, t);
|
|
1779
|
+
return (r == null ? void 0 : r.forums) || [];
|
|
1753
1780
|
}
|
|
1754
1781
|
/**
|
|
1755
1782
|
* 获取社区话题列表,仅返回启用状态的话题
|
|
@@ -1757,70 +1784,80 @@ class $r {
|
|
|
1757
1784
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom
|
|
1758
1785
|
*/
|
|
1759
1786
|
async getTopics(t) {
|
|
1760
|
-
const { data:
|
|
1761
|
-
return (
|
|
1787
|
+
const { data: r } = await this.req.get("community/topics", or, t);
|
|
1788
|
+
return (r == null ? void 0 : r.topics) || [];
|
|
1762
1789
|
}
|
|
1763
1790
|
/**
|
|
1764
1791
|
* 根据话题 ID 获取社区话题信息
|
|
1765
1792
|
*
|
|
1766
1793
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K
|
|
1767
1794
|
*/
|
|
1768
|
-
async getTopic(t,
|
|
1769
|
-
const { data:
|
|
1770
|
-
...
|
|
1795
|
+
async getTopic(t, r) {
|
|
1796
|
+
const { data: n, code: i } = await this.req.get("community/topic", ar, {
|
|
1797
|
+
...r,
|
|
1771
1798
|
params: { topic_id: t }
|
|
1772
1799
|
});
|
|
1773
|
-
return (
|
|
1800
|
+
return (n == null ? void 0 : n.topic) ?? { error: i };
|
|
1774
1801
|
}
|
|
1775
1802
|
/**
|
|
1776
1803
|
* 获取社区帖子列表
|
|
1777
1804
|
*
|
|
1778
1805
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
|
|
1779
1806
|
*/
|
|
1780
|
-
async getPosts(t,
|
|
1781
|
-
const { data:
|
|
1782
|
-
...
|
|
1783
|
-
params:
|
|
1807
|
+
async getPosts(t, r) {
|
|
1808
|
+
const { data: n, code: i, message: o } = await this.req.get("community/posts", z, {
|
|
1809
|
+
...r,
|
|
1810
|
+
params: c(t)
|
|
1784
1811
|
});
|
|
1785
|
-
return
|
|
1812
|
+
return n ?? {
|
|
1813
|
+
message: o,
|
|
1814
|
+
error: i
|
|
1815
|
+
};
|
|
1786
1816
|
}
|
|
1787
1817
|
/**
|
|
1788
1818
|
* 获取社区置顶帖子列表
|
|
1789
1819
|
*
|
|
1790
1820
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
|
|
1791
1821
|
*/
|
|
1792
|
-
async getPinnedPosts(t,
|
|
1793
|
-
const { data:
|
|
1822
|
+
async getPinnedPosts(t, r, n, i) {
|
|
1823
|
+
const { data: o, code: p, message: d } = await this.req.get("community/pinned-posts", z, {
|
|
1794
1824
|
...i,
|
|
1795
|
-
params:
|
|
1825
|
+
params: c({ forum_id: t, max_results: r, next_token: n })
|
|
1796
1826
|
});
|
|
1797
|
-
return
|
|
1827
|
+
return o ?? {
|
|
1828
|
+
message: d,
|
|
1829
|
+
error: p
|
|
1830
|
+
};
|
|
1798
1831
|
}
|
|
1799
1832
|
/**
|
|
1800
1833
|
* 根据帖子 id 获取帖子详情
|
|
1801
1834
|
*
|
|
1802
1835
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
|
|
1803
1836
|
*/
|
|
1804
|
-
async getPost(t,
|
|
1805
|
-
const { data:
|
|
1806
|
-
...
|
|
1837
|
+
async getPost(t, r) {
|
|
1838
|
+
const { data: n, code: i, message: o } = await this.req.get("community/post", sr, {
|
|
1839
|
+
...r,
|
|
1807
1840
|
params: { post_id: t }
|
|
1808
1841
|
});
|
|
1809
|
-
return (
|
|
1842
|
+
return (n == null ? void 0 : n.post) ?? {
|
|
1843
|
+
message: o,
|
|
1844
|
+
error: i
|
|
1845
|
+
};
|
|
1810
1846
|
}
|
|
1811
1847
|
/**
|
|
1812
1848
|
* 发布帖子
|
|
1813
1849
|
*
|
|
1814
1850
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
|
|
1815
1851
|
*/
|
|
1816
|
-
async post(t,
|
|
1817
|
-
const { data:
|
|
1852
|
+
async post(t, r) {
|
|
1853
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1818
1854
|
"community/post",
|
|
1819
|
-
|
|
1855
|
+
c(t),
|
|
1820
1856
|
cr,
|
|
1821
|
-
|
|
1857
|
+
r
|
|
1822
1858
|
);
|
|
1823
|
-
return
|
|
1859
|
+
return n ?? {
|
|
1860
|
+
message: o,
|
|
1824
1861
|
error: i
|
|
1825
1862
|
};
|
|
1826
1863
|
}
|
|
@@ -1829,39 +1866,46 @@ class $r {
|
|
|
1829
1866
|
*
|
|
1830
1867
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp
|
|
1831
1868
|
*/
|
|
1832
|
-
async getComments(t,
|
|
1833
|
-
const { data:
|
|
1834
|
-
...
|
|
1835
|
-
params:
|
|
1869
|
+
async getComments(t, r) {
|
|
1870
|
+
const { data: n, code: i, message: o } = await this.req.get("community/comments", gr, {
|
|
1871
|
+
...r,
|
|
1872
|
+
params: c(t)
|
|
1836
1873
|
});
|
|
1837
|
-
return
|
|
1874
|
+
return n ?? {
|
|
1875
|
+
message: o,
|
|
1876
|
+
error: i
|
|
1877
|
+
};
|
|
1838
1878
|
}
|
|
1839
1879
|
/**
|
|
1840
1880
|
* 根据评论 id 获取评论详情
|
|
1841
1881
|
*
|
|
1842
1882
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=RIc7oxVGae
|
|
1843
1883
|
*/
|
|
1844
|
-
async getComment(t,
|
|
1845
|
-
const { data:
|
|
1846
|
-
...
|
|
1884
|
+
async getComment(t, r) {
|
|
1885
|
+
const { data: n, code: i, message: o } = await this.req.get("community/comment", dr, {
|
|
1886
|
+
...r,
|
|
1847
1887
|
params: { comment_id: t }
|
|
1848
1888
|
});
|
|
1849
|
-
return (
|
|
1889
|
+
return (n == null ? void 0 : n.comment) ?? {
|
|
1890
|
+
message: o,
|
|
1891
|
+
error: i
|
|
1892
|
+
};
|
|
1850
1893
|
}
|
|
1851
1894
|
/**
|
|
1852
1895
|
* 帖子下发表评论
|
|
1853
1896
|
*
|
|
1854
1897
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=Nv7lk0nTmr
|
|
1855
1898
|
*/
|
|
1856
|
-
async comment(t,
|
|
1899
|
+
async comment(t, r) {
|
|
1857
1900
|
await this.token.autoLogin();
|
|
1858
|
-
const { data:
|
|
1901
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1859
1902
|
"community/comment",
|
|
1860
|
-
|
|
1903
|
+
c(t),
|
|
1861
1904
|
pr,
|
|
1862
|
-
|
|
1905
|
+
r
|
|
1863
1906
|
);
|
|
1864
|
-
return
|
|
1907
|
+
return n ?? {
|
|
1908
|
+
message: o,
|
|
1865
1909
|
error: i
|
|
1866
1910
|
};
|
|
1867
1911
|
}
|
|
@@ -1870,39 +1914,46 @@ class $r {
|
|
|
1870
1914
|
*
|
|
1871
1915
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY
|
|
1872
1916
|
*/
|
|
1873
|
-
async getReplies(t,
|
|
1874
|
-
const { data:
|
|
1875
|
-
...
|
|
1876
|
-
params:
|
|
1917
|
+
async getReplies(t, r) {
|
|
1918
|
+
const { data: n } = await this.req.get("community/replies", ur, {
|
|
1919
|
+
...r,
|
|
1920
|
+
params: c({ max_results: 20, ...t })
|
|
1877
1921
|
});
|
|
1878
|
-
return
|
|
1922
|
+
return {
|
|
1923
|
+
replies: (n == null ? void 0 : n.replies) || [],
|
|
1924
|
+
next_token: (n == null ? void 0 : n.next_token) || ""
|
|
1925
|
+
};
|
|
1879
1926
|
}
|
|
1880
1927
|
/**
|
|
1881
1928
|
* 根据回复 id 获取回复详情
|
|
1882
1929
|
*
|
|
1883
1930
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG
|
|
1884
1931
|
*/
|
|
1885
|
-
async getReply(t,
|
|
1886
|
-
const { data:
|
|
1887
|
-
...
|
|
1932
|
+
async getReply(t, r) {
|
|
1933
|
+
const { data: n, code: i, message: o } = await this.req.get("community/reply", lr, {
|
|
1934
|
+
...r,
|
|
1888
1935
|
params: { reply_id: t }
|
|
1889
1936
|
});
|
|
1890
|
-
return (
|
|
1937
|
+
return (n == null ? void 0 : n.reply) ?? {
|
|
1938
|
+
message: o,
|
|
1939
|
+
error: i
|
|
1940
|
+
};
|
|
1891
1941
|
}
|
|
1892
1942
|
/**
|
|
1893
1943
|
* 回复帖子评论或回复
|
|
1894
1944
|
*
|
|
1895
1945
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=KA8WpTX2pg
|
|
1896
1946
|
*/
|
|
1897
|
-
async reply(t,
|
|
1947
|
+
async reply(t, r) {
|
|
1898
1948
|
await this.token.autoLogin();
|
|
1899
|
-
const { data:
|
|
1949
|
+
const { data: n, code: i, message: o } = await this.req.post(
|
|
1900
1950
|
"community/reply",
|
|
1901
|
-
|
|
1951
|
+
c(t),
|
|
1902
1952
|
mr,
|
|
1903
|
-
|
|
1953
|
+
r
|
|
1904
1954
|
);
|
|
1905
|
-
return
|
|
1955
|
+
return n ?? {
|
|
1956
|
+
message: o,
|
|
1906
1957
|
error: i
|
|
1907
1958
|
};
|
|
1908
1959
|
}
|
|
@@ -1911,10 +1962,16 @@ class $r {
|
|
|
1911
1962
|
*
|
|
1912
1963
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
|
|
1913
1964
|
*/
|
|
1914
|
-
async like(t,
|
|
1965
|
+
async like(t, r) {
|
|
1915
1966
|
await this.token.autoLogin();
|
|
1916
|
-
const { ok:
|
|
1917
|
-
|
|
1967
|
+
const { ok: n, code: i, message: o } = await this.req.post(
|
|
1968
|
+
"community/like",
|
|
1969
|
+
{ ...t, action: "like" },
|
|
1970
|
+
null,
|
|
1971
|
+
r
|
|
1972
|
+
);
|
|
1973
|
+
return n || {
|
|
1974
|
+
message: o,
|
|
1918
1975
|
error: i
|
|
1919
1976
|
};
|
|
1920
1977
|
}
|
|
@@ -1923,10 +1980,16 @@ class $r {
|
|
|
1923
1980
|
*
|
|
1924
1981
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
|
|
1925
1982
|
*/
|
|
1926
|
-
async unlike(t,
|
|
1983
|
+
async unlike(t, r) {
|
|
1927
1984
|
await this.token.autoLogin();
|
|
1928
|
-
const { ok:
|
|
1929
|
-
|
|
1985
|
+
const { ok: n, code: i, message: o } = await this.req.post(
|
|
1986
|
+
"community/like",
|
|
1987
|
+
{ ...t, action: "unlike" },
|
|
1988
|
+
null,
|
|
1989
|
+
r
|
|
1990
|
+
);
|
|
1991
|
+
return n || {
|
|
1992
|
+
message: o,
|
|
1930
1993
|
error: i
|
|
1931
1994
|
};
|
|
1932
1995
|
}
|
|
@@ -1935,13 +1998,13 @@ class $r {
|
|
|
1935
1998
|
*
|
|
1936
1999
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=dWWhpoShxZ
|
|
1937
2000
|
*/
|
|
1938
|
-
async getMediaPresignedUrl(t,
|
|
2001
|
+
async getMediaPresignedUrl(t, r) {
|
|
1939
2002
|
await this.token.autoLogin();
|
|
1940
|
-
const { data:
|
|
1941
|
-
...
|
|
2003
|
+
const { data: n } = await this.req.get("community/media-presign-url", _r, {
|
|
2004
|
+
...r,
|
|
1942
2005
|
params: t
|
|
1943
2006
|
});
|
|
1944
|
-
return
|
|
2007
|
+
return n;
|
|
1945
2008
|
}
|
|
1946
2009
|
/**
|
|
1947
2010
|
* 获取用户社区通知
|
|
@@ -1950,13 +2013,16 @@ class $r {
|
|
|
1950
2013
|
*
|
|
1951
2014
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=W5lceDgbBG
|
|
1952
2015
|
*/
|
|
1953
|
-
async getNotifications(t,
|
|
2016
|
+
async getNotifications(t, r) {
|
|
1954
2017
|
await this.token.autoLogin();
|
|
1955
|
-
const { data:
|
|
1956
|
-
...
|
|
1957
|
-
params:
|
|
2018
|
+
const { data: n } = await this.req.get("community/notifications", br, {
|
|
2019
|
+
...r,
|
|
2020
|
+
params: c({ max_results: 20, ...t })
|
|
1958
2021
|
});
|
|
1959
|
-
return
|
|
2022
|
+
return {
|
|
2023
|
+
notifications: (n == null ? void 0 : n.notifications) || [],
|
|
2024
|
+
next_token: (n == null ? void 0 : n.next_token) || ""
|
|
2025
|
+
};
|
|
1960
2026
|
}
|
|
1961
2027
|
/**
|
|
1962
2028
|
* 获取用户未读通知数量
|
|
@@ -1965,34 +2031,34 @@ class $r {
|
|
|
1965
2031
|
*/
|
|
1966
2032
|
async getUnreadNotificationsCount(t) {
|
|
1967
2033
|
if (!await this.token.autoLogin()) return null;
|
|
1968
|
-
const { data:
|
|
2034
|
+
const { data: r } = await this.req.get(
|
|
1969
2035
|
"community/unread-notifications-count",
|
|
1970
2036
|
yr,
|
|
1971
2037
|
t
|
|
1972
2038
|
);
|
|
1973
|
-
return
|
|
2039
|
+
return r;
|
|
1974
2040
|
}
|
|
1975
2041
|
/**
|
|
1976
2042
|
* 社区用户将通知标为已读
|
|
1977
2043
|
*
|
|
1978
2044
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=TCJQxnOjJe
|
|
1979
2045
|
*/
|
|
1980
|
-
async clearUnreadNotifications(t,
|
|
2046
|
+
async clearUnreadNotifications(t, r) {
|
|
1981
2047
|
if (!await this.token.autoLogin()) return !1;
|
|
1982
|
-
const { ok:
|
|
1983
|
-
return
|
|
2048
|
+
const { ok: n } = await this.req.post("community/clear-unread-notifications", { category: t }, null, r);
|
|
2049
|
+
return n;
|
|
1984
2050
|
}
|
|
1985
2051
|
}
|
|
1986
|
-
const fr =
|
|
2052
|
+
const fr = s({
|
|
1987
2053
|
nonce_str: e.string(),
|
|
1988
2054
|
timestamp: e.number(),
|
|
1989
2055
|
signature: e.string()
|
|
1990
2056
|
});
|
|
1991
|
-
var hr = /* @__PURE__ */ ((
|
|
1992
|
-
function
|
|
1993
|
-
return
|
|
2057
|
+
var hr = /* @__PURE__ */ ((a) => (a.RedirectUriDisMatch = "10003", a.AppidError = "10016", a.AuthorizationError = "10015", a.NoRightForScope = "10005", a.Frequently = "10009", a.AppBanded = "10004", a.ShouldFollow = "10006", a.ScopeNull = "10010", a.RedirectUriNull = "10011", a.AppidNull = "10012", a.StateNull = "10013", a))(hr || {});
|
|
2058
|
+
function P(a) {
|
|
2059
|
+
return R(a, "open_id", "union_id", "weixin_token");
|
|
1994
2060
|
}
|
|
1995
|
-
const
|
|
2061
|
+
const J = "wx_login_cache";
|
|
1996
2062
|
class Ur {
|
|
1997
2063
|
/**
|
|
1998
2064
|
* 创建微信相关功能接口
|
|
@@ -2007,11 +2073,11 @@ class Ur {
|
|
|
2007
2073
|
*
|
|
2008
2074
|
* https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
|
|
2009
2075
|
*/
|
|
2010
|
-
constructor(t,
|
|
2076
|
+
constructor(t, r) {
|
|
2011
2077
|
m(this, "token");
|
|
2012
2078
|
m(this, "$appid");
|
|
2013
2079
|
m(this, "req");
|
|
2014
|
-
this.token = t, this.req = t.req, this.$appid =
|
|
2080
|
+
this.token = t, this.req = t.req, this.$appid = r, this.getLoginCache();
|
|
2015
2081
|
}
|
|
2016
2082
|
get appid() {
|
|
2017
2083
|
return this.$appid;
|
|
@@ -2024,11 +2090,11 @@ class Ur {
|
|
|
2024
2090
|
* 也可以直接调用 login 方法,并传入 weixin code 的读取函数
|
|
2025
2091
|
*/
|
|
2026
2092
|
async getLoginCache() {
|
|
2027
|
-
const t = this.token.storage.get(
|
|
2093
|
+
const t = this.token.storage.get(J);
|
|
2028
2094
|
if (!t)
|
|
2029
2095
|
return null;
|
|
2030
|
-
const
|
|
2031
|
-
return
|
|
2096
|
+
const r = be(t);
|
|
2097
|
+
return P(r) ? (this.token.weixinToken = r.weixin_token, await this.token.autoLogin(), r) : null;
|
|
2032
2098
|
}
|
|
2033
2099
|
/**
|
|
2034
2100
|
* 小程序页面微信静默登录,获取 weixinToken / open_id / union_id。
|
|
@@ -2047,19 +2113,19 @@ class Ur {
|
|
|
2047
2113
|
*
|
|
2048
2114
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
|
|
2049
2115
|
*/
|
|
2050
|
-
async login() {
|
|
2116
|
+
async login(t) {
|
|
2051
2117
|
if (!y.wx)
|
|
2052
2118
|
throw new Error("当前环境非微信小程序");
|
|
2053
|
-
const
|
|
2054
|
-
if (
|
|
2055
|
-
return
|
|
2056
|
-
const n = await he(), { data:
|
|
2119
|
+
const r = await this.getLoginCache();
|
|
2120
|
+
if (r)
|
|
2121
|
+
return r;
|
|
2122
|
+
const n = await he(), { data: i, code: o } = await this.req.post(
|
|
2057
2123
|
"weixin/login",
|
|
2058
2124
|
{ code: n, appid: this.appid },
|
|
2059
|
-
|
|
2060
|
-
{ message: !1 }
|
|
2125
|
+
P,
|
|
2126
|
+
{ ...t, message: !1 }
|
|
2061
2127
|
);
|
|
2062
|
-
return
|
|
2128
|
+
return i && (this.token.weixinToken = i.weixin_token, this.token.storage.set(J, JSON.stringify(i)), await this.token.autoLogin()), i ?? { error: o };
|
|
2063
2129
|
}
|
|
2064
2130
|
/**
|
|
2065
2131
|
* 在微信内嵌网页中调用微信公众号授权登录【暂未启用】
|
|
@@ -2077,29 +2143,26 @@ class Ur {
|
|
|
2077
2143
|
* - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 union_id 则需要 snsapi_userinfo
|
|
2078
2144
|
* - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
|
|
2079
2145
|
*/
|
|
2080
|
-
async webLogin(t = "snsapi_userinfo",
|
|
2081
|
-
const
|
|
2082
|
-
if (!
|
|
2083
|
-
const ue =
|
|
2146
|
+
async webLogin(t = "snsapi_userinfo", r) {
|
|
2147
|
+
const n = E("code"), i = Date.now(), o = +E("state");
|
|
2148
|
+
if (!n || !o || o < i - 1e3 * 60 * 5 || o > i) {
|
|
2149
|
+
const ue = B(["code", "state"]);
|
|
2084
2150
|
location.replace(
|
|
2085
2151
|
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(ue)}&response_type=code&scope=${t}&state=${i}#wechat_redirect`
|
|
2086
2152
|
);
|
|
2087
2153
|
return;
|
|
2088
2154
|
}
|
|
2089
|
-
if (/^100\d{2}$/.test(
|
|
2090
|
-
return { error:
|
|
2091
|
-
const
|
|
2092
|
-
"replaceState" in history && history.replaceState({}, "",
|
|
2093
|
-
const { data:
|
|
2155
|
+
if (/^100\d{2}$/.test(n))
|
|
2156
|
+
return { error: n };
|
|
2157
|
+
const p = B(["code", "state"]);
|
|
2158
|
+
"replaceState" in history && history.replaceState({}, "", p);
|
|
2159
|
+
const { data: d, code: h } = await this.req.post(
|
|
2094
2160
|
"weixin/login",
|
|
2095
|
-
{
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
},
|
|
2099
|
-
L,
|
|
2100
|
-
n
|
|
2161
|
+
{ code: n, appid: this.appid },
|
|
2162
|
+
P,
|
|
2163
|
+
r
|
|
2101
2164
|
);
|
|
2102
|
-
return
|
|
2165
|
+
return d && (this.token.weixinToken = d.weixin_token, await this.token.autoLogin()), d ?? { error: h };
|
|
2103
2166
|
}
|
|
2104
2167
|
/**
|
|
2105
2168
|
* 关联游戏账号,无返回值,全程静默
|
|
@@ -2113,9 +2176,9 @@ class Ur {
|
|
|
2113
2176
|
* @param weixinToken 调用 login 后,得到的 weixinToken,如果 weixinToken 为空则跳过不处理
|
|
2114
2177
|
* @param gameCode 从游戏内跳转至小程序时,通过请求参数 query 携带的 game_code,如果值为空则跳过不处理
|
|
2115
2178
|
*/
|
|
2116
|
-
async linkPlayer(t,
|
|
2117
|
-
!t || !
|
|
2118
|
-
...
|
|
2179
|
+
async linkPlayer(t, r, n) {
|
|
2180
|
+
!t || !r || await this.req.post("weixin/link-player", { weixin_token: t, game_code: r }, null, {
|
|
2181
|
+
...n,
|
|
2119
2182
|
message: !1
|
|
2120
2183
|
});
|
|
2121
2184
|
}
|
|
@@ -2125,32 +2188,32 @@ class Ur {
|
|
|
2125
2188
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=CuWOqxr9Ue
|
|
2126
2189
|
*/
|
|
2127
2190
|
async getJSSDKConfig(t) {
|
|
2128
|
-
const { data:
|
|
2191
|
+
const { data: r } = await this.req.get("weixin/offiaccount/jssdk-sign", fr, {
|
|
2129
2192
|
...t,
|
|
2130
2193
|
params: {
|
|
2131
2194
|
appid: this.appid,
|
|
2132
2195
|
url: location.href.split("#")[0]
|
|
2133
2196
|
}
|
|
2134
2197
|
});
|
|
2135
|
-
return
|
|
2198
|
+
return r ? {
|
|
2136
2199
|
appid: this.appid,
|
|
2137
|
-
nonceStr:
|
|
2138
|
-
timestamp:
|
|
2139
|
-
signature:
|
|
2200
|
+
nonceStr: r.nonce_str,
|
|
2201
|
+
timestamp: r.timestamp,
|
|
2202
|
+
signature: r.signature
|
|
2140
2203
|
} : null;
|
|
2141
2204
|
}
|
|
2142
2205
|
}
|
|
2143
2206
|
export {
|
|
2144
|
-
|
|
2207
|
+
ce as AntispamValidator,
|
|
2145
2208
|
Cr as AuthToken,
|
|
2146
2209
|
on as CashbackEngagementDataValidator,
|
|
2147
2210
|
an as ClaimActivationKeyEngagementDataValidator,
|
|
2148
2211
|
b as ClaimRewardStatus,
|
|
2149
|
-
|
|
2212
|
+
U as ClaimRewardStatusValidator,
|
|
2150
2213
|
qn as ClaimedItemValidator,
|
|
2151
|
-
|
|
2214
|
+
Z as ClubAddressValidator,
|
|
2152
2215
|
Vr as ClubApi,
|
|
2153
|
-
|
|
2216
|
+
W as ClubBenefitSummaryValidator,
|
|
2154
2217
|
Ge as ClubBenefitValidator,
|
|
2155
2218
|
je as ClubCreditChangeScene,
|
|
2156
2219
|
Te as ClubCreditChangeSceneValidator,
|
|
@@ -2159,15 +2222,15 @@ export {
|
|
|
2159
2222
|
Ie as ClubCreditLogValidator,
|
|
2160
2223
|
Le as ClubGlobalConfigValidator,
|
|
2161
2224
|
qe as ClubItemType,
|
|
2162
|
-
|
|
2225
|
+
X as ClubItemTypeValidator,
|
|
2163
2226
|
Pe as ClubPlayerValidator,
|
|
2164
|
-
|
|
2227
|
+
ee as ClubProductValidator,
|
|
2165
2228
|
xe as ClubRedemptionStatus,
|
|
2166
2229
|
Se as ClubRedemptionStatusValidator,
|
|
2167
2230
|
De as ClubUserCreditValidator,
|
|
2168
2231
|
Fe as ClubUserProfileValidator,
|
|
2169
2232
|
kn as CommentEngagementValidator,
|
|
2170
|
-
|
|
2233
|
+
C as CommentValidator,
|
|
2171
2234
|
$r as CommunityApi,
|
|
2172
2235
|
Ze as EngageAccountType,
|
|
2173
2236
|
We as EngageAccountTypeValidator,
|
|
@@ -2197,17 +2260,17 @@ export {
|
|
|
2197
2260
|
nn as EventFeatureConfigValidator,
|
|
2198
2261
|
et as EventPeriodType,
|
|
2199
2262
|
tt as EventPeriodTypeValidator,
|
|
2200
|
-
|
|
2263
|
+
D as EventRewardItemConfigValidator,
|
|
2201
2264
|
Ne as ExtraGameRewardValidator,
|
|
2202
2265
|
Ae as ExtraPhysicalShipmentValidator,
|
|
2203
2266
|
gt as FeatureRewardValidator,
|
|
2204
|
-
|
|
2267
|
+
u as FeatureType,
|
|
2205
2268
|
nt as FeatureTypeValidator,
|
|
2206
2269
|
On as ForumMode,
|
|
2207
2270
|
Bn as ForumModeValidator,
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2271
|
+
se as ForumValidator,
|
|
2272
|
+
j as GamerItemType,
|
|
2273
|
+
te as GamerItemTypeValidator,
|
|
2211
2274
|
ve as Gender,
|
|
2212
2275
|
Ce as GenderValidator,
|
|
2213
2276
|
sn as GiftCodeEngagementDataValidator,
|
|
@@ -2216,16 +2279,16 @@ export {
|
|
|
2216
2279
|
Sr as LotteryDrawActionValidator,
|
|
2217
2280
|
dn as LotteryDrawEngagementDataValidator,
|
|
2218
2281
|
un as LotteryEngagementDataValidator,
|
|
2219
|
-
|
|
2282
|
+
v as LotteryTicketStatus,
|
|
2220
2283
|
qr as LotteryTicketStatusValidator,
|
|
2221
2284
|
f as NotificationBaseValidator,
|
|
2222
2285
|
Qn as NotificationCategory,
|
|
2223
2286
|
Er as NotificationCategoryValidator,
|
|
2224
2287
|
Wn as NotificationCommentReplyValidator,
|
|
2225
2288
|
er as NotificationCommentValidator,
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2289
|
+
q as NotificationPayloadCommentValidator,
|
|
2290
|
+
N as NotificationPayloadPostValidator,
|
|
2291
|
+
O as NotificationPayloadReplyValidator,
|
|
2229
2292
|
Jn as NotificationPayloadSystemValidator,
|
|
2230
2293
|
Zn as NotificationPostCommentValidator,
|
|
2231
2294
|
Yn as NotificationPostValidator,
|
|
@@ -2236,27 +2299,27 @@ export {
|
|
|
2236
2299
|
Kn as NotificationTypeValidator,
|
|
2237
2300
|
rr as NotificationValidator,
|
|
2238
2301
|
Ue as PlayerRoleCardValidator,
|
|
2239
|
-
|
|
2302
|
+
Y as PlayerRoleValidator,
|
|
2240
2303
|
Mn as PostStatus,
|
|
2241
|
-
|
|
2242
|
-
|
|
2304
|
+
ae as PostStatusValidator,
|
|
2305
|
+
A as PostValidator,
|
|
2243
2306
|
gn as PreregisterEngagementDataValidator,
|
|
2244
2307
|
zn as PresignedUrlResponseValidator,
|
|
2245
2308
|
pn as QuestEngagementDataValidator,
|
|
2246
2309
|
rt as QuestObjective,
|
|
2247
|
-
|
|
2310
|
+
re as QuestObjectiveValidator,
|
|
2248
2311
|
Rr as RedeemParamsValidator,
|
|
2249
2312
|
Oe as RedemptionValidator,
|
|
2250
2313
|
dt as RegularRewardValidator,
|
|
2251
2314
|
Hn as ReplyToValidator,
|
|
2252
|
-
|
|
2315
|
+
T as ReplyValidator,
|
|
2253
2316
|
jr as RewardItemType,
|
|
2254
|
-
|
|
2317
|
+
ne as RewardItemTypeValidator,
|
|
2255
2318
|
at as RewardSource,
|
|
2256
|
-
|
|
2319
|
+
F as RewardSourceValidator,
|
|
2257
2320
|
_ as RewardStatus,
|
|
2258
|
-
|
|
2259
|
-
|
|
2321
|
+
$ as RewardStatusSuffix,
|
|
2322
|
+
ie as RewardStatusSuffixValidator,
|
|
2260
2323
|
Tr as RewardStatusValidator,
|
|
2261
2324
|
vn as RewardValidator,
|
|
2262
2325
|
$e as RoleBaseInfoValidator,
|
|
@@ -2270,11 +2333,11 @@ export {
|
|
|
2270
2333
|
Lr as TeamMemberValidator,
|
|
2271
2334
|
st as TeamVisibility,
|
|
2272
2335
|
ct as TeamVisibilityValidator,
|
|
2273
|
-
|
|
2274
|
-
|
|
2336
|
+
G as TopicValidator,
|
|
2337
|
+
I as UserEngagementDataValidator,
|
|
2275
2338
|
Rn as UserEngagementValidator,
|
|
2276
2339
|
jn as UserFeatureStatusValidator,
|
|
2277
|
-
|
|
2340
|
+
oe as UserRewardValidator,
|
|
2278
2341
|
Vn as VerifyMobileResultValidator,
|
|
2279
2342
|
wn as VoteEngagementDataValidator,
|
|
2280
2343
|
it as VoteOptionSource,
|