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