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