@seayoo-web/gamer-api 2.4.5 → 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
|
/** 游戏内道具 */
|
|
@@ -688,17 +685,17 @@ const j = {
|
|
|
688
685
|
ExternalCode: "external_gift_code",
|
|
689
686
|
/** 空奖励 */
|
|
690
687
|
VoidItem: "void_item"
|
|
691
|
-
}, te = e.string().enum(
|
|
688
|
+
}, te = e.string().enum(V).lock(), Rr = V, ne = te, Xe = {
|
|
692
689
|
/** 世游通行证 ID / Combo ID */
|
|
693
690
|
UserId: "user_id",
|
|
694
691
|
/** 游戏角色 ID */
|
|
695
692
|
RoleId: "role_id"
|
|
696
|
-
},
|
|
693
|
+
}, Ye = e.string().enum(Xe).lock(), Ze = {
|
|
697
694
|
None: "none",
|
|
698
695
|
Daily: "daily",
|
|
699
696
|
Weekly: "weekly",
|
|
700
697
|
Monthly: "monthly"
|
|
701
|
-
},
|
|
698
|
+
}, We = e.string().enum(Ze).lock(), u = {
|
|
702
699
|
/** 预约 */
|
|
703
700
|
Preregister: "preregister",
|
|
704
701
|
/** 抽奖 */
|
|
@@ -737,7 +734,7 @@ const j = {
|
|
|
737
734
|
CheckIn: "check_in",
|
|
738
735
|
/** 领取激活码 */
|
|
739
736
|
ClaimActivationKey: "claim_activation_key"
|
|
740
|
-
},
|
|
737
|
+
}, et = e.string().enum(u).lock(), tt = {
|
|
741
738
|
/** 累计游戏内活跃值 */
|
|
742
739
|
Active: "player_active_points",
|
|
743
740
|
/** 累计登录,单位 人天 */
|
|
@@ -752,14 +749,14 @@ const j = {
|
|
|
752
749
|
MatchCounts: "player_match_counts",
|
|
753
750
|
/** 游戏对局天数 */
|
|
754
751
|
MatchDays: "player_match_days"
|
|
755
|
-
}, re = e.string().enum(
|
|
752
|
+
}, re = e.string().enum(tt).lock(), nt = {
|
|
756
753
|
/** 官方上传 */
|
|
757
754
|
System: "system",
|
|
758
755
|
/** 用户投稿 */
|
|
759
756
|
UserSubmission: "user_submission",
|
|
760
757
|
/** 投票入围 */
|
|
761
758
|
Shortlisted: "shortlisted"
|
|
762
|
-
},
|
|
759
|
+
}, rt = e.string().enum(nt).lock(), p = {
|
|
763
760
|
/** 未获得奖励 */
|
|
764
761
|
Ineligible: "ineligible",
|
|
765
762
|
/** 奖励未领取 */
|
|
@@ -770,7 +767,7 @@ const j = {
|
|
|
770
767
|
Failed: "failed",
|
|
771
768
|
/** 奖励已发货 */
|
|
772
769
|
Delivered: "delivered"
|
|
773
|
-
},
|
|
770
|
+
}, Vr = e.string().enum(p).lock(), P = {
|
|
774
771
|
/**
|
|
775
772
|
* 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
|
|
776
773
|
*
|
|
@@ -778,16 +775,16 @@ const j = {
|
|
|
778
775
|
*/
|
|
779
776
|
UnclaimedErr: "unaccalimed",
|
|
780
777
|
/** 奖励未领取 */
|
|
781
|
-
Unclaimed:
|
|
778
|
+
Unclaimed: p.Unclaimed,
|
|
782
779
|
/** 奖励已领取 */
|
|
783
|
-
Received:
|
|
780
|
+
Received: p.Received,
|
|
784
781
|
/** 奖励发放失败 */
|
|
785
|
-
Failed:
|
|
782
|
+
Failed: p.Failed,
|
|
786
783
|
/** 奖励已发货 */
|
|
787
|
-
Delivered:
|
|
788
|
-
},
|
|
784
|
+
Delivered: p.Delivered
|
|
785
|
+
}, ae = e.string().enum(P).lock(), _ = {
|
|
789
786
|
/** 未获得奖励 */
|
|
790
|
-
Ineligible:
|
|
787
|
+
Ineligible: p.Ineligible,
|
|
791
788
|
/**
|
|
792
789
|
* 奖励未领取,拼写错误以兼容后端历史版本,检查请使用 Unclaimed
|
|
793
790
|
*
|
|
@@ -795,24 +792,24 @@ const j = {
|
|
|
795
792
|
*/
|
|
796
793
|
UnclaimedErr: "unaccalimed",
|
|
797
794
|
/** 奖励未领取 */
|
|
798
|
-
Unclaimed:
|
|
795
|
+
Unclaimed: p.Unclaimed,
|
|
799
796
|
/** 奖励已领取 */
|
|
800
|
-
Received:
|
|
797
|
+
Received: p.Received,
|
|
801
798
|
/** 奖励发放失败 */
|
|
802
|
-
Failed:
|
|
799
|
+
Failed: p.Failed,
|
|
803
800
|
/** 奖励已发货 */
|
|
804
|
-
Delivered:
|
|
805
|
-
},
|
|
801
|
+
Delivered: p.Delivered
|
|
802
|
+
}, $ = e.string().enum(_).lock(), at = {
|
|
806
803
|
/** 玩法产出奖励 */
|
|
807
804
|
Output: "output",
|
|
808
805
|
/** 玩法参与奖励 */
|
|
809
806
|
Engage: "engage"
|
|
810
|
-
},
|
|
807
|
+
}, U = e.string().enum(at).lock(), it = {
|
|
811
808
|
/** 私有队伍 */
|
|
812
809
|
Private: "private",
|
|
813
810
|
/** 公开队伍 */
|
|
814
811
|
Public: "public"
|
|
815
|
-
},
|
|
812
|
+
}, ot = e.string().enum(it).lock(), k = {
|
|
816
813
|
/** 未知状态 */
|
|
817
814
|
Unknown: "unknown",
|
|
818
815
|
/** 等待开奖 */
|
|
@@ -823,7 +820,7 @@ const j = {
|
|
|
823
820
|
Claimed: "claimed",
|
|
824
821
|
/** 领奖失败 */
|
|
825
822
|
Fail: "fail"
|
|
826
|
-
},
|
|
823
|
+
}, jr = e.string().enum(k).lock(), st = {
|
|
827
824
|
/** 发起组队 */
|
|
828
825
|
Assemble: "assemble",
|
|
829
826
|
/** 加入队伍 */
|
|
@@ -834,71 +831,71 @@ const j = {
|
|
|
834
831
|
ChangeVisibility: "change_visibility",
|
|
835
832
|
/** 查询组队信息 */
|
|
836
833
|
Query: "query"
|
|
837
|
-
},
|
|
834
|
+
}, Tr = e.string().enum(st).lock(), ct = {
|
|
838
835
|
/** 查询抽奖券 */
|
|
839
836
|
Query: "query",
|
|
840
837
|
/** 开奖 */
|
|
841
838
|
Draw: "draw",
|
|
842
839
|
/** 领奖 */
|
|
843
840
|
Claim: "claim"
|
|
844
|
-
},
|
|
841
|
+
}, qr = e.string().enum(ct).lock(), ut = e.string().enum(R(V, "GiftCode", "LotteryTicket")), F = e.object({
|
|
845
842
|
reward_item_id: e.number(),
|
|
846
843
|
reward_amount: e.number(),
|
|
847
844
|
reward_item_name: e.string(),
|
|
848
845
|
reward_item_icon_url: e.string(),
|
|
849
846
|
reward_item_desc: e.string().optional(),
|
|
850
|
-
reward_item_type:
|
|
847
|
+
reward_item_type: ut,
|
|
851
848
|
reward_item_rating: e.number()
|
|
852
|
-
}).lock(),
|
|
849
|
+
}).lock(), lt = e.object({
|
|
853
850
|
engage_count: e.number(),
|
|
854
|
-
rewards: e.array(
|
|
855
|
-
}).lock(),
|
|
851
|
+
rewards: e.array(F)
|
|
852
|
+
}).lock(), mt = e.union(
|
|
856
853
|
e.object({
|
|
857
854
|
feature_reward_type: e.string().enum("every"),
|
|
858
|
-
reward_details: e.array(
|
|
855
|
+
reward_details: e.array(F)
|
|
859
856
|
}),
|
|
860
857
|
e.object({
|
|
861
858
|
feature_reward_type: e.string().enum("regular"),
|
|
862
|
-
reward_details: e.array(
|
|
859
|
+
reward_details: e.array(lt)
|
|
863
860
|
})
|
|
864
|
-
).satisfies().lock(),
|
|
861
|
+
).satisfies().lock(), m = e.object({
|
|
865
862
|
feature_name: e.string(),
|
|
866
863
|
feature_id: e.number(),
|
|
867
864
|
description: e.string(),
|
|
868
|
-
cycle:
|
|
865
|
+
cycle: We,
|
|
869
866
|
limit: e.number(),
|
|
870
867
|
since: e.number(),
|
|
871
868
|
until: e.number(),
|
|
872
|
-
engage_account:
|
|
873
|
-
feature_rewards:
|
|
874
|
-
}),
|
|
875
|
-
...
|
|
876
|
-
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),
|
|
877
874
|
config: e.object({
|
|
878
875
|
order_start_time: e.number(),
|
|
879
876
|
order_end_time: e.number(),
|
|
880
877
|
claim_rewards_start_time: e.number(),
|
|
881
878
|
claim_rewards_end_time: e.number()
|
|
882
879
|
})
|
|
883
|
-
}),
|
|
884
|
-
...
|
|
885
|
-
feature_type: e.string().enum(
|
|
886
|
-
}),
|
|
887
|
-
...
|
|
888
|
-
feature_type: e.string().enum(
|
|
889
|
-
}),
|
|
890
|
-
...
|
|
891
|
-
feature_type: e.string().enum(
|
|
892
|
-
}),
|
|
893
|
-
...
|
|
894
|
-
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),
|
|
895
892
|
config: e.object({
|
|
896
893
|
comments: e.array(e.string()),
|
|
897
894
|
send_rate: e.number()
|
|
898
895
|
})
|
|
899
|
-
}),
|
|
900
|
-
...
|
|
901
|
-
feature_type: e.string().enum(
|
|
896
|
+
}), vt = u.Follow, Ct = e.object({
|
|
897
|
+
...m.shape,
|
|
898
|
+
feature_type: e.string().enum(vt),
|
|
902
899
|
config: e.object({
|
|
903
900
|
platform: e.string(),
|
|
904
901
|
platform_icon: e.string().optional(),
|
|
@@ -906,59 +903,59 @@ const j = {
|
|
|
906
903
|
qr_code_url: e.string().optional(),
|
|
907
904
|
platform_desc: e.string().optional()
|
|
908
905
|
})
|
|
909
|
-
}),
|
|
906
|
+
}), Rt = u.GiftCode, Vt = e.object({
|
|
910
907
|
name: e.string(),
|
|
911
908
|
icon_url: e.string(),
|
|
912
909
|
count: e.number()
|
|
913
|
-
}),
|
|
914
|
-
...
|
|
915
|
-
feature_type: e.string().enum(
|
|
910
|
+
}), jt = e.object({
|
|
911
|
+
...m.shape,
|
|
912
|
+
feature_type: e.string().enum(Rt),
|
|
916
913
|
config: e.object({
|
|
917
|
-
gift_items: e.array(
|
|
914
|
+
gift_items: e.array(Vt),
|
|
918
915
|
mp_url: e.string().optional(),
|
|
919
916
|
mp_qrcode_url: e.string().optional()
|
|
920
917
|
})
|
|
921
|
-
}),
|
|
922
|
-
...
|
|
923
|
-
feature_type: e.string().enum(
|
|
918
|
+
}), Tt = u.Invite, qt = e.object({
|
|
919
|
+
...m.shape,
|
|
920
|
+
feature_type: e.string().enum(Tt),
|
|
924
921
|
config: e.object({
|
|
925
922
|
share_url: e.string()
|
|
926
923
|
})
|
|
927
|
-
}),
|
|
928
|
-
...
|
|
929
|
-
feature_type: e.string().enum(
|
|
930
|
-
}),
|
|
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({
|
|
931
928
|
reward_item_id: e.number(),
|
|
932
929
|
reward_item_name: e.string(),
|
|
933
|
-
reward_item_type:
|
|
930
|
+
reward_item_type: Lt,
|
|
934
931
|
reward_item_icon_url: e.string(),
|
|
935
932
|
reward_item_desc: e.string().optional(),
|
|
936
933
|
reward_amount: e.number(),
|
|
937
934
|
reward_remaining_stock: e.number()
|
|
938
|
-
}),
|
|
939
|
-
...
|
|
940
|
-
feature_type: e.string().enum(
|
|
935
|
+
}), $t = e.object({
|
|
936
|
+
...m.shape,
|
|
937
|
+
feature_type: e.string().enum(Et),
|
|
941
938
|
config: e.object({
|
|
942
939
|
consume_item_id: e.number(),
|
|
943
940
|
consume_item_name: e.number(),
|
|
944
941
|
consume_item_icon_url: e.string(),
|
|
945
942
|
consume_item_count: e.number(),
|
|
946
943
|
consume_item_desc: e.string().optional(),
|
|
947
|
-
rewards: e.array(
|
|
944
|
+
rewards: e.array(Pt)
|
|
948
945
|
})
|
|
949
|
-
}),
|
|
950
|
-
...
|
|
951
|
-
feature_type: e.string().enum(
|
|
946
|
+
}), Ut = u.LotteryDraw, Ft = e.object({
|
|
947
|
+
...m.shape,
|
|
948
|
+
feature_type: e.string().enum(Ut),
|
|
952
949
|
config: e.object({
|
|
953
950
|
draw_not_before: e.number(),
|
|
954
951
|
draw_not_after: e.number()
|
|
955
952
|
})
|
|
956
|
-
}),
|
|
957
|
-
...
|
|
958
|
-
feature_type: e.string().enum(
|
|
959
|
-
}),
|
|
960
|
-
...
|
|
961
|
-
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),
|
|
962
959
|
config: e.object({
|
|
963
960
|
objective: re,
|
|
964
961
|
completion_value: e.number(),
|
|
@@ -972,38 +969,38 @@ const j = {
|
|
|
972
969
|
required_matches: e.number().min(1).optional()
|
|
973
970
|
}).optional()
|
|
974
971
|
})
|
|
975
|
-
}),
|
|
976
|
-
...
|
|
977
|
-
feature_type: e.string().enum(
|
|
978
|
-
}),
|
|
979
|
-
...
|
|
980
|
-
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),
|
|
981
978
|
config: e.object({
|
|
982
979
|
share_platform: e.string(),
|
|
983
980
|
jump_url: e.string().optional(),
|
|
984
981
|
icon_url: e.string().optional()
|
|
985
982
|
})
|
|
986
|
-
}),
|
|
987
|
-
...
|
|
988
|
-
feature_type: e.string().enum(
|
|
983
|
+
}), Qt = u.Subscribe, Kt = e.object({
|
|
984
|
+
...m.shape,
|
|
985
|
+
feature_type: e.string().enum(Qt),
|
|
989
986
|
config: e.object({
|
|
990
987
|
weixin_template_ids: e.array(e.string())
|
|
991
988
|
})
|
|
992
|
-
}),
|
|
993
|
-
...
|
|
994
|
-
feature_type: e.string().enum(
|
|
989
|
+
}), Ht = u.Survey, zt = e.object({
|
|
990
|
+
...m.shape,
|
|
991
|
+
feature_type: e.string().enum(Ht),
|
|
995
992
|
config: e.object({
|
|
996
993
|
survey_id: e.string(),
|
|
997
994
|
survey_url: e.string()
|
|
998
995
|
})
|
|
999
|
-
}),
|
|
1000
|
-
...
|
|
1001
|
-
feature_type: e.string().enum(
|
|
996
|
+
}), Jt = u.Team, Xt = e.object({
|
|
997
|
+
...m.shape,
|
|
998
|
+
feature_type: e.string().enum(Jt),
|
|
1002
999
|
config: e.object({
|
|
1003
1000
|
max_members: e.number().min(1),
|
|
1004
1001
|
min_members: e.number().min(1)
|
|
1005
1002
|
})
|
|
1006
|
-
}),
|
|
1003
|
+
}), Yt = u.Vote, Zt = e.object({
|
|
1007
1004
|
sn: e.string(),
|
|
1008
1005
|
name: e.string(),
|
|
1009
1006
|
img_urls: e.array(e.string()).optional(),
|
|
@@ -1013,93 +1010,93 @@ const j = {
|
|
|
1013
1010
|
amount: e.number(),
|
|
1014
1011
|
finalists: e.bool(),
|
|
1015
1012
|
last_vote_time: e.number()
|
|
1016
|
-
}),
|
|
1017
|
-
...
|
|
1018
|
-
feature_type: e.string().enum(
|
|
1013
|
+
}), Wt = e.object({
|
|
1014
|
+
...m.shape,
|
|
1015
|
+
feature_type: e.string().enum(Yt),
|
|
1019
1016
|
config: e.object({
|
|
1020
1017
|
vote_feature_ids: e.array(e.number()),
|
|
1021
1018
|
submission_feature_ids: e.array(e.number()),
|
|
1022
1019
|
finalists_amount: e.number(),
|
|
1023
|
-
source:
|
|
1024
|
-
options: e.array(
|
|
1025
|
-
rewards: e.array(
|
|
1020
|
+
source: rt,
|
|
1021
|
+
options: e.array(Zt),
|
|
1022
|
+
rewards: e.array(F)
|
|
1026
1023
|
})
|
|
1027
|
-
}),
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1024
|
+
}), en = e.union(
|
|
1025
|
+
gt,
|
|
1026
|
+
_t,
|
|
1027
|
+
ht,
|
|
1028
|
+
kt,
|
|
1029
|
+
Ct,
|
|
1032
1030
|
jt,
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1031
|
+
qt,
|
|
1032
|
+
St,
|
|
1033
|
+
$t,
|
|
1034
|
+
Ft,
|
|
1035
|
+
It,
|
|
1036
|
+
Gt,
|
|
1037
|
+
Ot,
|
|
1038
|
+
Mt,
|
|
1039
|
+
Kt,
|
|
1040
|
+
zt,
|
|
1041
|
+
Xt,
|
|
1044
1042
|
Wt,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
).key("feature_type").satisfies(), on = e.object({
|
|
1043
|
+
yt
|
|
1044
|
+
).key("feature_type").satisfies(), tn = e.object({
|
|
1048
1045
|
event_name: e.string(),
|
|
1049
1046
|
rules: e.string(),
|
|
1050
1047
|
since: e.number(),
|
|
1051
1048
|
until: e.number(),
|
|
1052
1049
|
visit_count: e.number().optional(),
|
|
1053
|
-
features: e.array(
|
|
1054
|
-
}).lock(),
|
|
1055
|
-
order_total_amount:
|
|
1056
|
-
cashback_total_amount:
|
|
1057
|
-
game_item_count:
|
|
1058
|
-
}),
|
|
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({
|
|
1059
1056
|
activation_key: e.string().disallow("")
|
|
1060
|
-
}),
|
|
1057
|
+
}), an = e.object({
|
|
1061
1058
|
gift_code: e.string()
|
|
1062
|
-
}),
|
|
1059
|
+
}), on = e.object({
|
|
1063
1060
|
user_id: e.string(),
|
|
1064
1061
|
name: e.string().optional(),
|
|
1065
1062
|
avatar_url: e.string().optional()
|
|
1066
|
-
}),
|
|
1063
|
+
}), sn = e.object({
|
|
1067
1064
|
lottery_count: e.number()
|
|
1068
|
-
}),
|
|
1065
|
+
}), D = e.object({
|
|
1069
1066
|
reward_id: e.number(),
|
|
1070
1067
|
reward_item_id: e.number(),
|
|
1071
|
-
reward_source:
|
|
1068
|
+
reward_source: U,
|
|
1072
1069
|
reward_item_name: e.string(),
|
|
1073
1070
|
reward_item_type: te,
|
|
1074
1071
|
reward_item_icon_url: e.string(),
|
|
1075
1072
|
reward_item_desc: e.string().optional(),
|
|
1076
1073
|
reward_item_rating: e.number(),
|
|
1077
1074
|
reward_amount: e.number(),
|
|
1078
|
-
reward_status:
|
|
1075
|
+
reward_status: $,
|
|
1079
1076
|
event_id: e.number(),
|
|
1080
1077
|
event_name: e.string(),
|
|
1081
1078
|
feature_id: e.number(),
|
|
1082
1079
|
engagement_id: e.number(),
|
|
1083
|
-
feature_type:
|
|
1080
|
+
feature_type: et,
|
|
1084
1081
|
receive_time: e.number(),
|
|
1085
1082
|
// https://kdocs.cn/l/ckWFDcOsYEUA?linkname=merUzJsVYH
|
|
1086
1083
|
// 后续会格式化为具体的类型,此处的校验需要对应增加
|
|
1087
1084
|
extra_data: e.record(e.unknown()).optional()
|
|
1088
|
-
}),
|
|
1085
|
+
}), cn = e.string().enum(k.Unknown, k.Pending), un = e.union(
|
|
1089
1086
|
e.object({
|
|
1090
1087
|
ticket: e.string(),
|
|
1091
|
-
status:
|
|
1088
|
+
status: cn
|
|
1092
1089
|
}),
|
|
1093
1090
|
e.object({
|
|
1094
1091
|
ticket: e.string(),
|
|
1095
|
-
status: e.string().enum(
|
|
1096
|
-
reward:
|
|
1092
|
+
status: e.string().enum(R(k, "Unknown", "Pending")),
|
|
1093
|
+
reward: D
|
|
1097
1094
|
})
|
|
1098
|
-
).satisfies(),
|
|
1099
|
-
tickets: e.array(
|
|
1100
|
-
}),
|
|
1095
|
+
).satisfies(), ln = e.object({
|
|
1096
|
+
tickets: e.array(un)
|
|
1097
|
+
}), mn = e.object({
|
|
1101
1098
|
platforms: e.array(e.string())
|
|
1102
|
-
}),
|
|
1099
|
+
}), dn = e.object({
|
|
1103
1100
|
objective: re,
|
|
1104
1101
|
progress: e.number(),
|
|
1105
1102
|
completion_value: e.number().optional(),
|
|
@@ -1115,24 +1112,24 @@ const j = {
|
|
|
1115
1112
|
})
|
|
1116
1113
|
)
|
|
1117
1114
|
}).optional()
|
|
1118
|
-
}),
|
|
1115
|
+
}), gn = e.object({
|
|
1119
1116
|
platform: e.string()
|
|
1120
|
-
}),
|
|
1117
|
+
}), pn = e.object({
|
|
1121
1118
|
weixin_openid: e.string()
|
|
1122
|
-
}),
|
|
1119
|
+
}), _n = e.object({
|
|
1123
1120
|
serial_number: e.number()
|
|
1124
|
-
}),
|
|
1121
|
+
}), bn = e.object({
|
|
1125
1122
|
team_code: e.string(),
|
|
1126
1123
|
leader_name: e.string(),
|
|
1127
1124
|
total_members: e.number()
|
|
1128
|
-
}),
|
|
1125
|
+
}), xr = e.object({
|
|
1129
1126
|
is_leader: e.bool(),
|
|
1130
1127
|
is_myself: e.bool().optional(),
|
|
1131
1128
|
role_name: e.string(),
|
|
1132
1129
|
server_name: e.string()
|
|
1133
|
-
}),
|
|
1130
|
+
}), yn = e.object({
|
|
1134
1131
|
team_code: e.string(),
|
|
1135
|
-
visibility:
|
|
1132
|
+
visibility: ot,
|
|
1136
1133
|
members: e.array(
|
|
1137
1134
|
e.object({
|
|
1138
1135
|
is_leader: e.bool(),
|
|
@@ -1140,9 +1137,9 @@ const j = {
|
|
|
1140
1137
|
server_name: e.string()
|
|
1141
1138
|
})
|
|
1142
1139
|
)
|
|
1143
|
-
}),
|
|
1140
|
+
}), fn = e.object({
|
|
1144
1141
|
option_sn: e.string()
|
|
1145
|
-
}),
|
|
1142
|
+
}), hn = e.object({
|
|
1146
1143
|
user_id: e.string(),
|
|
1147
1144
|
name: e.string(),
|
|
1148
1145
|
avatar_url: e.string(),
|
|
@@ -1150,37 +1147,37 @@ const j = {
|
|
|
1150
1147
|
video_note: e.number(),
|
|
1151
1148
|
created_at: e.number()
|
|
1152
1149
|
}), I = e.union(
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
fn,
|
|
1156
|
-
un,
|
|
1157
|
-
bn,
|
|
1158
|
-
kn,
|
|
1159
|
-
yn,
|
|
1160
|
-
an,
|
|
1161
|
-
cn,
|
|
1162
|
-
wn,
|
|
1150
|
+
mn,
|
|
1151
|
+
sn,
|
|
1163
1152
|
_n,
|
|
1153
|
+
on,
|
|
1164
1154
|
gn,
|
|
1165
|
-
|
|
1155
|
+
fn,
|
|
1156
|
+
pn,
|
|
1157
|
+
nn,
|
|
1158
|
+
an,
|
|
1159
|
+
yn,
|
|
1160
|
+
dn,
|
|
1161
|
+
ln,
|
|
1162
|
+
rn,
|
|
1166
1163
|
e.custom(
|
|
1167
1164
|
"EmptyObject",
|
|
1168
|
-
(
|
|
1165
|
+
(o) => C(o) && Object.keys(o).length === 0
|
|
1169
1166
|
)
|
|
1170
|
-
).satisfies().lock(),
|
|
1167
|
+
).satisfies().lock(), wn = e.object({
|
|
1171
1168
|
reward_id: e.number(),
|
|
1172
1169
|
reward_item_id: e.number(),
|
|
1173
1170
|
reward_item_type: ne,
|
|
1174
1171
|
reward_count: e.number(),
|
|
1175
|
-
reward_status:
|
|
1176
|
-
reward_source:
|
|
1172
|
+
reward_status: ae,
|
|
1173
|
+
reward_source: U,
|
|
1177
1174
|
reward_item_name: e.string(),
|
|
1178
1175
|
reward_item_icon_url: e.string(),
|
|
1179
1176
|
reward_item_desc: e.string().optional(),
|
|
1180
1177
|
reward_item_rating: e.number(),
|
|
1181
1178
|
receive_time: e.number(),
|
|
1182
1179
|
extra_data: e.union(...I.validators, e.record(e.unknown())).satisfies().optional()
|
|
1183
|
-
}),
|
|
1180
|
+
}), kn = e.object({
|
|
1184
1181
|
reward_id: e.number(),
|
|
1185
1182
|
reward_item_id: e.number(),
|
|
1186
1183
|
reward_item_name: e.string(),
|
|
@@ -1188,10 +1185,10 @@ const j = {
|
|
|
1188
1185
|
reward_item_icon_url: e.string(),
|
|
1189
1186
|
reward_item_desc: e.string().optional(),
|
|
1190
1187
|
reward_amount: e.number(),
|
|
1191
|
-
reward_status:
|
|
1192
|
-
reward_source:
|
|
1188
|
+
reward_status: ae,
|
|
1189
|
+
reward_source: U,
|
|
1193
1190
|
extra_data: e.record(e.unknown()).optional()
|
|
1194
|
-
}),
|
|
1191
|
+
}), vn = e.object({
|
|
1195
1192
|
engagement_id: e.number(),
|
|
1196
1193
|
user_id: e.string(),
|
|
1197
1194
|
event_id: e.number(),
|
|
@@ -1201,15 +1198,15 @@ const j = {
|
|
|
1201
1198
|
server_id: e.string().optional(),
|
|
1202
1199
|
role_id: e.string().optional(),
|
|
1203
1200
|
created_at: e.number(),
|
|
1204
|
-
rewards: e.array(
|
|
1205
|
-
}).lock(),
|
|
1201
|
+
rewards: e.array(wn).optional()
|
|
1202
|
+
}).lock(), Cn = e.object({
|
|
1206
1203
|
allowed: e.bool(),
|
|
1207
1204
|
registered: e.bool()
|
|
1208
|
-
}),
|
|
1205
|
+
}), Rn = e.object({
|
|
1209
1206
|
feature_id: e.number(),
|
|
1210
1207
|
can_engage: e.bool(),
|
|
1211
1208
|
has_unclaimed_rewards: e.bool()
|
|
1212
|
-
}),
|
|
1209
|
+
}), Vn = e.object({
|
|
1213
1210
|
engagement_id: e.number(),
|
|
1214
1211
|
engagement: e.object({
|
|
1215
1212
|
engagement_id: e.number(),
|
|
@@ -1217,50 +1214,52 @@ const j = {
|
|
|
1217
1214
|
feature_id: e.number(),
|
|
1218
1215
|
data: I.clone().optional()
|
|
1219
1216
|
}).optional(),
|
|
1220
|
-
rewards: e.array(
|
|
1217
|
+
rewards: e.array(kn).optional(),
|
|
1221
1218
|
scan: e.bool().optional()
|
|
1222
|
-
}),
|
|
1219
|
+
}), jn = e.object({
|
|
1223
1220
|
reward_id: e.number(),
|
|
1224
|
-
reward_status:
|
|
1225
|
-
}),
|
|
1226
|
-
engagements: e.union(e.array(
|
|
1227
|
-
}),
|
|
1228
|
-
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)
|
|
1229
1231
|
}), Un = s({
|
|
1230
|
-
|
|
1232
|
+
rewards: e.array(D)
|
|
1233
|
+
}), Fn = s({
|
|
1234
|
+
reward_status: $
|
|
1235
|
+
}), Dn = s({
|
|
1236
|
+
user_rewards: e.array(D),
|
|
1231
1237
|
next_token: e.string().optional()
|
|
1232
|
-
}), Fn = e.guard(qn), Dn = s({
|
|
1233
|
-
claimed_items: e.array(xn)
|
|
1234
1238
|
}), In = s({
|
|
1235
|
-
reward_status: U
|
|
1236
|
-
}), An = s({
|
|
1237
|
-
user_rewards: e.array(oe),
|
|
1238
|
-
next_token: e.string().optional()
|
|
1239
|
-
}), Gn = s({
|
|
1240
1239
|
scene: e.string()
|
|
1241
|
-
}),
|
|
1240
|
+
}), An = s({
|
|
1242
1241
|
params: e.string()
|
|
1243
|
-
}),
|
|
1242
|
+
}), Gn = s({
|
|
1244
1243
|
img: e.string()
|
|
1245
1244
|
});
|
|
1246
|
-
class
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
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;
|
|
1252
1251
|
}
|
|
1253
1252
|
/**
|
|
1254
1253
|
* 根据手机号白名单,检查手机号是否允许登录某个游戏
|
|
1255
1254
|
*
|
|
1256
1255
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
|
|
1257
1256
|
*/
|
|
1258
|
-
async verifyMobileAllowed(t,
|
|
1259
|
-
const { data:
|
|
1260
|
-
...
|
|
1261
|
-
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 }
|
|
1262
1261
|
});
|
|
1263
|
-
return
|
|
1262
|
+
return a;
|
|
1264
1263
|
}
|
|
1265
1264
|
/**
|
|
1266
1265
|
* 获取运营活动的基础配置信息
|
|
@@ -1268,32 +1267,32 @@ class Pr {
|
|
|
1268
1267
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
|
|
1269
1268
|
*/
|
|
1270
1269
|
async getConfig(t) {
|
|
1271
|
-
const { data:
|
|
1272
|
-
return
|
|
1270
|
+
const { data: n } = await this.req.get(`event/${this.event}/event-config`, Tn, t);
|
|
1271
|
+
return n;
|
|
1273
1272
|
}
|
|
1274
1273
|
/**
|
|
1275
1274
|
* 获取某个玩法参与用户数量
|
|
1276
1275
|
*
|
|
1277
1276
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1278
1277
|
*/
|
|
1279
|
-
async getEngagementsUserCount(t,
|
|
1280
|
-
const { data:
|
|
1281
|
-
...
|
|
1278
|
+
async getEngagementsUserCount(t, n) {
|
|
1279
|
+
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, S, {
|
|
1280
|
+
...n,
|
|
1282
1281
|
params: { feature_id: t, type: "user" }
|
|
1283
1282
|
});
|
|
1284
|
-
return
|
|
1283
|
+
return r?.count ?? null;
|
|
1285
1284
|
}
|
|
1286
1285
|
/**
|
|
1287
1286
|
* 获取某个玩法参与次数
|
|
1288
1287
|
*
|
|
1289
1288
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
|
|
1290
1289
|
*/
|
|
1291
|
-
async getEngagementsCount(t,
|
|
1292
|
-
const { data:
|
|
1293
|
-
...
|
|
1290
|
+
async getEngagementsCount(t, n) {
|
|
1291
|
+
const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, S, {
|
|
1292
|
+
...n,
|
|
1294
1293
|
params: { feature_id: t, type: "engagement" }
|
|
1295
1294
|
});
|
|
1296
|
-
return
|
|
1295
|
+
return r?.count ?? null;
|
|
1297
1296
|
}
|
|
1298
1297
|
/**
|
|
1299
1298
|
* 获取某个玩法的参与记录(和特定用户无关)
|
|
@@ -1302,29 +1301,29 @@ class Pr {
|
|
|
1302
1301
|
*
|
|
1303
1302
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=THtZ4ewIQW
|
|
1304
1303
|
*/
|
|
1305
|
-
async getEngagements(t,
|
|
1306
|
-
const { data:
|
|
1307
|
-
...
|
|
1304
|
+
async getEngagements(t, n) {
|
|
1305
|
+
const { data: r } = await this.req.get(`event/${this.event}/feature-engagements`, Sn, {
|
|
1306
|
+
...n,
|
|
1308
1307
|
params: { feature_id: t }
|
|
1309
1308
|
});
|
|
1310
|
-
return
|
|
1309
|
+
return r?.engagements || [];
|
|
1311
1310
|
}
|
|
1312
1311
|
/**
|
|
1313
1312
|
* 用户访问某个活动或玩法
|
|
1314
1313
|
*
|
|
1315
1314
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=DWtJrnrBCn
|
|
1316
1315
|
*/
|
|
1317
|
-
async visit(t,
|
|
1316
|
+
async visit(t, n) {
|
|
1318
1317
|
await this.token.autoLogin();
|
|
1319
|
-
const { data:
|
|
1318
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1320
1319
|
`event/${this.event}/visit`,
|
|
1321
1320
|
c(t || {}),
|
|
1322
|
-
|
|
1323
|
-
|
|
1321
|
+
xn,
|
|
1322
|
+
n
|
|
1324
1323
|
);
|
|
1325
|
-
return
|
|
1326
|
-
message:
|
|
1327
|
-
error:
|
|
1324
|
+
return r ?? {
|
|
1325
|
+
message: i,
|
|
1326
|
+
error: a
|
|
1328
1327
|
};
|
|
1329
1328
|
}
|
|
1330
1329
|
/**
|
|
@@ -1336,14 +1335,14 @@ class Pr {
|
|
|
1336
1335
|
*
|
|
1337
1336
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WzX5BrMNpL
|
|
1338
1337
|
*/
|
|
1339
|
-
async getUserFeatureStatus(t,
|
|
1338
|
+
async getUserFeatureStatus(t, n) {
|
|
1340
1339
|
if (!await this.token.autoLogin()) return [];
|
|
1341
|
-
const { data:
|
|
1342
|
-
...
|
|
1340
|
+
const { data: r } = await this.req.get("event/user-feature-status", Ln, {
|
|
1341
|
+
...n,
|
|
1343
1342
|
message: !1,
|
|
1344
1343
|
params: c({ ...t, event_id: this.event })
|
|
1345
1344
|
});
|
|
1346
|
-
return
|
|
1345
|
+
return r?.status || [];
|
|
1347
1346
|
}
|
|
1348
1347
|
/**
|
|
1349
1348
|
* 获取当前登录用户参与某个玩法的记录
|
|
@@ -1352,24 +1351,24 @@ class Pr {
|
|
|
1352
1351
|
*
|
|
1353
1352
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=NFDdV1dwWb
|
|
1354
1353
|
*/
|
|
1355
|
-
async getUserEngagements(t,
|
|
1354
|
+
async getUserEngagements(t, n, r) {
|
|
1356
1355
|
if (!await this.token.autoLogin())
|
|
1357
1356
|
return {
|
|
1358
1357
|
engagements: [],
|
|
1359
1358
|
next_token: ""
|
|
1360
1359
|
};
|
|
1361
|
-
const { data:
|
|
1362
|
-
...
|
|
1360
|
+
const { data: a } = await this.req.get("event/user-engagements", En, {
|
|
1361
|
+
...r,
|
|
1363
1362
|
params: c({
|
|
1364
1363
|
max_results: 20,
|
|
1365
|
-
...
|
|
1364
|
+
...n,
|
|
1366
1365
|
event_id: this.event,
|
|
1367
1366
|
feature_id: t
|
|
1368
1367
|
})
|
|
1369
1368
|
});
|
|
1370
1369
|
return {
|
|
1371
|
-
engagements:
|
|
1372
|
-
next_token:
|
|
1370
|
+
engagements: a?.engagements || [],
|
|
1371
|
+
next_token: a?.next_token || ""
|
|
1373
1372
|
};
|
|
1374
1373
|
}
|
|
1375
1374
|
/**
|
|
@@ -1381,20 +1380,20 @@ class Pr {
|
|
|
1381
1380
|
*
|
|
1382
1381
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=vuOyrcry3S
|
|
1383
1382
|
*/
|
|
1384
|
-
async engage(t,
|
|
1383
|
+
async engage(t, n, r, a) {
|
|
1385
1384
|
await this.token.autoLogin();
|
|
1386
|
-
const { data:
|
|
1385
|
+
const { data: i, code: d, message: l } = await this.req.post(
|
|
1387
1386
|
`event/${this.event}/engage`,
|
|
1388
1387
|
c({
|
|
1389
1388
|
feature_id: t,
|
|
1390
|
-
engagement:
|
|
1391
|
-
...
|
|
1389
|
+
engagement: n,
|
|
1390
|
+
...r
|
|
1392
1391
|
}),
|
|
1393
|
-
|
|
1394
|
-
|
|
1392
|
+
Pn,
|
|
1393
|
+
a
|
|
1395
1394
|
);
|
|
1396
|
-
return
|
|
1397
|
-
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,
|
|
1398
1397
|
error: d
|
|
1399
1398
|
// 没有可领取的激活码
|
|
1400
1399
|
};
|
|
@@ -1402,22 +1401,45 @@ class Pr {
|
|
|
1402
1401
|
/**
|
|
1403
1402
|
* 用户领取除红包和实物奖励以外的所有奖励
|
|
1404
1403
|
*
|
|
1404
|
+
* @deprecated 请优先使用 `claimRewardsV2` 接口
|
|
1405
|
+
*
|
|
1405
1406
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=lCGuqgvUDP
|
|
1406
1407
|
*/
|
|
1407
|
-
async claimRewards(t,
|
|
1408
|
+
async claimRewards(t, n) {
|
|
1408
1409
|
await this.token.autoLogin();
|
|
1409
|
-
const { data:
|
|
1410
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1410
1411
|
"event/claim-rewards",
|
|
1411
1412
|
c({
|
|
1412
1413
|
...t,
|
|
1413
1414
|
server_id: t.server_id ? +t.server_id : void 0
|
|
1414
1415
|
}),
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
), d =
|
|
1418
|
-
return d ? d.map((
|
|
1419
|
-
message:
|
|
1420
|
-
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
|
|
1421
1443
|
};
|
|
1422
1444
|
}
|
|
1423
1445
|
/**
|
|
@@ -1425,17 +1447,17 @@ class Pr {
|
|
|
1425
1447
|
*
|
|
1426
1448
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=aQLhlOAB4Q
|
|
1427
1449
|
*/
|
|
1428
|
-
async claimWeixinHongbao(t,
|
|
1450
|
+
async claimWeixinHongbao(t, n) {
|
|
1429
1451
|
await this.token.autoLogin();
|
|
1430
|
-
const { data:
|
|
1452
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1431
1453
|
"event/claim-weixin-hongbao",
|
|
1432
1454
|
{ reward_id: t },
|
|
1433
|
-
|
|
1434
|
-
|
|
1455
|
+
Fn,
|
|
1456
|
+
n
|
|
1435
1457
|
);
|
|
1436
|
-
return
|
|
1437
|
-
message:
|
|
1438
|
-
error:
|
|
1458
|
+
return r ? (r.reward_status = r.reward_status === _.UnclaimedErr ? _.Unclaimed : r.reward_status, r) : {
|
|
1459
|
+
message: i,
|
|
1460
|
+
error: a
|
|
1439
1461
|
};
|
|
1440
1462
|
}
|
|
1441
1463
|
/**
|
|
@@ -1443,18 +1465,18 @@ class Pr {
|
|
|
1443
1465
|
*
|
|
1444
1466
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=B4xwTbDzhn
|
|
1445
1467
|
*/
|
|
1446
|
-
async verifyActivationKey(t,
|
|
1468
|
+
async verifyActivationKey(t, n) {
|
|
1447
1469
|
if (!this.token.isLoggedIn)
|
|
1448
1470
|
return { error: "not_logged_in" };
|
|
1449
|
-
const { ok:
|
|
1471
|
+
const { ok: r, code: a, message: i } = await this.req.post(
|
|
1450
1472
|
"verify-activation-key",
|
|
1451
1473
|
{ activation_key: t },
|
|
1452
1474
|
null,
|
|
1453
|
-
{ message: !1, ...
|
|
1475
|
+
{ message: !1, ...n }
|
|
1454
1476
|
);
|
|
1455
|
-
return
|
|
1456
|
-
message:
|
|
1457
|
-
error:
|
|
1477
|
+
return r || {
|
|
1478
|
+
message: i,
|
|
1479
|
+
error: a
|
|
1458
1480
|
};
|
|
1459
1481
|
}
|
|
1460
1482
|
/**
|
|
@@ -1462,21 +1484,21 @@ class Pr {
|
|
|
1462
1484
|
*
|
|
1463
1485
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=qj12eIgYQG
|
|
1464
1486
|
*/
|
|
1465
|
-
async getUserRewards(t,
|
|
1487
|
+
async getUserRewards(t, n) {
|
|
1466
1488
|
if (!await this.token.autoLogin())
|
|
1467
1489
|
return {
|
|
1468
1490
|
user_rewards: [],
|
|
1469
1491
|
next_token: ""
|
|
1470
1492
|
};
|
|
1471
|
-
const { data:
|
|
1493
|
+
const { data: r } = await this.req.post(
|
|
1472
1494
|
"event/user-rewards",
|
|
1473
1495
|
c({ max_results: 20, ...t, event_id: this.event }),
|
|
1474
|
-
|
|
1475
|
-
|
|
1496
|
+
Dn,
|
|
1497
|
+
n
|
|
1476
1498
|
);
|
|
1477
1499
|
return {
|
|
1478
|
-
user_rewards: (
|
|
1479
|
-
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 || ""
|
|
1480
1502
|
};
|
|
1481
1503
|
}
|
|
1482
1504
|
/**
|
|
@@ -1484,23 +1506,23 @@ class Pr {
|
|
|
1484
1506
|
*
|
|
1485
1507
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=mnGCTeTgMb
|
|
1486
1508
|
*/
|
|
1487
|
-
async getUserItemCount(t,
|
|
1509
|
+
async getUserItemCount(t, n) {
|
|
1488
1510
|
if (!await this.token.autoLogin()) return null;
|
|
1489
|
-
const { data:
|
|
1490
|
-
...
|
|
1511
|
+
const { data: r } = await this.req.get(`event/${this.event}/user-item-count`, S, {
|
|
1512
|
+
...n,
|
|
1491
1513
|
params: { item_id: t }
|
|
1492
1514
|
});
|
|
1493
|
-
return
|
|
1515
|
+
return r?.count ?? null;
|
|
1494
1516
|
}
|
|
1495
1517
|
/**
|
|
1496
1518
|
* 填写实物奖励收货地址,返回 null 表示未登录
|
|
1497
1519
|
*
|
|
1498
1520
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=QIwGhnaexb
|
|
1499
1521
|
*/
|
|
1500
|
-
async submitUserRewardAddress(t,
|
|
1522
|
+
async submitUserRewardAddress(t, n) {
|
|
1501
1523
|
if (!await this.token.autoLogin()) return null;
|
|
1502
|
-
const { ok:
|
|
1503
|
-
return
|
|
1524
|
+
const { ok: r } = await this.req.post(`event/${this.event}/user-reward-address`, t, null, n);
|
|
1525
|
+
return r;
|
|
1504
1526
|
}
|
|
1505
1527
|
/**
|
|
1506
1528
|
* 小程序码携带参数最多 32 个可见字符,若前端携带参数过长,则将参数保存在 api 中,并返回符合小程序码要求的 scene
|
|
@@ -1509,13 +1531,13 @@ class Pr {
|
|
|
1509
1531
|
*
|
|
1510
1532
|
* @param params - 前端扫描二维码打开小程序所需参数
|
|
1511
1533
|
*/
|
|
1512
|
-
async getUnlimitQrcodeScene(t,
|
|
1534
|
+
async getUnlimitQrcodeScene(t, n) {
|
|
1513
1535
|
if (!await this.token.autoLogin()) return null;
|
|
1514
|
-
const { data:
|
|
1515
|
-
...
|
|
1536
|
+
const { data: r } = await this.req.get("event/unlimit-qrcode-scene", In, {
|
|
1537
|
+
...n,
|
|
1516
1538
|
params: { params: t }
|
|
1517
1539
|
});
|
|
1518
|
-
return
|
|
1540
|
+
return r?.scene ?? null;
|
|
1519
1541
|
}
|
|
1520
1542
|
/**
|
|
1521
1543
|
* 根据小程序码携带 scene 值,获取对应的前端所需参数
|
|
@@ -1524,35 +1546,35 @@ class Pr {
|
|
|
1524
1546
|
*
|
|
1525
1547
|
* @param scene - 小程序码 scene 值
|
|
1526
1548
|
*/
|
|
1527
|
-
async getParamsByQrcodeScene(t,
|
|
1528
|
-
const { data:
|
|
1529
|
-
...
|
|
1549
|
+
async getParamsByQrcodeScene(t, n) {
|
|
1550
|
+
const { data: r } = await this.req.get("event/params-by-qrcode-scene", An, {
|
|
1551
|
+
...n,
|
|
1530
1552
|
params: { scene: t }
|
|
1531
1553
|
});
|
|
1532
|
-
return
|
|
1554
|
+
return r?.params ?? null;
|
|
1533
1555
|
}
|
|
1534
1556
|
/**
|
|
1535
1557
|
* 生成不限制的带参数的小程序码(dataURI 格式的小程序码图片)
|
|
1536
1558
|
*
|
|
1537
1559
|
* https://kdocs.cn/l/ckWFDcOsYEUA?linkname=Rvmoq8iIy0
|
|
1538
1560
|
*/
|
|
1539
|
-
async generateUnlimitQrcode(t,
|
|
1561
|
+
async generateUnlimitQrcode(t, n) {
|
|
1540
1562
|
if (!await this.token.autoLogin()) return null;
|
|
1541
|
-
const { data:
|
|
1563
|
+
const { data: r } = await this.req.post(
|
|
1542
1564
|
"event/unlimit-qrcode",
|
|
1543
1565
|
c(t),
|
|
1544
|
-
|
|
1545
|
-
|
|
1566
|
+
Gn,
|
|
1567
|
+
n
|
|
1546
1568
|
);
|
|
1547
|
-
return
|
|
1569
|
+
return r?.img ?? null;
|
|
1548
1570
|
}
|
|
1549
1571
|
}
|
|
1550
|
-
const
|
|
1572
|
+
const Nn = {
|
|
1551
1573
|
/** 所有人均可以发帖 */
|
|
1552
1574
|
All: "all",
|
|
1553
1575
|
/** 指定用户可发帖 */
|
|
1554
1576
|
Limit: "limit"
|
|
1555
|
-
},
|
|
1577
|
+
}, On = e.string().enum(Nn).lock(), Bn = {
|
|
1556
1578
|
/** 待审核(仅自己可见) */
|
|
1557
1579
|
Pending: "pending",
|
|
1558
1580
|
/** 审核通过 */
|
|
@@ -1561,14 +1583,14 @@ const Bn = {
|
|
|
1561
1583
|
Failed: "failed",
|
|
1562
1584
|
/** 嫌疑(仅自己可见) */
|
|
1563
1585
|
Suspect: "suspect"
|
|
1564
|
-
},
|
|
1586
|
+
}, ie = e.string().enum(Bn).lock(), Mn = {
|
|
1565
1587
|
/** 系统通知 */
|
|
1566
1588
|
System: "system",
|
|
1567
1589
|
/** 评论我的 */
|
|
1568
1590
|
Comment: "comment",
|
|
1569
1591
|
/** 点赞通知 */
|
|
1570
1592
|
Like: "like"
|
|
1571
|
-
},
|
|
1593
|
+
}, Lr = e.string().enum(Mn).lock(), g = {
|
|
1572
1594
|
/** 系统通知 */
|
|
1573
1595
|
System: "system",
|
|
1574
1596
|
/** 帖子被置顶 */
|
|
@@ -1593,13 +1615,13 @@ const Bn = {
|
|
|
1593
1615
|
ReplyLiked: "reply_liked",
|
|
1594
1616
|
/** 回复被删除 */
|
|
1595
1617
|
ReplyDeleted: "reply_deleted"
|
|
1596
|
-
},
|
|
1618
|
+
}, Qn = e.string().enum(g).lock(), oe = e.object({
|
|
1597
1619
|
forum_id: e.number(),
|
|
1598
1620
|
icon_url: e.string(),
|
|
1599
1621
|
name: e.string(),
|
|
1600
1622
|
tags: e.array(e.string()),
|
|
1601
1623
|
sort: e.number(),
|
|
1602
|
-
mode:
|
|
1624
|
+
mode: On,
|
|
1603
1625
|
member_ids: e.array(e.number())
|
|
1604
1626
|
}).lock(), A = e.object({
|
|
1605
1627
|
topic_id: e.number(),
|
|
@@ -1610,7 +1632,7 @@ const Bn = {
|
|
|
1610
1632
|
post_num: e.number()
|
|
1611
1633
|
}).lock(), G = e.object({
|
|
1612
1634
|
post_id: e.number(),
|
|
1613
|
-
forum:
|
|
1635
|
+
forum: oe,
|
|
1614
1636
|
posted_by: e.string(),
|
|
1615
1637
|
nickname: e.string(),
|
|
1616
1638
|
avatar_url: e.string(),
|
|
@@ -1626,17 +1648,17 @@ const Bn = {
|
|
|
1626
1648
|
event_ids: e.array(e.number()),
|
|
1627
1649
|
is_pinned: e.bool(),
|
|
1628
1650
|
is_highlighted: e.bool(),
|
|
1629
|
-
status:
|
|
1651
|
+
status: ie,
|
|
1630
1652
|
create_time: e.number()
|
|
1631
|
-
}).lock(),
|
|
1653
|
+
}).lock(), se = e.object({
|
|
1632
1654
|
err_msg: e.string().optional()
|
|
1633
|
-
}).lock(),
|
|
1655
|
+
}).lock(), Kn = e.object({
|
|
1634
1656
|
reply_id: e.number(),
|
|
1635
1657
|
reply_content: e.string().optional(),
|
|
1636
1658
|
replied_by: e.string(),
|
|
1637
1659
|
nickname: e.string(),
|
|
1638
1660
|
avatar_url: e.string()
|
|
1639
|
-
}).lock(),
|
|
1661
|
+
}).lock(), j = e.object({
|
|
1640
1662
|
reply_id: e.number(),
|
|
1641
1663
|
comment_id: e.number(),
|
|
1642
1664
|
comment_content: e.string().optional(),
|
|
@@ -1649,9 +1671,9 @@ const Bn = {
|
|
|
1649
1671
|
content: e.string(),
|
|
1650
1672
|
like_num: e.number(),
|
|
1651
1673
|
liked: e.bool(),
|
|
1652
|
-
reply_to:
|
|
1674
|
+
reply_to: Kn,
|
|
1653
1675
|
create_time: e.number()
|
|
1654
|
-
}).lock(),
|
|
1676
|
+
}).lock(), v = e.object({
|
|
1655
1677
|
comment_id: e.number(),
|
|
1656
1678
|
post_id: e.number(),
|
|
1657
1679
|
post_subject: e.string().optional(),
|
|
@@ -1669,21 +1691,21 @@ const Bn = {
|
|
|
1669
1691
|
liked: e.bool(),
|
|
1670
1692
|
image_url: e.string(),
|
|
1671
1693
|
create_time: e.number(),
|
|
1672
|
-
status:
|
|
1673
|
-
replies: e.array(
|
|
1674
|
-
}).lock(),
|
|
1694
|
+
status: ie,
|
|
1695
|
+
replies: e.array(j).optional()
|
|
1696
|
+
}).lock(), Hn = e.object({
|
|
1675
1697
|
image_url: e.string(),
|
|
1676
1698
|
upload_url: e.string(),
|
|
1677
1699
|
existed: e.bool()
|
|
1678
|
-
}).lock(),
|
|
1700
|
+
}).lock(), y = e.object({
|
|
1679
1701
|
notification_id: e.string(),
|
|
1680
|
-
notification_type:
|
|
1702
|
+
notification_type: Qn,
|
|
1681
1703
|
is_read: e.bool(),
|
|
1682
1704
|
create_time: e.number(),
|
|
1683
1705
|
origin_user_id: e.string(),
|
|
1684
1706
|
origin_user_name: e.string(),
|
|
1685
1707
|
origin_user_avatar_url: e.string()
|
|
1686
|
-
}).lock(),
|
|
1708
|
+
}).lock(), zn = e.object({
|
|
1687
1709
|
system_message_subject: e.string(),
|
|
1688
1710
|
system_message_content: e.string()
|
|
1689
1711
|
}).lock(), N = e.object({
|
|
@@ -1691,87 +1713,87 @@ const Bn = {
|
|
|
1691
1713
|
post_subject: e.string(),
|
|
1692
1714
|
post_summary: e.string(),
|
|
1693
1715
|
post_image_url: e.string()
|
|
1694
|
-
}).lock(),
|
|
1716
|
+
}).lock(), T = e.object({
|
|
1695
1717
|
comment_id: e.number(),
|
|
1696
1718
|
comment_content: e.string()
|
|
1697
1719
|
}).lock(), O = e.object({
|
|
1698
1720
|
reply_id: e.number(),
|
|
1699
1721
|
reply_content: e.string()
|
|
1700
|
-
}).lock(),
|
|
1701
|
-
...
|
|
1702
|
-
...
|
|
1703
|
-
notification_type: e.string().enum(
|
|
1704
|
-
}),
|
|
1705
|
-
...
|
|
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,
|
|
1706
1728
|
...N.shape,
|
|
1707
1729
|
notification_type: e.string().enum(
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1730
|
+
g.PostPinned,
|
|
1731
|
+
g.PostHighlighted,
|
|
1732
|
+
g.PostDeleted,
|
|
1733
|
+
g.PostLiked
|
|
1712
1734
|
)
|
|
1713
|
-
}),
|
|
1714
|
-
...
|
|
1735
|
+
}), Yn = e.object({
|
|
1736
|
+
...y.shape,
|
|
1715
1737
|
...N.shape,
|
|
1716
|
-
...
|
|
1717
|
-
notification_type: e.string().enum(
|
|
1718
|
-
}),
|
|
1719
|
-
...
|
|
1720
|
-
...
|
|
1738
|
+
...T.shape,
|
|
1739
|
+
notification_type: e.string().enum(g.PostCommented)
|
|
1740
|
+
}), Zn = e.object({
|
|
1741
|
+
...y.shape,
|
|
1742
|
+
...T.shape,
|
|
1721
1743
|
...O.shape,
|
|
1722
|
-
notification_type: e.string().enum(
|
|
1723
|
-
}),
|
|
1724
|
-
...
|
|
1725
|
-
...
|
|
1744
|
+
notification_type: e.string().enum(g.CommentReplied)
|
|
1745
|
+
}), Wn = e.object({
|
|
1746
|
+
...y.shape,
|
|
1747
|
+
...T.shape,
|
|
1726
1748
|
...N.shape,
|
|
1727
|
-
notification_type: e.string().enum(
|
|
1728
|
-
}),
|
|
1729
|
-
...
|
|
1749
|
+
notification_type: e.string().enum(g.CommentLiked, g.CommentDeleted)
|
|
1750
|
+
}), er = e.object({
|
|
1751
|
+
...y.shape,
|
|
1730
1752
|
...O.shape,
|
|
1731
|
-
notification_type: e.string().enum(
|
|
1753
|
+
notification_type: e.string().enum(g.ReplyReplied),
|
|
1732
1754
|
comment_id: e.number(),
|
|
1733
1755
|
reply_to_reply_id: e.number(),
|
|
1734
1756
|
reply_to_reply_content: e.string()
|
|
1735
|
-
}),
|
|
1736
|
-
...
|
|
1757
|
+
}), tr = e.object({
|
|
1758
|
+
...y.shape,
|
|
1737
1759
|
...O.shape,
|
|
1738
|
-
...
|
|
1739
|
-
notification_type: e.string().enum(
|
|
1740
|
-
}),
|
|
1760
|
+
...T.shape,
|
|
1761
|
+
notification_type: e.string().enum(g.ReplyLiked, g.ReplyDeleted)
|
|
1762
|
+
}), nr = e.union(
|
|
1763
|
+
Jn,
|
|
1764
|
+
Xn,
|
|
1741
1765
|
Yn,
|
|
1742
1766
|
Zn,
|
|
1743
1767
|
Wn,
|
|
1744
1768
|
er,
|
|
1745
|
-
tr
|
|
1746
|
-
|
|
1747
|
-
rr
|
|
1748
|
-
).satisfies().lock(), or = s({ forums: e.array(se) }), ar = s({ topics: e.array(A) }), sr = s({ topic: A }), cr = s({ post: G }), z = s({
|
|
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({
|
|
1749
1771
|
posts: e.array(G),
|
|
1750
1772
|
next_token: e.string().optional()
|
|
1751
|
-
}),
|
|
1752
|
-
replies: e.array(
|
|
1773
|
+
}), sr = s({ post: G, antispam: se }), cr = s({
|
|
1774
|
+
replies: e.array(j),
|
|
1753
1775
|
next_token: e.string().optional()
|
|
1754
|
-
}),
|
|
1755
|
-
reply:
|
|
1756
|
-
antispam:
|
|
1757
|
-
}),
|
|
1758
|
-
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),
|
|
1759
1781
|
next_token: e.string().optional()
|
|
1760
|
-
}),
|
|
1761
|
-
comment:
|
|
1762
|
-
antispam:
|
|
1763
|
-
}),
|
|
1764
|
-
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),
|
|
1765
1787
|
next_token: e.string().optional()
|
|
1766
|
-
}),
|
|
1788
|
+
}), br = s({
|
|
1767
1789
|
system: e.number(),
|
|
1768
1790
|
comment: e.number(),
|
|
1769
1791
|
like: e.number()
|
|
1770
1792
|
});
|
|
1771
|
-
class
|
|
1793
|
+
class Er {
|
|
1794
|
+
token;
|
|
1795
|
+
req;
|
|
1772
1796
|
constructor(t) {
|
|
1773
|
-
m(this, "token");
|
|
1774
|
-
m(this, "req");
|
|
1775
1797
|
this.token = t, this.req = t.req;
|
|
1776
1798
|
}
|
|
1777
1799
|
/**
|
|
@@ -1780,8 +1802,8 @@ class Ur {
|
|
|
1780
1802
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0
|
|
1781
1803
|
*/
|
|
1782
1804
|
async getForums(t) {
|
|
1783
|
-
const { data:
|
|
1784
|
-
return
|
|
1805
|
+
const { data: n } = await this.req.get("community/forums", rr, t);
|
|
1806
|
+
return n?.forums || [];
|
|
1785
1807
|
}
|
|
1786
1808
|
/**
|
|
1787
1809
|
* 获取社区话题列表,仅返回启用状态的话题
|
|
@@ -1789,34 +1811,34 @@ class Ur {
|
|
|
1789
1811
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom
|
|
1790
1812
|
*/
|
|
1791
1813
|
async getTopics(t) {
|
|
1792
|
-
const { data:
|
|
1793
|
-
return
|
|
1814
|
+
const { data: n } = await this.req.get("community/topics", ar, t);
|
|
1815
|
+
return n?.topics || [];
|
|
1794
1816
|
}
|
|
1795
1817
|
/**
|
|
1796
1818
|
* 根据话题 ID 获取社区话题信息
|
|
1797
1819
|
*
|
|
1798
1820
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K
|
|
1799
1821
|
*/
|
|
1800
|
-
async getTopic(t,
|
|
1801
|
-
const { data:
|
|
1802
|
-
...
|
|
1822
|
+
async getTopic(t, n) {
|
|
1823
|
+
const { data: r, code: a } = await this.req.get("community/topic", ir, {
|
|
1824
|
+
...n,
|
|
1803
1825
|
params: { topic_id: t }
|
|
1804
1826
|
});
|
|
1805
|
-
return
|
|
1827
|
+
return r?.topic ?? { error: a };
|
|
1806
1828
|
}
|
|
1807
1829
|
/**
|
|
1808
1830
|
* 获取社区帖子列表
|
|
1809
1831
|
*
|
|
1810
1832
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
|
|
1811
1833
|
*/
|
|
1812
|
-
async getPosts(t,
|
|
1813
|
-
const { data:
|
|
1814
|
-
...
|
|
1834
|
+
async getPosts(t, n) {
|
|
1835
|
+
const { data: r, code: a, message: i } = await this.req.get("community/posts", z, {
|
|
1836
|
+
...n,
|
|
1815
1837
|
params: c(t)
|
|
1816
1838
|
});
|
|
1817
|
-
return
|
|
1818
|
-
message:
|
|
1819
|
-
error:
|
|
1839
|
+
return r ?? {
|
|
1840
|
+
message: i,
|
|
1841
|
+
error: a
|
|
1820
1842
|
};
|
|
1821
1843
|
}
|
|
1822
1844
|
/**
|
|
@@ -1824,13 +1846,13 @@ class Ur {
|
|
|
1824
1846
|
*
|
|
1825
1847
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
|
|
1826
1848
|
*/
|
|
1827
|
-
async getPinnedPosts(t,
|
|
1828
|
-
const { data:
|
|
1829
|
-
...
|
|
1830
|
-
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 })
|
|
1831
1853
|
});
|
|
1832
|
-
return
|
|
1833
|
-
message:
|
|
1854
|
+
return i ?? {
|
|
1855
|
+
message: l,
|
|
1834
1856
|
error: d
|
|
1835
1857
|
};
|
|
1836
1858
|
}
|
|
@@ -1839,14 +1861,14 @@ class Ur {
|
|
|
1839
1861
|
*
|
|
1840
1862
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
|
|
1841
1863
|
*/
|
|
1842
|
-
async getPost(t,
|
|
1843
|
-
const { data:
|
|
1844
|
-
...
|
|
1864
|
+
async getPost(t, n) {
|
|
1865
|
+
const { data: r, code: a, message: i } = await this.req.get("community/post", or, {
|
|
1866
|
+
...n,
|
|
1845
1867
|
params: { post_id: t }
|
|
1846
1868
|
});
|
|
1847
|
-
return
|
|
1848
|
-
message:
|
|
1849
|
-
error:
|
|
1869
|
+
return r?.post ?? {
|
|
1870
|
+
message: i,
|
|
1871
|
+
error: a
|
|
1850
1872
|
};
|
|
1851
1873
|
}
|
|
1852
1874
|
/**
|
|
@@ -1854,16 +1876,16 @@ class Ur {
|
|
|
1854
1876
|
*
|
|
1855
1877
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
|
|
1856
1878
|
*/
|
|
1857
|
-
async post(t,
|
|
1858
|
-
const { data:
|
|
1879
|
+
async post(t, n) {
|
|
1880
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1859
1881
|
"community/post",
|
|
1860
1882
|
c(t),
|
|
1861
|
-
|
|
1862
|
-
|
|
1883
|
+
sr,
|
|
1884
|
+
n
|
|
1863
1885
|
);
|
|
1864
|
-
return
|
|
1865
|
-
message:
|
|
1866
|
-
error:
|
|
1886
|
+
return r ?? {
|
|
1887
|
+
message: i,
|
|
1888
|
+
error: a
|
|
1867
1889
|
};
|
|
1868
1890
|
}
|
|
1869
1891
|
/**
|
|
@@ -1871,14 +1893,14 @@ class Ur {
|
|
|
1871
1893
|
*
|
|
1872
1894
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp
|
|
1873
1895
|
*/
|
|
1874
|
-
async getComments(t,
|
|
1875
|
-
const { data:
|
|
1876
|
-
...
|
|
1896
|
+
async getComments(t, n) {
|
|
1897
|
+
const { data: r, code: a, message: i } = await this.req.get("community/comments", dr, {
|
|
1898
|
+
...n,
|
|
1877
1899
|
params: c(t)
|
|
1878
1900
|
});
|
|
1879
|
-
return
|
|
1880
|
-
message:
|
|
1881
|
-
error:
|
|
1901
|
+
return r ?? {
|
|
1902
|
+
message: i,
|
|
1903
|
+
error: a
|
|
1882
1904
|
};
|
|
1883
1905
|
}
|
|
1884
1906
|
/**
|
|
@@ -1886,14 +1908,14 @@ class Ur {
|
|
|
1886
1908
|
*
|
|
1887
1909
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=RIc7oxVGae
|
|
1888
1910
|
*/
|
|
1889
|
-
async getComment(t,
|
|
1890
|
-
const { data:
|
|
1891
|
-
...
|
|
1911
|
+
async getComment(t, n) {
|
|
1912
|
+
const { data: r, code: a, message: i } = await this.req.get("community/comment", mr, {
|
|
1913
|
+
...n,
|
|
1892
1914
|
params: { comment_id: t }
|
|
1893
1915
|
});
|
|
1894
|
-
return
|
|
1895
|
-
message:
|
|
1896
|
-
error:
|
|
1916
|
+
return r?.comment ?? {
|
|
1917
|
+
message: i,
|
|
1918
|
+
error: a
|
|
1897
1919
|
};
|
|
1898
1920
|
}
|
|
1899
1921
|
/**
|
|
@@ -1901,17 +1923,17 @@ class Ur {
|
|
|
1901
1923
|
*
|
|
1902
1924
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=Nv7lk0nTmr
|
|
1903
1925
|
*/
|
|
1904
|
-
async comment(t,
|
|
1926
|
+
async comment(t, n) {
|
|
1905
1927
|
await this.token.autoLogin();
|
|
1906
|
-
const { data:
|
|
1928
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1907
1929
|
"community/comment",
|
|
1908
1930
|
c(t),
|
|
1909
|
-
|
|
1910
|
-
|
|
1931
|
+
gr,
|
|
1932
|
+
n
|
|
1911
1933
|
);
|
|
1912
|
-
return
|
|
1913
|
-
message:
|
|
1914
|
-
error:
|
|
1934
|
+
return r ?? {
|
|
1935
|
+
message: i,
|
|
1936
|
+
error: a
|
|
1915
1937
|
};
|
|
1916
1938
|
}
|
|
1917
1939
|
/**
|
|
@@ -1919,14 +1941,14 @@ class Ur {
|
|
|
1919
1941
|
*
|
|
1920
1942
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY
|
|
1921
1943
|
*/
|
|
1922
|
-
async getReplies(t,
|
|
1923
|
-
const { data:
|
|
1924
|
-
...
|
|
1944
|
+
async getReplies(t, n) {
|
|
1945
|
+
const { data: r } = await this.req.get("community/replies", cr, {
|
|
1946
|
+
...n,
|
|
1925
1947
|
params: c({ max_results: 20, ...t })
|
|
1926
1948
|
});
|
|
1927
1949
|
return {
|
|
1928
|
-
replies:
|
|
1929
|
-
next_token:
|
|
1950
|
+
replies: r?.replies || [],
|
|
1951
|
+
next_token: r?.next_token || ""
|
|
1930
1952
|
};
|
|
1931
1953
|
}
|
|
1932
1954
|
/**
|
|
@@ -1934,14 +1956,14 @@ class Ur {
|
|
|
1934
1956
|
*
|
|
1935
1957
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG
|
|
1936
1958
|
*/
|
|
1937
|
-
async getReply(t,
|
|
1938
|
-
const { data:
|
|
1939
|
-
...
|
|
1959
|
+
async getReply(t, n) {
|
|
1960
|
+
const { data: r, code: a, message: i } = await this.req.get("community/reply", ur, {
|
|
1961
|
+
...n,
|
|
1940
1962
|
params: { reply_id: t }
|
|
1941
1963
|
});
|
|
1942
|
-
return
|
|
1943
|
-
message:
|
|
1944
|
-
error:
|
|
1964
|
+
return r?.reply ?? {
|
|
1965
|
+
message: i,
|
|
1966
|
+
error: a
|
|
1945
1967
|
};
|
|
1946
1968
|
}
|
|
1947
1969
|
/**
|
|
@@ -1949,17 +1971,17 @@ class Ur {
|
|
|
1949
1971
|
*
|
|
1950
1972
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=KA8WpTX2pg
|
|
1951
1973
|
*/
|
|
1952
|
-
async reply(t,
|
|
1974
|
+
async reply(t, n) {
|
|
1953
1975
|
await this.token.autoLogin();
|
|
1954
|
-
const { data:
|
|
1976
|
+
const { data: r, code: a, message: i } = await this.req.post(
|
|
1955
1977
|
"community/reply",
|
|
1956
1978
|
c(t),
|
|
1957
|
-
|
|
1958
|
-
|
|
1979
|
+
lr,
|
|
1980
|
+
n
|
|
1959
1981
|
);
|
|
1960
|
-
return
|
|
1961
|
-
message:
|
|
1962
|
-
error:
|
|
1982
|
+
return r ?? {
|
|
1983
|
+
message: i,
|
|
1984
|
+
error: a
|
|
1963
1985
|
};
|
|
1964
1986
|
}
|
|
1965
1987
|
/**
|
|
@@ -1967,17 +1989,17 @@ class Ur {
|
|
|
1967
1989
|
*
|
|
1968
1990
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
|
|
1969
1991
|
*/
|
|
1970
|
-
async like(t,
|
|
1992
|
+
async like(t, n) {
|
|
1971
1993
|
await this.token.autoLogin();
|
|
1972
|
-
const { ok:
|
|
1994
|
+
const { ok: r, code: a, message: i } = await this.req.post(
|
|
1973
1995
|
"community/like",
|
|
1974
1996
|
{ ...t, action: "like" },
|
|
1975
1997
|
null,
|
|
1976
|
-
|
|
1998
|
+
n
|
|
1977
1999
|
);
|
|
1978
|
-
return
|
|
1979
|
-
message:
|
|
1980
|
-
error:
|
|
2000
|
+
return r || {
|
|
2001
|
+
message: i,
|
|
2002
|
+
error: a
|
|
1981
2003
|
};
|
|
1982
2004
|
}
|
|
1983
2005
|
/**
|
|
@@ -1985,17 +2007,17 @@ class Ur {
|
|
|
1985
2007
|
*
|
|
1986
2008
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
|
|
1987
2009
|
*/
|
|
1988
|
-
async unlike(t,
|
|
2010
|
+
async unlike(t, n) {
|
|
1989
2011
|
await this.token.autoLogin();
|
|
1990
|
-
const { ok:
|
|
2012
|
+
const { ok: r, code: a, message: i } = await this.req.post(
|
|
1991
2013
|
"community/like",
|
|
1992
2014
|
{ ...t, action: "unlike" },
|
|
1993
2015
|
null,
|
|
1994
|
-
|
|
2016
|
+
n
|
|
1995
2017
|
);
|
|
1996
|
-
return
|
|
1997
|
-
message:
|
|
1998
|
-
error:
|
|
2018
|
+
return r || {
|
|
2019
|
+
message: i,
|
|
2020
|
+
error: a
|
|
1999
2021
|
};
|
|
2000
2022
|
}
|
|
2001
2023
|
/**
|
|
@@ -2003,13 +2025,13 @@ class Ur {
|
|
|
2003
2025
|
*
|
|
2004
2026
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=dWWhpoShxZ
|
|
2005
2027
|
*/
|
|
2006
|
-
async getMediaPresignedUrl(t,
|
|
2028
|
+
async getMediaPresignedUrl(t, n) {
|
|
2007
2029
|
await this.token.autoLogin();
|
|
2008
|
-
const { data:
|
|
2009
|
-
...
|
|
2030
|
+
const { data: r } = await this.req.get("community/media-presign-url", pr, {
|
|
2031
|
+
...n,
|
|
2010
2032
|
params: t
|
|
2011
2033
|
});
|
|
2012
|
-
return
|
|
2034
|
+
return r;
|
|
2013
2035
|
}
|
|
2014
2036
|
/**
|
|
2015
2037
|
* 获取用户社区通知
|
|
@@ -2018,15 +2040,15 @@ class Ur {
|
|
|
2018
2040
|
*
|
|
2019
2041
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=W5lceDgbBG
|
|
2020
2042
|
*/
|
|
2021
|
-
async getNotifications(t,
|
|
2043
|
+
async getNotifications(t, n) {
|
|
2022
2044
|
await this.token.autoLogin();
|
|
2023
|
-
const { data:
|
|
2024
|
-
...
|
|
2045
|
+
const { data: r } = await this.req.get("community/notifications", _r, {
|
|
2046
|
+
...n,
|
|
2025
2047
|
params: c({ max_results: 20, ...t })
|
|
2026
2048
|
});
|
|
2027
2049
|
return {
|
|
2028
|
-
notifications:
|
|
2029
|
-
next_token:
|
|
2050
|
+
notifications: r?.notifications || [],
|
|
2051
|
+
next_token: r?.next_token || ""
|
|
2030
2052
|
};
|
|
2031
2053
|
}
|
|
2032
2054
|
/**
|
|
@@ -2036,35 +2058,38 @@ class Ur {
|
|
|
2036
2058
|
*/
|
|
2037
2059
|
async getUnreadNotificationsCount(t) {
|
|
2038
2060
|
if (!await this.token.autoLogin()) return null;
|
|
2039
|
-
const { data:
|
|
2061
|
+
const { data: n } = await this.req.get(
|
|
2040
2062
|
"community/unread-notifications-count",
|
|
2041
|
-
|
|
2063
|
+
br,
|
|
2042
2064
|
t
|
|
2043
2065
|
);
|
|
2044
|
-
return
|
|
2066
|
+
return n;
|
|
2045
2067
|
}
|
|
2046
2068
|
/**
|
|
2047
2069
|
* 社区用户将通知标为已读
|
|
2048
2070
|
*
|
|
2049
2071
|
* https://kdocs.cn/l/cbggfJodHLIz?linkname=TCJQxnOjJe
|
|
2050
2072
|
*/
|
|
2051
|
-
async clearUnreadNotifications(t,
|
|
2073
|
+
async clearUnreadNotifications(t, n) {
|
|
2052
2074
|
if (!await this.token.autoLogin()) return !1;
|
|
2053
|
-
const { ok:
|
|
2054
|
-
return
|
|
2075
|
+
const { ok: r } = await this.req.post("community/clear-unread-notifications", { category: t }, null, n);
|
|
2076
|
+
return r;
|
|
2055
2077
|
}
|
|
2056
2078
|
}
|
|
2057
|
-
const
|
|
2079
|
+
const yr = s({
|
|
2058
2080
|
nonce_str: e.string(),
|
|
2059
2081
|
timestamp: e.number(),
|
|
2060
2082
|
signature: e.string()
|
|
2061
2083
|
});
|
|
2062
|
-
var
|
|
2063
|
-
function
|
|
2064
|
-
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");
|
|
2065
2087
|
}
|
|
2066
2088
|
const J = "wx_login_cache";
|
|
2067
|
-
class
|
|
2089
|
+
class Pr {
|
|
2090
|
+
token;
|
|
2091
|
+
$appid;
|
|
2092
|
+
req;
|
|
2068
2093
|
/**
|
|
2069
2094
|
* 创建微信相关功能接口
|
|
2070
2095
|
*
|
|
@@ -2078,11 +2103,8 @@ class Fr {
|
|
|
2078
2103
|
*
|
|
2079
2104
|
* https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
|
|
2080
2105
|
*/
|
|
2081
|
-
constructor(t,
|
|
2082
|
-
|
|
2083
|
-
m(this, "$appid");
|
|
2084
|
-
m(this, "req");
|
|
2085
|
-
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();
|
|
2086
2108
|
}
|
|
2087
2109
|
get appid() {
|
|
2088
2110
|
return this.$appid;
|
|
@@ -2098,8 +2120,8 @@ class Fr {
|
|
|
2098
2120
|
const t = this.token.storage.get(J);
|
|
2099
2121
|
if (!t)
|
|
2100
2122
|
return null;
|
|
2101
|
-
const
|
|
2102
|
-
return
|
|
2123
|
+
const n = pe(t);
|
|
2124
|
+
return L(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
|
|
2103
2125
|
}
|
|
2104
2126
|
/**
|
|
2105
2127
|
* 小程序页面微信静默登录,获取 weixinToken / open_id / union_id。
|
|
@@ -2119,20 +2141,20 @@ class Fr {
|
|
|
2119
2141
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
|
|
2120
2142
|
*/
|
|
2121
2143
|
async login(t) {
|
|
2122
|
-
if (!
|
|
2144
|
+
if (!b.wx)
|
|
2123
2145
|
throw new Error("当前环境非微信小程序");
|
|
2124
|
-
const
|
|
2125
|
-
if (
|
|
2126
|
-
return
|
|
2127
|
-
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(
|
|
2128
2150
|
"weixin/login",
|
|
2129
|
-
{ code:
|
|
2130
|
-
|
|
2151
|
+
{ code: r, appid: this.appid },
|
|
2152
|
+
L,
|
|
2131
2153
|
{ ...t, message: !1 }
|
|
2132
2154
|
);
|
|
2133
|
-
return
|
|
2155
|
+
return a && (this.token.weixinToken = a.weixin_token, this.token.storage.set(J, JSON.stringify(a)), await this.token.autoLogin()), a ?? {
|
|
2134
2156
|
message: d,
|
|
2135
|
-
error:
|
|
2157
|
+
error: i
|
|
2136
2158
|
};
|
|
2137
2159
|
}
|
|
2138
2160
|
/**
|
|
@@ -2151,30 +2173,30 @@ class Fr {
|
|
|
2151
2173
|
* - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 union_id 则需要 snsapi_userinfo
|
|
2152
2174
|
* - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、union_id、昵称、头像等信息,但用户也可能会拒绝授权
|
|
2153
2175
|
*/
|
|
2154
|
-
async webLogin(t = "snsapi_userinfo",
|
|
2155
|
-
const
|
|
2156
|
-
if (!
|
|
2157
|
-
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"]);
|
|
2158
2180
|
location.replace(
|
|
2159
|
-
`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`
|
|
2160
2182
|
);
|
|
2161
2183
|
return;
|
|
2162
2184
|
}
|
|
2163
|
-
if (/^100\d{2}$/.test(
|
|
2185
|
+
if (/^100\d{2}$/.test(r))
|
|
2164
2186
|
return {
|
|
2165
|
-
message: "Error: " +
|
|
2166
|
-
error:
|
|
2187
|
+
message: "Error: " + r,
|
|
2188
|
+
error: r
|
|
2167
2189
|
};
|
|
2168
2190
|
const d = B(["code", "state"]);
|
|
2169
2191
|
"replaceState" in history && history.replaceState({}, "", d);
|
|
2170
2192
|
const {
|
|
2171
|
-
data:
|
|
2172
|
-
code:
|
|
2173
|
-
message:
|
|
2174
|
-
} = await this.req.post("weixin/login", { code:
|
|
2175
|
-
return
|
|
2176
|
-
message:
|
|
2177
|
-
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
|
|
2178
2200
|
};
|
|
2179
2201
|
}
|
|
2180
2202
|
/**
|
|
@@ -2189,14 +2211,14 @@ class Fr {
|
|
|
2189
2211
|
* @param weixinToken 调用 login 后,得到的 weixinToken,如果 weixinToken 为空则跳过不处理
|
|
2190
2212
|
* @param gameCode 从游戏内跳转至小程序时,通过请求参数 query 携带的 game_code,如果值为空则跳过不处理
|
|
2191
2213
|
*/
|
|
2192
|
-
async linkPlayer(t,
|
|
2193
|
-
if (!t || !
|
|
2214
|
+
async linkPlayer(t, n, r) {
|
|
2215
|
+
if (!t || !n)
|
|
2194
2216
|
return !1;
|
|
2195
|
-
const { ok:
|
|
2196
|
-
...
|
|
2217
|
+
const { ok: a } = await this.req.post("weixin/link-player", { weixin_token: t, game_code: n }, null, {
|
|
2218
|
+
...r,
|
|
2197
2219
|
message: !1
|
|
2198
2220
|
});
|
|
2199
|
-
return
|
|
2221
|
+
return a;
|
|
2200
2222
|
}
|
|
2201
2223
|
/**
|
|
2202
2224
|
* 获取集成 JSSDK 所需的签名信息
|
|
@@ -2204,162 +2226,162 @@ class Fr {
|
|
|
2204
2226
|
* https://kdocs.cn/l/cf2mO2uRLqh9?linkname=CuWOqxr9Ue
|
|
2205
2227
|
*/
|
|
2206
2228
|
async getJSSDKConfig(t) {
|
|
2207
|
-
const { data:
|
|
2229
|
+
const { data: n } = await this.req.get("weixin/offiaccount/jssdk-sign", yr, {
|
|
2208
2230
|
...t,
|
|
2209
2231
|
params: {
|
|
2210
2232
|
appid: this.appid,
|
|
2211
2233
|
url: location.href.split("#")[0]
|
|
2212
2234
|
}
|
|
2213
2235
|
});
|
|
2214
|
-
return
|
|
2236
|
+
return n ? {
|
|
2215
2237
|
appid: this.appid,
|
|
2216
|
-
nonceStr:
|
|
2217
|
-
timestamp:
|
|
2218
|
-
signature:
|
|
2238
|
+
nonceStr: n.nonce_str,
|
|
2239
|
+
timestamp: n.timestamp,
|
|
2240
|
+
signature: n.signature
|
|
2219
2241
|
} : null;
|
|
2220
2242
|
}
|
|
2221
2243
|
}
|
|
2222
2244
|
export {
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
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,
|
|
2230
2252
|
Z as ClubAddressValidator,
|
|
2231
|
-
|
|
2253
|
+
Cr as ClubApi,
|
|
2232
2254
|
W as ClubBenefitSummaryValidator,
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
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,
|
|
2241
2263
|
X as ClubItemTypeValidator,
|
|
2242
|
-
|
|
2264
|
+
Se as ClubPlayerValidator,
|
|
2243
2265
|
ee as ClubProductValidator,
|
|
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
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
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,
|
|
2283
2305
|
u as FeatureType,
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2306
|
+
et as FeatureTypeValidator,
|
|
2307
|
+
Nn as ForumMode,
|
|
2308
|
+
On as ForumModeValidator,
|
|
2309
|
+
oe as ForumValidator,
|
|
2310
|
+
V as GamerItemType,
|
|
2289
2311
|
te as GamerItemTypeValidator,
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
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,
|
|
2306
2328
|
N as NotificationPayloadPostValidator,
|
|
2307
2329
|
O as NotificationPayloadReplyValidator,
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
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,
|
|
2318
2340
|
Y as PlayerRoleValidator,
|
|
2319
|
-
|
|
2320
|
-
|
|
2341
|
+
Bn as PostStatus,
|
|
2342
|
+
ie as PostStatusValidator,
|
|
2321
2343
|
G as PostValidator,
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2344
|
+
mn as PreregisterEngagementDataValidator,
|
|
2345
|
+
Hn as PresignedUrlResponseValidator,
|
|
2346
|
+
dn as QuestEngagementDataValidator,
|
|
2347
|
+
tt as QuestObjective,
|
|
2326
2348
|
re as QuestObjectiveValidator,
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2349
|
+
vr as RedeemParamsValidator,
|
|
2350
|
+
Ge as RedemptionValidator,
|
|
2351
|
+
lt as RegularRewardValidator,
|
|
2352
|
+
Kn as ReplyToValidator,
|
|
2353
|
+
j as ReplyValidator,
|
|
2354
|
+
Rr as RewardItemType,
|
|
2333
2355
|
ne as RewardItemTypeValidator,
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
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,
|
|
2352
2374
|
A as TopicValidator,
|
|
2353
2375
|
I as UserEngagementDataValidator,
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
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
|
|
2365
2387
|
};
|