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