@seayoo-web/gamer-api 4.1.3 → 4.2.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 +170 -130
- package/package.json +5 -5
- package/types/index.d.ts +1 -0
- package/types/src/event.config/feature.vote2.d.ts +2 -0
- package/types/src/ggd.d.ts +31 -0
- package/types/src/ggd.enum.d.ts +22 -0
package/dist/index.js
CHANGED
|
@@ -12,10 +12,10 @@ function se(e) {
|
|
|
12
12
|
return t(e);
|
|
13
13
|
}
|
|
14
14
|
ne("GamerApiSDK");
|
|
15
|
-
function
|
|
15
|
+
function d(e) {
|
|
16
16
|
return /^\/[a-z\d-]+$/.test(e);
|
|
17
17
|
}
|
|
18
|
-
async function
|
|
18
|
+
async function ce() {
|
|
19
19
|
let { promise: e, resolve: t } = re();
|
|
20
20
|
return wx.login({
|
|
21
21
|
success(e) {
|
|
@@ -28,7 +28,7 @@ async function le() {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/token.ts
|
|
31
|
-
var
|
|
31
|
+
var f = "gamer_token", le = class {
|
|
32
32
|
_NetRequest;
|
|
33
33
|
_idToken = "";
|
|
34
34
|
_weixinToken = "";
|
|
@@ -37,7 +37,7 @@ var d = "gamer_token", ue = class {
|
|
|
37
37
|
storage;
|
|
38
38
|
constructor(t, r) {
|
|
39
39
|
this.storage = c() ? ie : n;
|
|
40
|
-
let i =
|
|
40
|
+
let i = d(t) ? t : `https://${o(t)}`;
|
|
41
41
|
if (this._NetRequest = r, this.req = r({
|
|
42
42
|
baseURL: `${i}/v1`,
|
|
43
43
|
timeout: 1e4,
|
|
@@ -64,7 +64,7 @@ var d = "gamer_token", ue = class {
|
|
|
64
64
|
return this._NetRequest;
|
|
65
65
|
}
|
|
66
66
|
loadGamerTokenCache() {
|
|
67
|
-
let e = this.storage.get(
|
|
67
|
+
let e = this.storage.get(f).match(/^(\d{12,})#(.{8,})$/);
|
|
68
68
|
if (e) {
|
|
69
69
|
let t = parseInt(e[1]), n = e[2];
|
|
70
70
|
if (t > Date.now() - (24 * 3600 - 10) * 1e3) {
|
|
@@ -72,7 +72,7 @@ var d = "gamer_token", ue = class {
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
this.storage.remove(
|
|
75
|
+
this.storage.remove(f);
|
|
76
76
|
}
|
|
77
77
|
get isLoggedIn() {
|
|
78
78
|
return this._gamerToken !== "";
|
|
@@ -93,7 +93,7 @@ var d = "gamer_token", ue = class {
|
|
|
93
93
|
return this._gamerToken;
|
|
94
94
|
}
|
|
95
95
|
set gamerToken(e) {
|
|
96
|
-
this._gamerToken = e, e ? this.storage.set(
|
|
96
|
+
this._gamerToken = e, e ? this.storage.set(f, `${Date.now()}#${e}`) : this.storage.remove(f);
|
|
97
97
|
}
|
|
98
98
|
logout() {
|
|
99
99
|
this._idToken = "", this._weixinToken = "", this.gamerToken = "";
|
|
@@ -142,30 +142,30 @@ var d = "gamer_token", ue = class {
|
|
|
142
142
|
let { data: t } = await this.req.post("auth-real-name", a(e), se);
|
|
143
143
|
return t;
|
|
144
144
|
}
|
|
145
|
-
},
|
|
145
|
+
}, ue = {
|
|
146
146
|
Unknown: "unknown",
|
|
147
147
|
Male: "male",
|
|
148
148
|
Female: "female"
|
|
149
|
-
},
|
|
149
|
+
}, de = u.string().enum(ue).lock(), fe = {
|
|
150
150
|
Increase: "increase",
|
|
151
151
|
Decrease: "decrease",
|
|
152
152
|
Expired: "expired"
|
|
153
|
-
},
|
|
153
|
+
}, pe = u.string().enum(fe).lock(), me = {
|
|
154
154
|
Order: "order",
|
|
155
155
|
Consumption: "consumption",
|
|
156
156
|
Redeem: "redeem",
|
|
157
157
|
Expire: "expire",
|
|
158
158
|
Admin: "admin",
|
|
159
159
|
Event: "event"
|
|
160
|
-
},
|
|
160
|
+
}, he = u.string().enum(me).lock(), ge = {
|
|
161
161
|
GameReward: "game_reward",
|
|
162
162
|
Physical: "physical",
|
|
163
163
|
Virtual: "virtual"
|
|
164
|
-
},
|
|
164
|
+
}, p = u.string().enum(ge).lock(), _e = {
|
|
165
165
|
Pending: "pending",
|
|
166
166
|
Issued: "issued",
|
|
167
167
|
Failed: "failed"
|
|
168
|
-
},
|
|
168
|
+
}, ve = u.string().enum(_e).lock(), ye = u.object({
|
|
169
169
|
default_avatar_url: u.string(),
|
|
170
170
|
official_avatar_urls: u.array(u.string()),
|
|
171
171
|
default_nickname: u.string(),
|
|
@@ -181,7 +181,7 @@ var d = "gamer_token", ue = class {
|
|
|
181
181
|
exp_description: u.string(),
|
|
182
182
|
credit_description: u.string(),
|
|
183
183
|
send_role_mail_rate_limit: u.number()
|
|
184
|
-
}).lock(),
|
|
184
|
+
}).lock(), be = u.object({
|
|
185
185
|
member_id: u.string(),
|
|
186
186
|
player_id: u.string(),
|
|
187
187
|
exp: u.number(),
|
|
@@ -190,28 +190,28 @@ var d = "gamer_token", ue = class {
|
|
|
190
190
|
credit_expiring: u.number(),
|
|
191
191
|
level_change_time: u.number(),
|
|
192
192
|
level_expire_time: u.number()
|
|
193
|
-
}).lock(),
|
|
193
|
+
}).lock(), xe = u.object({
|
|
194
194
|
server_id: u.string(),
|
|
195
195
|
server_name: u.string()
|
|
196
|
-
}).lock(),
|
|
196
|
+
}).lock(), Se = u.object({
|
|
197
197
|
role_id: u.string(),
|
|
198
198
|
role_name: u.string()
|
|
199
|
-
}).lock(),
|
|
200
|
-
...Ce.shape,
|
|
199
|
+
}).lock(), m = u.object({
|
|
201
200
|
...Se.shape,
|
|
201
|
+
...xe.shape,
|
|
202
202
|
role_level: u.number(),
|
|
203
203
|
last_login_time: u.number()
|
|
204
|
-
}).lock(),
|
|
205
|
-
...
|
|
204
|
+
}).lock(), Ce = u.object({
|
|
205
|
+
...m.shape,
|
|
206
206
|
role_fighting: u.number(),
|
|
207
207
|
kin_id: u.string().optional(),
|
|
208
208
|
kin_name: u.string().optional(),
|
|
209
209
|
kin_position: u.string().optional()
|
|
210
|
-
}).lock(),
|
|
210
|
+
}).lock(), we = u.object({
|
|
211
211
|
name: u.string(),
|
|
212
212
|
avatar_url: u.string(),
|
|
213
213
|
bio: u.string(),
|
|
214
|
-
gender:
|
|
214
|
+
gender: de,
|
|
215
215
|
birthday: u.object({
|
|
216
216
|
year: u.number(),
|
|
217
217
|
month: u.number(),
|
|
@@ -221,7 +221,7 @@ var d = "gamer_token", ue = class {
|
|
|
221
221
|
homepage_url: u.string(),
|
|
222
222
|
homepage_image_url: u.string()
|
|
223
223
|
}).optional()).optional()
|
|
224
|
-
}).lock(),
|
|
224
|
+
}).lock(), h = u.object({
|
|
225
225
|
address_id: u.number(),
|
|
226
226
|
recipient: u.string(),
|
|
227
227
|
mobile: u.string(),
|
|
@@ -230,20 +230,20 @@ var d = "gamer_token", ue = class {
|
|
|
230
230
|
district: u.string(),
|
|
231
231
|
address: u.string(),
|
|
232
232
|
is_default: u.bool()
|
|
233
|
-
}).lock(),
|
|
233
|
+
}).lock(), Te = u.object({
|
|
234
234
|
increased_credit: u.number(),
|
|
235
235
|
decreased_credit: u.number(),
|
|
236
236
|
expired_credit: u.number(),
|
|
237
237
|
balance_credit: u.number()
|
|
238
|
-
}).lock(),
|
|
238
|
+
}).lock(), Ee = u.object({
|
|
239
239
|
id: u.number(),
|
|
240
|
-
change_type:
|
|
241
|
-
change_scene:
|
|
240
|
+
change_type: pe,
|
|
241
|
+
change_scene: he,
|
|
242
242
|
change_credit: u.number(),
|
|
243
243
|
balance: u.number(),
|
|
244
244
|
change_time: u.number(),
|
|
245
245
|
metadata: u.record(u.unknown()).optional()
|
|
246
|
-
}).lock(),
|
|
246
|
+
}).lock(), g = u.object({
|
|
247
247
|
benefit_id: u.number(),
|
|
248
248
|
name: u.string(),
|
|
249
249
|
img_url: u.string(),
|
|
@@ -252,11 +252,11 @@ var d = "gamer_token", ue = class {
|
|
|
252
252
|
max_level: u.number(),
|
|
253
253
|
product_id: u.number(),
|
|
254
254
|
tag: u.string()
|
|
255
|
-
}).lock(),
|
|
255
|
+
}).lock(), _ = u.object({
|
|
256
256
|
product_id: u.number(),
|
|
257
257
|
catalog_id: u.number(),
|
|
258
258
|
catalog_name: u.string(),
|
|
259
|
-
item_type:
|
|
259
|
+
item_type: p,
|
|
260
260
|
name: u.string(),
|
|
261
261
|
img_url: u.string(),
|
|
262
262
|
description: u.string(),
|
|
@@ -278,13 +278,13 @@ var d = "gamer_token", ue = class {
|
|
|
278
278
|
created_at: u.number(),
|
|
279
279
|
updated_at: u.number(),
|
|
280
280
|
redeemable_quantity: u.number().optional()
|
|
281
|
-
}).lock(),
|
|
282
|
-
...r(
|
|
283
|
-
product:
|
|
284
|
-
}).lock(),
|
|
281
|
+
}).lock(), De = u.object({
|
|
282
|
+
...r(g.shape, "tag"),
|
|
283
|
+
product: _.clone().optional()
|
|
284
|
+
}).lock(), Oe = u.union(u.object({
|
|
285
285
|
server_id: u.string(),
|
|
286
286
|
role_id: u.string()
|
|
287
|
-
}), u.object({ address_id: u.number() })).satisfies().lock(),
|
|
287
|
+
}), u.object({ address_id: u.number() })).satisfies().lock(), ke = u.object({
|
|
288
288
|
recipient: u.string(),
|
|
289
289
|
mobile: u.string(),
|
|
290
290
|
province: u.string(),
|
|
@@ -293,35 +293,35 @@ var d = "gamer_token", ue = class {
|
|
|
293
293
|
address: u.string(),
|
|
294
294
|
express_company: u.string(),
|
|
295
295
|
express_number: u.string()
|
|
296
|
-
}).lock(),
|
|
296
|
+
}).lock(), Ae = u.object({
|
|
297
297
|
server_id: u.string(),
|
|
298
298
|
role_id: u.string(),
|
|
299
299
|
role_name: u.string()
|
|
300
|
-
}).lock(),
|
|
300
|
+
}).lock(), je = u.object({
|
|
301
301
|
redemption_id: u.number(),
|
|
302
302
|
player_id: u.string(),
|
|
303
303
|
product_id: u.number(),
|
|
304
304
|
name: u.string(),
|
|
305
305
|
img_url: u.string(),
|
|
306
|
-
item_type:
|
|
306
|
+
item_type: p,
|
|
307
307
|
catalog_id: u.number(),
|
|
308
308
|
catalog_name: u.string(),
|
|
309
309
|
quantity: u.number(),
|
|
310
310
|
amount: u.number(),
|
|
311
|
-
status:
|
|
311
|
+
status: ve,
|
|
312
312
|
created_at: u.number(),
|
|
313
|
-
extra_data: u.union(
|
|
314
|
-
}),
|
|
315
|
-
credit_logs: u.array(
|
|
313
|
+
extra_data: u.union(ke.clone(), Ae.clone()).satisfies().optional()
|
|
314
|
+
}), Me = u.guard(ye), v = l({ player: be }), Ne = l({ roles: u.array(m) }), y = l({ role_card: Ce }), b = u.guard(we), x = u.guard(h), Pe = l({ addresses: u.array(h) }), Fe = u.guard(Te), Ie = l({
|
|
315
|
+
credit_logs: u.array(Ee),
|
|
316
316
|
next_token: u.string().optional()
|
|
317
|
-
}),
|
|
318
|
-
redemptions: u.array(
|
|
317
|
+
}), Le = l({ products: u.array(_) }), Re = l({ benefits: u.array(g) }), ze = l({ benefit: De }), Be = l({
|
|
318
|
+
redemptions: u.array(je),
|
|
319
319
|
next_token: u.string().optional()
|
|
320
|
-
}),
|
|
320
|
+
}), Ve = l({
|
|
321
321
|
existed: u.bool(),
|
|
322
322
|
image_upload_url: u.string().optional(),
|
|
323
323
|
image_id: u.string()
|
|
324
|
-
}),
|
|
324
|
+
}), He = class {
|
|
325
325
|
token;
|
|
326
326
|
req;
|
|
327
327
|
constructor(e) {
|
|
@@ -329,12 +329,12 @@ var d = "gamer_token", ue = class {
|
|
|
329
329
|
}
|
|
330
330
|
async getConfig(e) {
|
|
331
331
|
await this.token.autoLogin();
|
|
332
|
-
let { data: t } = await this.req.get("club/config", null,
|
|
332
|
+
let { data: t } = await this.req.get("club/config", null, Me, e);
|
|
333
333
|
return t;
|
|
334
334
|
}
|
|
335
335
|
async getCurrentPlayer(e) {
|
|
336
336
|
await this.token.autoLogin();
|
|
337
|
-
let { data: t, code: n, message: r } = await this.req.get("club/current-player", null,
|
|
337
|
+
let { data: t, code: n, message: r } = await this.req.get("club/current-player", null, v, e);
|
|
338
338
|
return t?.player ?? {
|
|
339
339
|
message: r,
|
|
340
340
|
error: n
|
|
@@ -342,7 +342,7 @@ var d = "gamer_token", ue = class {
|
|
|
342
342
|
}
|
|
343
343
|
async linkPlayer(e) {
|
|
344
344
|
await this.token.autoLogin();
|
|
345
|
-
let { data: t, code: n, message: r } = await this.req.post("club/link-player", { id_token: this.token.idToken },
|
|
345
|
+
let { data: t, code: n, message: r } = await this.req.post("club/link-player", { id_token: this.token.idToken }, v, e);
|
|
346
346
|
return t?.player ?? {
|
|
347
347
|
message: r,
|
|
348
348
|
error: n
|
|
@@ -353,27 +353,27 @@ var d = "gamer_token", ue = class {
|
|
|
353
353
|
let { data: r } = await this.req.get("club/roles", {
|
|
354
354
|
player_id: e,
|
|
355
355
|
refresh: t
|
|
356
|
-
},
|
|
356
|
+
}, Ne, n);
|
|
357
357
|
return r?.roles || [];
|
|
358
358
|
}
|
|
359
359
|
async getRoleCard(e, t) {
|
|
360
360
|
await this.token.autoLogin();
|
|
361
|
-
let { data: n } = await this.req.get("club/role-card", { member_id: e },
|
|
361
|
+
let { data: n } = await this.req.get("club/role-card", { member_id: e }, y, t);
|
|
362
362
|
return n?.role_card ?? null;
|
|
363
363
|
}
|
|
364
364
|
async setRoleCard(e, t) {
|
|
365
365
|
if (!await this.token.autoLogin()) return null;
|
|
366
|
-
let { data: n } = await this.req.post("club/role-card", e,
|
|
366
|
+
let { data: n } = await this.req.post("club/role-card", e, y, t);
|
|
367
367
|
return n?.role_card ?? null;
|
|
368
368
|
}
|
|
369
369
|
async refreshRoleCard(e) {
|
|
370
370
|
if (!await this.token.autoLogin()) return null;
|
|
371
|
-
let { data: t } = await this.req.post("club/refresh-role-card", {},
|
|
371
|
+
let { data: t } = await this.req.post("club/refresh-role-card", {}, y, e);
|
|
372
372
|
return t?.role_card ?? null;
|
|
373
373
|
}
|
|
374
374
|
async getUserProfile(e, t) {
|
|
375
375
|
await this.token.autoLogin();
|
|
376
|
-
let { data: n } = await this.req.get("club/user-profile", { member_id: e },
|
|
376
|
+
let { data: n } = await this.req.get("club/user-profile", { member_id: e }, b, t);
|
|
377
377
|
return n;
|
|
378
378
|
}
|
|
379
379
|
async updateUserProfile(e, t) {
|
|
@@ -382,7 +382,7 @@ var d = "gamer_token", ue = class {
|
|
|
382
382
|
message: "请提供需要修改的信息"
|
|
383
383
|
};
|
|
384
384
|
await this.token.autoLogin();
|
|
385
|
-
let { data: n, code: r, message: i } = await this.req.post("club/user-profile", e,
|
|
385
|
+
let { data: n, code: r, message: i } = await this.req.post("club/user-profile", e, b, t);
|
|
386
386
|
return n ?? {
|
|
387
387
|
message: i,
|
|
388
388
|
error: r
|
|
@@ -390,12 +390,12 @@ var d = "gamer_token", ue = class {
|
|
|
390
390
|
}
|
|
391
391
|
async getAddresses(e) {
|
|
392
392
|
if (!await this.token.autoLogin()) return [];
|
|
393
|
-
let { data: t } = await this.req.get("club/addresses", null,
|
|
393
|
+
let { data: t } = await this.req.get("club/addresses", null, Pe, e);
|
|
394
394
|
return t?.addresses ?? [];
|
|
395
395
|
}
|
|
396
396
|
async addAddress(e, t) {
|
|
397
397
|
if (!await this.token.autoLogin()) return null;
|
|
398
|
-
let { data: n, code: r, message: i } = await this.req.post("/club/add-address", a(e),
|
|
398
|
+
let { data: n, code: r, message: i } = await this.req.post("/club/add-address", a(e), x, t);
|
|
399
399
|
return n ?? {
|
|
400
400
|
message: i,
|
|
401
401
|
error: r
|
|
@@ -403,7 +403,7 @@ var d = "gamer_token", ue = class {
|
|
|
403
403
|
}
|
|
404
404
|
async updateAddress(e, t) {
|
|
405
405
|
await this.token.autoLogin();
|
|
406
|
-
let { data: n, code: r, message: i } = await this.req.post("club/update-address", a(e),
|
|
406
|
+
let { data: n, code: r, message: i } = await this.req.post("club/update-address", a(e), x, t);
|
|
407
407
|
return n ?? {
|
|
408
408
|
message: i,
|
|
409
409
|
error: r
|
|
@@ -416,7 +416,7 @@ var d = "gamer_token", ue = class {
|
|
|
416
416
|
}
|
|
417
417
|
async getUserCredit(e, t) {
|
|
418
418
|
await this.token.autoLogin();
|
|
419
|
-
let { data: n, code: r, message: i } = await this.req.get("club/user-credit", { ...e },
|
|
419
|
+
let { data: n, code: r, message: i } = await this.req.get("club/user-credit", { ...e }, Fe, t);
|
|
420
420
|
return n ?? {
|
|
421
421
|
message: i,
|
|
422
422
|
error: r
|
|
@@ -427,7 +427,7 @@ var d = "gamer_token", ue = class {
|
|
|
427
427
|
let { data: n } = await this.req.get("club/credit-logs", {
|
|
428
428
|
max_results: 20,
|
|
429
429
|
...e
|
|
430
|
-
},
|
|
430
|
+
}, Ie, t);
|
|
431
431
|
return {
|
|
432
432
|
credit_logs: n?.credit_logs || [],
|
|
433
433
|
next_token: n?.next_token
|
|
@@ -435,17 +435,17 @@ var d = "gamer_token", ue = class {
|
|
|
435
435
|
}
|
|
436
436
|
async getBenefits(e) {
|
|
437
437
|
if (!await this.token.autoLogin()) return [];
|
|
438
|
-
let { data: t } = await this.req.get("club/benefits", null,
|
|
438
|
+
let { data: t } = await this.req.get("club/benefits", null, Re, e);
|
|
439
439
|
return t?.benefits || [];
|
|
440
440
|
}
|
|
441
441
|
async getBenefit(e, t) {
|
|
442
442
|
if (!await this.token.autoLogin()) return null;
|
|
443
|
-
let { data: n } = await this.req.get("club/benefit", { benefit_id: e },
|
|
443
|
+
let { data: n } = await this.req.get("club/benefit", { benefit_id: e }, ze, t);
|
|
444
444
|
return n?.benefit || null;
|
|
445
445
|
}
|
|
446
446
|
async getProducts(e, t) {
|
|
447
447
|
await this.token.autoLogin();
|
|
448
|
-
let { data: n } = await this.req.get("club/products", e || null,
|
|
448
|
+
let { data: n } = await this.req.get("club/products", e || null, Le, t);
|
|
449
449
|
return n?.products || [];
|
|
450
450
|
}
|
|
451
451
|
async redeemProduct(e, t) {
|
|
@@ -461,7 +461,7 @@ var d = "gamer_token", ue = class {
|
|
|
461
461
|
let { data: n } = await this.req.get("club/redemptions", {
|
|
462
462
|
max_results: 20,
|
|
463
463
|
...e
|
|
464
|
-
},
|
|
464
|
+
}, Be, t);
|
|
465
465
|
return {
|
|
466
466
|
redemptions: n?.redemptions || [],
|
|
467
467
|
next_token: n?.next_token
|
|
@@ -469,13 +469,13 @@ var d = "gamer_token", ue = class {
|
|
|
469
469
|
}
|
|
470
470
|
async clubUploadImage(e, t) {
|
|
471
471
|
await this.token.autoLogin();
|
|
472
|
-
let { data: n, code: r, message: i } = await this.req.post("club/image-upload-url", a(e),
|
|
472
|
+
let { data: n, code: r, message: i } = await this.req.post("club/image-upload-url", a(e), Ve, t);
|
|
473
473
|
return n ?? {
|
|
474
474
|
message: i,
|
|
475
475
|
error: r
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
},
|
|
478
|
+
}, Ue = class {
|
|
479
479
|
token;
|
|
480
480
|
req;
|
|
481
481
|
_event = 0;
|
|
@@ -490,7 +490,7 @@ var d = "gamer_token", ue = class {
|
|
|
490
490
|
for (let [n, r] of Object.entries(e)) r && (t[n] = r.bind(this));
|
|
491
491
|
return t;
|
|
492
492
|
}
|
|
493
|
-
},
|
|
493
|
+
}, S = {
|
|
494
494
|
EventItem: "event_item",
|
|
495
495
|
GameItem: "game_item",
|
|
496
496
|
PhysicalItem: "physical_item",
|
|
@@ -502,10 +502,10 @@ var d = "gamer_token", ue = class {
|
|
|
502
502
|
ClubExp: "club_exp",
|
|
503
503
|
ExternalCode: "external_gift_code",
|
|
504
504
|
VoidItem: "void_item"
|
|
505
|
-
},
|
|
505
|
+
}, C = u.string().enum(S).lock(), We = S, w = C, Ge = {
|
|
506
506
|
UserId: "user_id",
|
|
507
507
|
RoleId: "role_id"
|
|
508
|
-
}, Ke = u.string().enum(
|
|
508
|
+
}, Ke = u.string().enum(Ge).lock(), qe = {
|
|
509
509
|
None: "none",
|
|
510
510
|
Daily: "daily",
|
|
511
511
|
Weekly: "weekly",
|
|
@@ -610,7 +610,7 @@ var d = "gamer_token", ue = class {
|
|
|
610
610
|
Submitted: "submitted",
|
|
611
611
|
Accepted: "accepted",
|
|
612
612
|
Rejected: "rejected"
|
|
613
|
-
}, mt = u.string().enum(pt).lock(), ht = u.string().enum(
|
|
613
|
+
}, mt = u.string().enum(pt).lock(), ht = u.string().enum(S), N = u.object({
|
|
614
614
|
reward_item_id: u.number(),
|
|
615
615
|
reward_amount: u.number(),
|
|
616
616
|
reward_item_name: u.string(),
|
|
@@ -693,7 +693,7 @@ var d = "gamer_token", ue = class {
|
|
|
693
693
|
}), Ft = T.InvitedRegister, It = u.object({
|
|
694
694
|
...P.shape,
|
|
695
695
|
feature_type: u.string().enum(Ft)
|
|
696
|
-
}), Lt = u.string().enum(r(
|
|
696
|
+
}), Lt = u.string().enum(r(S, "GiftCode", "LotteryTicket")), Rt = T.Lottery, zt = u.object({
|
|
697
697
|
reward_item_id: u.number(),
|
|
698
698
|
reward_item_name: u.string(),
|
|
699
699
|
reward_item_type: Lt,
|
|
@@ -827,7 +827,7 @@ var d = "gamer_token", ue = class {
|
|
|
827
827
|
reward_item_id: u.number(),
|
|
828
828
|
reward_source: A,
|
|
829
829
|
reward_item_name: u.string(),
|
|
830
|
-
reward_item_type:
|
|
830
|
+
reward_item_type: C,
|
|
831
831
|
reward_item_icon_url: u.string(),
|
|
832
832
|
reward_item_desc: u.string().optional(),
|
|
833
833
|
reward_item_rating: u.number(),
|
|
@@ -983,7 +983,7 @@ var d = "gamer_token", ue = class {
|
|
|
983
983
|
}), z = u.union(xn, _n, kn, gn, Dn, R, zn, On, I, hn, Mn, Cn, bn, mn, Un, Nn, Tn, u.custom("EmptyObject", (e) => t(e) && Object.keys(e).length === 0)).satisfies().lock(), Gn = u.object({
|
|
984
984
|
reward_id: u.number(),
|
|
985
985
|
reward_item_id: u.number(),
|
|
986
|
-
reward_item_type:
|
|
986
|
+
reward_item_type: w,
|
|
987
987
|
reward_count: u.number(),
|
|
988
988
|
reward_status: O,
|
|
989
989
|
reward_source: A,
|
|
@@ -997,7 +997,7 @@ var d = "gamer_token", ue = class {
|
|
|
997
997
|
reward_id: u.number(),
|
|
998
998
|
reward_item_id: u.number(),
|
|
999
999
|
reward_item_name: u.string(),
|
|
1000
|
-
reward_item_type:
|
|
1000
|
+
reward_item_type: w,
|
|
1001
1001
|
reward_item_icon_url: u.string(),
|
|
1002
1002
|
reward_item_desc: u.string().optional(),
|
|
1003
1003
|
reward_item_rating: u.number(),
|
|
@@ -1062,7 +1062,8 @@ var d = "gamer_token", ue = class {
|
|
|
1062
1062
|
rewards_since: u.number(),
|
|
1063
1063
|
rewards_until: u.number(),
|
|
1064
1064
|
winner_rewards: u.array(N).optional(),
|
|
1065
|
-
consolation_rewards: u.array(N).optional()
|
|
1065
|
+
consolation_rewards: u.array(N).optional(),
|
|
1066
|
+
max_votes_per_user_per_candidate_per_cycle: u.number().optional()
|
|
1066
1067
|
})
|
|
1067
1068
|
}), tr = T.ZeroChatgpt, nr = u.object({
|
|
1068
1069
|
...P.shape,
|
|
@@ -1372,21 +1373,60 @@ async function ci(e, t) {
|
|
|
1372
1373
|
error: r
|
|
1373
1374
|
};
|
|
1374
1375
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
var li = u.number().enum({
|
|
1377
|
+
Waiting: 1,
|
|
1378
|
+
Playing: 2
|
|
1379
|
+
}).lock(), ui = class {
|
|
1380
|
+
req;
|
|
1381
|
+
constructor(e, t) {
|
|
1382
|
+
let n = d(e) ? e : `https://${o(e)}`;
|
|
1383
|
+
this.req = t({
|
|
1384
|
+
baseURL: `${n}/v1/ggd`,
|
|
1385
|
+
timeout: 1e4,
|
|
1386
|
+
maxRetry: 2,
|
|
1387
|
+
retryInterval: "2EB",
|
|
1388
|
+
responseRule: {
|
|
1389
|
+
ok: { resolve: "body" },
|
|
1390
|
+
failed: {
|
|
1391
|
+
resolve: "json",
|
|
1392
|
+
statusField: "error",
|
|
1393
|
+
messageField: ["user_message", "message"]
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
async describeRoomByCode(e) {
|
|
1399
|
+
let { data: t, ok: n, code: r, message: i } = await this.req.get("describe-room", { invitation_code: e || s("invitation_code") }, l({
|
|
1400
|
+
room_id: u.string(),
|
|
1401
|
+
inviter_role_id: u.number(),
|
|
1402
|
+
room_status: li,
|
|
1403
|
+
room_mode: u.string(),
|
|
1404
|
+
room_tags: u.array(u.string()),
|
|
1405
|
+
max_members: u.number(),
|
|
1406
|
+
members: u.array(u.object({
|
|
1407
|
+
role_id: u.number(),
|
|
1408
|
+
role_name: u.string(),
|
|
1409
|
+
avatar_url: u.string()
|
|
1410
|
+
}))
|
|
1411
|
+
}), { message: !1 });
|
|
1412
|
+
return n && t ? t : {
|
|
1413
|
+
error: r,
|
|
1414
|
+
message: i
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
}, di = {
|
|
1378
1418
|
All: "all",
|
|
1379
1419
|
Limit: "limit"
|
|
1380
|
-
},
|
|
1420
|
+
}, fi = u.string().enum(di).lock(), pi = {
|
|
1381
1421
|
Pending: "pending",
|
|
1382
1422
|
Approved: "approved",
|
|
1383
1423
|
Failed: "failed",
|
|
1384
1424
|
Suspect: "suspect"
|
|
1385
|
-
}, V = u.string().enum(
|
|
1425
|
+
}, V = u.string().enum(pi).lock(), mi = {
|
|
1386
1426
|
System: "system",
|
|
1387
1427
|
Comment: "comment",
|
|
1388
1428
|
Like: "like"
|
|
1389
|
-
},
|
|
1429
|
+
}, hi = u.string().enum(mi).lock(), H = {
|
|
1390
1430
|
System: "system",
|
|
1391
1431
|
PostPinned: "post_pinned",
|
|
1392
1432
|
PostHighlighted: "post_highlighted",
|
|
@@ -1399,13 +1439,13 @@ var li = {
|
|
|
1399
1439
|
ReplyReplied: "reply_replied",
|
|
1400
1440
|
ReplyLiked: "reply_liked",
|
|
1401
1441
|
ReplyDeleted: "reply_deleted"
|
|
1402
|
-
},
|
|
1442
|
+
}, gi = u.string().enum(H).lock(), U = u.object({
|
|
1403
1443
|
forum_id: u.number(),
|
|
1404
1444
|
icon_url: u.string(),
|
|
1405
1445
|
name: u.string(),
|
|
1406
1446
|
tags: u.array(u.string()),
|
|
1407
1447
|
sort: u.number(),
|
|
1408
|
-
mode:
|
|
1448
|
+
mode: fi,
|
|
1409
1449
|
member_ids: u.array(u.number())
|
|
1410
1450
|
}).lock(), W = u.object({
|
|
1411
1451
|
topic_id: u.number(),
|
|
@@ -1434,7 +1474,7 @@ var li = {
|
|
|
1434
1474
|
is_highlighted: u.bool(),
|
|
1435
1475
|
status: V,
|
|
1436
1476
|
create_time: u.number()
|
|
1437
|
-
}).lock(), K = u.object({ err_msg: u.string().optional() }).optional().lock(),
|
|
1477
|
+
}).lock(), K = u.object({ err_msg: u.string().optional() }).optional().lock(), _i = u.object({
|
|
1438
1478
|
reply_id: u.number(),
|
|
1439
1479
|
reply_content: u.string().optional(),
|
|
1440
1480
|
replied_by: u.string(),
|
|
@@ -1453,7 +1493,7 @@ var li = {
|
|
|
1453
1493
|
content: u.string(),
|
|
1454
1494
|
like_num: u.number(),
|
|
1455
1495
|
liked: u.bool(),
|
|
1456
|
-
reply_to:
|
|
1496
|
+
reply_to: _i,
|
|
1457
1497
|
create_time: u.number()
|
|
1458
1498
|
}).lock(), J = u.object({
|
|
1459
1499
|
comment_id: u.number(),
|
|
@@ -1475,19 +1515,19 @@ var li = {
|
|
|
1475
1515
|
create_time: u.number(),
|
|
1476
1516
|
status: V,
|
|
1477
1517
|
replies: u.array(q).optional()
|
|
1478
|
-
}).lock(),
|
|
1518
|
+
}).lock(), vi = u.object({
|
|
1479
1519
|
image_url: u.string(),
|
|
1480
1520
|
upload_url: u.string(),
|
|
1481
1521
|
existed: u.bool()
|
|
1482
1522
|
}).lock(), Y = u.object({
|
|
1483
1523
|
notification_id: u.string(),
|
|
1484
|
-
notification_type:
|
|
1524
|
+
notification_type: gi,
|
|
1485
1525
|
is_read: u.bool(),
|
|
1486
1526
|
create_time: u.number(),
|
|
1487
1527
|
origin_user_id: u.string(),
|
|
1488
1528
|
origin_user_name: u.string(),
|
|
1489
1529
|
origin_user_avatar_url: u.string()
|
|
1490
|
-
}).lock(),
|
|
1530
|
+
}).lock(), yi = u.object({
|
|
1491
1531
|
system_message_subject: u.string(),
|
|
1492
1532
|
system_message_content: u.string()
|
|
1493
1533
|
}).lock(), X = u.object({
|
|
@@ -1501,86 +1541,86 @@ var li = {
|
|
|
1501
1541
|
}).lock(), Q = u.object({
|
|
1502
1542
|
reply_id: u.number(),
|
|
1503
1543
|
reply_content: u.string()
|
|
1504
|
-
}).lock(),
|
|
1544
|
+
}).lock(), bi = u.object({
|
|
1505
1545
|
...Y.shape,
|
|
1506
|
-
...
|
|
1546
|
+
...yi.shape,
|
|
1507
1547
|
notification_type: u.string().enum(H.System)
|
|
1508
|
-
}),
|
|
1548
|
+
}), xi = u.object({
|
|
1509
1549
|
...Y.shape,
|
|
1510
1550
|
...X.shape,
|
|
1511
1551
|
notification_type: u.string().enum(H.PostPinned, H.PostHighlighted, H.PostDeleted, H.PostLiked)
|
|
1512
|
-
}),
|
|
1552
|
+
}), Si = u.object({
|
|
1513
1553
|
...Y.shape,
|
|
1514
1554
|
...X.shape,
|
|
1515
1555
|
...Z.shape,
|
|
1516
1556
|
notification_type: u.string().enum(H.PostCommented)
|
|
1517
|
-
}),
|
|
1557
|
+
}), Ci = u.object({
|
|
1518
1558
|
...Y.shape,
|
|
1519
1559
|
...Z.shape,
|
|
1520
1560
|
...Q.shape,
|
|
1521
1561
|
notification_type: u.string().enum(H.CommentReplied)
|
|
1522
|
-
}),
|
|
1562
|
+
}), wi = u.object({
|
|
1523
1563
|
...Y.shape,
|
|
1524
1564
|
...Z.shape,
|
|
1525
1565
|
...X.shape,
|
|
1526
1566
|
notification_type: u.string().enum(H.CommentLiked, H.CommentDeleted)
|
|
1527
|
-
}),
|
|
1567
|
+
}), Ti = u.object({
|
|
1528
1568
|
...Y.shape,
|
|
1529
1569
|
...Q.shape,
|
|
1530
1570
|
notification_type: u.string().enum(H.ReplyReplied),
|
|
1531
1571
|
comment_id: u.number(),
|
|
1532
1572
|
reply_to_reply_id: u.number(),
|
|
1533
1573
|
reply_to_reply_content: u.string()
|
|
1534
|
-
}),
|
|
1574
|
+
}), Ei = u.object({
|
|
1535
1575
|
...Y.shape,
|
|
1536
1576
|
...Q.shape,
|
|
1537
1577
|
...Z.shape,
|
|
1538
1578
|
notification_type: u.string().enum(H.ReplyLiked, H.ReplyDeleted)
|
|
1539
|
-
}),
|
|
1579
|
+
}), Di = u.union(bi, xi, Si, Ci, wi, Ti, Ei).satisfies().lock(), Oi = l({ forums: u.array(U) }), ki = l({ topics: u.array(W) }), Ai = l({ topic: W }), ji = l({ post: G }), Mi = l({
|
|
1540
1580
|
posts: u.array(G),
|
|
1541
1581
|
next_token: u.string().optional()
|
|
1542
|
-
}),
|
|
1582
|
+
}), Ni = l({
|
|
1543
1583
|
post: G.clone().optional(),
|
|
1544
1584
|
antispam: K.clone().optional()
|
|
1545
|
-
}),
|
|
1585
|
+
}), Pi = l({
|
|
1546
1586
|
replies: u.array(q),
|
|
1547
1587
|
next_token: u.string().optional()
|
|
1548
|
-
}),
|
|
1588
|
+
}), Fi = l({ reply: q }), Ii = l({
|
|
1549
1589
|
reply: q.clone().optional(),
|
|
1550
1590
|
antispam: K.clone().optional()
|
|
1551
|
-
}),
|
|
1591
|
+
}), Li = l({ comment: J }), Ri = l({
|
|
1552
1592
|
comments: u.array(J),
|
|
1553
1593
|
next_token: u.string().optional()
|
|
1554
|
-
}),
|
|
1594
|
+
}), zi = l({
|
|
1555
1595
|
comment: J.clone().optional(),
|
|
1556
1596
|
antispam: J.clone().optional()
|
|
1557
|
-
}),
|
|
1558
|
-
notifications: u.array(
|
|
1597
|
+
}), Bi = u.guard(vi), Vi = l({
|
|
1598
|
+
notifications: u.array(Di),
|
|
1559
1599
|
next_token: u.string().optional()
|
|
1560
|
-
}),
|
|
1600
|
+
}), Hi = l({
|
|
1561
1601
|
system: u.number(),
|
|
1562
1602
|
comment: u.number(),
|
|
1563
1603
|
like: u.number()
|
|
1564
|
-
}),
|
|
1604
|
+
}), Ui = class {
|
|
1565
1605
|
token;
|
|
1566
1606
|
req;
|
|
1567
1607
|
constructor(e) {
|
|
1568
1608
|
this.token = e, this.req = e.req;
|
|
1569
1609
|
}
|
|
1570
1610
|
async getForums(e) {
|
|
1571
|
-
let { data: t } = await this.req.get("community/forums", null,
|
|
1611
|
+
let { data: t } = await this.req.get("community/forums", null, Oi, e);
|
|
1572
1612
|
return t?.forums || [];
|
|
1573
1613
|
}
|
|
1574
1614
|
async getTopics(e) {
|
|
1575
|
-
let { data: t } = await this.req.get("community/topics", null,
|
|
1615
|
+
let { data: t } = await this.req.get("community/topics", null, ki, e);
|
|
1576
1616
|
return t?.topics || [];
|
|
1577
1617
|
}
|
|
1578
1618
|
async getTopic(e, t) {
|
|
1579
|
-
let { data: n, code: r } = await this.req.get("community/topic", { topic_id: e },
|
|
1619
|
+
let { data: n, code: r } = await this.req.get("community/topic", { topic_id: e }, Ai, t);
|
|
1580
1620
|
return n?.topic ?? { error: r };
|
|
1581
1621
|
}
|
|
1582
1622
|
async getPosts(e, t) {
|
|
1583
|
-
let { data: n, code: r, message: i } = await this.req.get("community/posts", e || null,
|
|
1623
|
+
let { data: n, code: r, message: i } = await this.req.get("community/posts", e || null, Mi, t);
|
|
1584
1624
|
return n ?? {
|
|
1585
1625
|
message: i,
|
|
1586
1626
|
error: r
|
|
@@ -1591,35 +1631,35 @@ var li = {
|
|
|
1591
1631
|
forum_id: e,
|
|
1592
1632
|
max_results: t,
|
|
1593
1633
|
next_token: n
|
|
1594
|
-
},
|
|
1634
|
+
}, Mi, r);
|
|
1595
1635
|
return i ?? {
|
|
1596
1636
|
message: o,
|
|
1597
1637
|
error: a
|
|
1598
1638
|
};
|
|
1599
1639
|
}
|
|
1600
1640
|
async getPost(e, t) {
|
|
1601
|
-
let { data: n, code: r, message: i } = await this.req.get("community/post", { post_id: e },
|
|
1641
|
+
let { data: n, code: r, message: i } = await this.req.get("community/post", { post_id: e }, ji, t);
|
|
1602
1642
|
return n?.post ?? {
|
|
1603
1643
|
message: i,
|
|
1604
1644
|
error: r
|
|
1605
1645
|
};
|
|
1606
1646
|
}
|
|
1607
1647
|
async post(e, t) {
|
|
1608
|
-
let { data: n, code: r, message: i } = await this.req.post("community/post", a(e),
|
|
1648
|
+
let { data: n, code: r, message: i } = await this.req.post("community/post", a(e), Ni, t);
|
|
1609
1649
|
return n ?? {
|
|
1610
1650
|
message: i,
|
|
1611
1651
|
error: r
|
|
1612
1652
|
};
|
|
1613
1653
|
}
|
|
1614
1654
|
async getComments(e, t) {
|
|
1615
|
-
let { data: n, code: r, message: i } = await this.req.get("community/comments", e,
|
|
1655
|
+
let { data: n, code: r, message: i } = await this.req.get("community/comments", e, Ri, t);
|
|
1616
1656
|
return n ?? {
|
|
1617
1657
|
message: i,
|
|
1618
1658
|
error: r
|
|
1619
1659
|
};
|
|
1620
1660
|
}
|
|
1621
1661
|
async getComment(e, t) {
|
|
1622
|
-
let { data: n, code: r, message: i } = await this.req.get("community/comment", { comment_id: e },
|
|
1662
|
+
let { data: n, code: r, message: i } = await this.req.get("community/comment", { comment_id: e }, Li, t);
|
|
1623
1663
|
return n?.comment ?? {
|
|
1624
1664
|
message: i,
|
|
1625
1665
|
error: r
|
|
@@ -1627,7 +1667,7 @@ var li = {
|
|
|
1627
1667
|
}
|
|
1628
1668
|
async comment(e, t) {
|
|
1629
1669
|
await this.token.autoLogin();
|
|
1630
|
-
let { data: n, code: r, message: i } = await this.req.post("community/comment", a(e),
|
|
1670
|
+
let { data: n, code: r, message: i } = await this.req.post("community/comment", a(e), zi, t);
|
|
1631
1671
|
return n ?? {
|
|
1632
1672
|
message: i,
|
|
1633
1673
|
error: r
|
|
@@ -1637,14 +1677,14 @@ var li = {
|
|
|
1637
1677
|
let { data: n } = await this.req.get("community/replies", {
|
|
1638
1678
|
max_results: 20,
|
|
1639
1679
|
...e
|
|
1640
|
-
},
|
|
1680
|
+
}, Pi, t);
|
|
1641
1681
|
return {
|
|
1642
1682
|
replies: n?.replies || [],
|
|
1643
1683
|
next_token: n?.next_token || ""
|
|
1644
1684
|
};
|
|
1645
1685
|
}
|
|
1646
1686
|
async getReply(e, t) {
|
|
1647
|
-
let { data: n, code: r, message: i } = await this.req.get("community/reply", { reply_id: e },
|
|
1687
|
+
let { data: n, code: r, message: i } = await this.req.get("community/reply", { reply_id: e }, Fi, t);
|
|
1648
1688
|
return n?.reply ?? {
|
|
1649
1689
|
message: i,
|
|
1650
1690
|
error: r
|
|
@@ -1652,7 +1692,7 @@ var li = {
|
|
|
1652
1692
|
}
|
|
1653
1693
|
async reply(e, t) {
|
|
1654
1694
|
await this.token.autoLogin();
|
|
1655
|
-
let { data: n, code: r, message: i } = await this.req.post("community/reply", a(e),
|
|
1695
|
+
let { data: n, code: r, message: i } = await this.req.post("community/reply", a(e), Ii, t);
|
|
1656
1696
|
return n ?? {
|
|
1657
1697
|
message: i,
|
|
1658
1698
|
error: r
|
|
@@ -1682,7 +1722,7 @@ var li = {
|
|
|
1682
1722
|
}
|
|
1683
1723
|
async getMediaPresignedUrl(e, t) {
|
|
1684
1724
|
await this.token.autoLogin();
|
|
1685
|
-
let { data: n } = await this.req.get("community/media-presign-url", e,
|
|
1725
|
+
let { data: n } = await this.req.get("community/media-presign-url", e, Bi, t);
|
|
1686
1726
|
return n;
|
|
1687
1727
|
}
|
|
1688
1728
|
async getNotifications(e, t) {
|
|
@@ -1690,7 +1730,7 @@ var li = {
|
|
|
1690
1730
|
let { data: n } = await this.req.get("community/notifications", {
|
|
1691
1731
|
max_results: 20,
|
|
1692
1732
|
...e
|
|
1693
|
-
},
|
|
1733
|
+
}, Vi, t);
|
|
1694
1734
|
return {
|
|
1695
1735
|
notifications: n?.notifications || [],
|
|
1696
1736
|
next_token: n?.next_token || ""
|
|
@@ -1698,7 +1738,7 @@ var li = {
|
|
|
1698
1738
|
}
|
|
1699
1739
|
async getUnreadNotificationsCount(e) {
|
|
1700
1740
|
if (!await this.token.autoLogin()) return null;
|
|
1701
|
-
let { data: t } = await this.req.get("community/unread-notifications-count", null,
|
|
1741
|
+
let { data: t } = await this.req.get("community/unread-notifications-count", null, Hi, e);
|
|
1702
1742
|
return t;
|
|
1703
1743
|
}
|
|
1704
1744
|
async clearUnreadNotifications(e, t) {
|
|
@@ -1706,11 +1746,11 @@ var li = {
|
|
|
1706
1746
|
let { ok: n } = await this.req.post("community/clear-unread-notifications", { category: e }, null, t);
|
|
1707
1747
|
return n;
|
|
1708
1748
|
}
|
|
1709
|
-
},
|
|
1749
|
+
}, Wi = l({
|
|
1710
1750
|
nonce_str: u.string(),
|
|
1711
1751
|
timestamp: u.number(),
|
|
1712
1752
|
signature: u.string()
|
|
1713
|
-
}),
|
|
1753
|
+
}), Gi = /* @__PURE__ */ function(e) {
|
|
1714
1754
|
return e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFollow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e;
|
|
1715
1755
|
}({});
|
|
1716
1756
|
//#endregion
|
|
@@ -1720,7 +1760,7 @@ function $(e) {
|
|
|
1720
1760
|
}
|
|
1721
1761
|
//#endregion
|
|
1722
1762
|
//#region src/weixin.ts
|
|
1723
|
-
var
|
|
1763
|
+
var Ki = "wx_login_cache", qi = class {
|
|
1724
1764
|
token;
|
|
1725
1765
|
_appid;
|
|
1726
1766
|
req;
|
|
@@ -1731,7 +1771,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1731
1771
|
return this._appid;
|
|
1732
1772
|
}
|
|
1733
1773
|
async getLoginCache() {
|
|
1734
|
-
let e = this.token.storage.get(
|
|
1774
|
+
let e = this.token.storage.get(Ki);
|
|
1735
1775
|
if (!e) return null;
|
|
1736
1776
|
let t = i(e);
|
|
1737
1777
|
return $(t) ? (this.token.weixinToken = t.weixin_token, await this.token.autoLogin(), t) : null;
|
|
@@ -1740,14 +1780,14 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1740
1780
|
if (!c()) throw Error("当前环境非微信小程序");
|
|
1741
1781
|
let t = await this.getLoginCache();
|
|
1742
1782
|
if (t) return t;
|
|
1743
|
-
let n = await
|
|
1783
|
+
let n = await ce(), { data: r, code: i, message: a } = await this.req.post("weixin/login", {
|
|
1744
1784
|
code: n,
|
|
1745
1785
|
appid: this.appid
|
|
1746
1786
|
}, $, {
|
|
1747
1787
|
...e,
|
|
1748
1788
|
message: !1
|
|
1749
1789
|
});
|
|
1750
|
-
return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(
|
|
1790
|
+
return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(Ki, JSON.stringify(r))), r ?? {
|
|
1751
1791
|
message: a,
|
|
1752
1792
|
error: i
|
|
1753
1793
|
};
|
|
@@ -1789,7 +1829,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1789
1829
|
let { data: t } = await this.req.get("weixin/offiaccount/jssdk-sign", {
|
|
1790
1830
|
appid: this.appid,
|
|
1791
1831
|
url: location.href.split("#")[0]
|
|
1792
|
-
},
|
|
1832
|
+
}, Wi, e);
|
|
1793
1833
|
return t ? {
|
|
1794
1834
|
appid: this.appid,
|
|
1795
1835
|
nonceStr: t.nonce_str,
|
|
@@ -1799,4 +1839,4 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1799
1839
|
}
|
|
1800
1840
|
};
|
|
1801
1841
|
//#endregion
|
|
1802
|
-
export { K as AntispamValidator,
|
|
1842
|
+
export { K as AntispamValidator, le as AuthToken, Vn as CandidateVoteValidator, I as CashbackEngagementDataValidator, mn as ClaimActivationKeyEngagementDataValidator, $e as ClaimRewardStatus, k as ClaimRewardStatusValidator, Zn as ClaimedItemValidator, h as ClubAddressValidator, He as ClubApi, g as ClubBenefitSummaryValidator, De as ClubBenefitValidator, me as ClubCreditChangeScene, he as ClubCreditChangeSceneValidator, fe as ClubCreditChangeType, pe as ClubCreditChangeTypeValidator, Ee as ClubCreditLogValidator, ye as ClubGlobalConfigValidator, ge as ClubItemType, p as ClubItemTypeValidator, be as ClubPlayerValidator, _ as ClubProductValidator, _e as ClubRedemptionStatus, ve as ClubRedemptionStatusValidator, Te as ClubUserCreditValidator, we as ClubUserProfileValidator, Wn as CommentEngagementValidator, J as CommentValidator, Ui as CommunityApi, Hn as ConversationValidator, Ge as EngageAccountType, Ke as EngageAccountTypeValidator, Xn as EngageResponseValidator, Kn as EngageRewardValidator, Ue as EventApi, ir as EventConfigValidator, yt as EventFeatureConfigOfCashbackValidator, xt as EventFeatureConfigOfCheckInValidator, Ct as EventFeatureConfigOfClaimActivationKeyValidator, Tt as EventFeatureConfigOfClaimRewardsValidator, Dt as EventFeatureConfigOfCommentValidator, kt as EventFeatureConfigOfFollowValidator, Mt as EventFeatureConfigOfGiftCodeValidator, Pt as EventFeatureConfigOfInviteValidator, It as EventFeatureConfigOfInvitedRegisterValidator, Ht as EventFeatureConfigOfLotteryDrawValidator, Bt as EventFeatureConfigOfLotteryValidator, Wt as EventFeatureConfigOfPreregisterValidator, Kt as EventFeatureConfigOfQuestValidator, Yt as EventFeatureConfigOfRedeemValidator, Zt as EventFeatureConfigOfRegisterValidator, $t as EventFeatureConfigOfShareValidator, tn as EventFeatureConfigOfSubscribeValidator, rn as EventFeatureConfigOfSurveyValidator, on as EventFeatureConfigOfTeamValidator, un as EventFeatureConfigOfUgcLikeValidator, cn as EventFeatureConfigOfUgcValidator, er as EventFeatureConfigOfVote2Validator, pn as EventFeatureConfigOfVoteValidator, rr as EventFeatureConfigValidator, qe as EventPeriodType, Je as EventPeriodTypeValidator, N as EventRewardItemConfigValidator, Ae as ExtraGameRewardValidator, ke as ExtraPhysicalShipmentValidator, Jt as FeatureRedeemItemConfigValidator, _t as FeatureRewardValidator, T as FeatureType, Ye as FeatureTypeValidator, di as ForumMode, fi as ForumModeValidator, U as ForumValidator, ui as GGDPublicApi, S as GamerItemType, C as GamerItemTypeValidator, ue as Gender, de as GenderValidator, hn as GiftCodeEngagementDataValidator, gn as InviteEngagementDataValidator, ot as LotteryDrawAction, st as LotteryDrawActionValidator, bn as LotteryDrawEngagementDataValidator, _n as LotteryEngagementDataValidator, j as LotteryTicketStatus, rt as LotteryTicketStatusValidator, Y as NotificationBaseValidator, mi as NotificationCategory, hi as NotificationCategoryValidator, Ci as NotificationCommentReplyValidator, wi as NotificationCommentValidator, Z as NotificationPayloadCommentValidator, X as NotificationPayloadPostValidator, Q as NotificationPayloadReplyValidator, yi as NotificationPayloadSystemValidator, Si as NotificationPostCommentValidator, xi as NotificationPostValidator, Ti as NotificationReplyRepliedValidator, Ei as NotificationReplyValidator, bi as NotificationSystemValidator, H as NotificationType, gi as NotificationTypeValidator, Di as NotificationValidator, Ce as PlayerRoleCardValidator, m as PlayerRoleValidator, pi as PostStatus, V as PostStatusValidator, G as PostValidator, xn as PreregisterEngagementDataValidator, vi as PresignedUrlResponseValidator, Cn as QuestEngagementDataValidator, Xe as QuestObjective, E as QuestObjectiveValidator, ct as QuestProgressAlgorithm, lt as QuestProgressAlgorithmValidator, wn as QuestProgressValidator, Tn as RedeemEngagementDataValidator, Oe as RedeemParamsValidator, En as RedeemStocksResponseValidator, je as RedemptionValidator, gt as RegularRewardValidator, _i as ReplyToValidator, q as ReplyValidator, We as RewardItemType, w as RewardItemTypeValidator, et as RewardSource, A as RewardSourceValidator, D as RewardStatus, O as RewardStatusValidator, Gn as RewardValidator, Se as RoleBaseInfoValidator, xe as ServerBaseInfoValidator, Dn as ShareEngagementDataValidator, kn as SurveyEngagementDataValidator, it as TeamAction, at as TeamActionValidator, Mn as TeamEngagementDataValidator, An as TeamEngagementValidator, jn as TeamMemberValidator, tt as TeamVisibility, nt as TeamVisibilityValidator, W as TopicValidator, In as UgcCountResponseValidator, Nn as UgcEngagementDataValidator, Rn as UgcLeaderboardResponseValidator, Pn as UgcRecordBaseResponseValidator, Fn as UgcRecordResponseValidator, pt as UgcReviewStatus, mt as UgcReviewStatusValidator, ft as UgcSocialMedia, M as UgcSocialMediaValidator, Ln as UgcUploadImageValidator, z as UserEngagementDataValidator, qn as UserEngagementValidator, Yn as UserFeatureStatusValidator, L as UserRewardValidator, Jn as VerifyMobileResultValidator, Bn as Vote2ClaimRewardsResponseValidator, zn as Vote2EngagementDataValidator, ut as Vote2RewardType, dt as Vote2RewardTypeValidator, R as VoteEngagementDataValidator, Ze as VoteOptionSource, Qe as VoteOptionSourceValidator, qi as WeixinApi, On as WeixinSubscribeEngagementDataValidator, Gi as WeixinWebLoginErrorCode, Un as ZeroChatGPTDataValidator, Vr as claimRewards, Qr as claimRewardsV2, $r as claimWeixinHongbao, Br as engage, Gr as generateUnlimitQrcode, Yr as getCashbackQuery, Mr as getConfig, Fr as getEngagements, Pr as getEngagementsCount, Nr as getEngagementsUserCount, Wr as getParamsByQrcodeScene, Kr as getQuestProgress, ci as getRedeemItemStocks, si as getUgcLeaderboard, Zr as getUgcMyCount, ai as getUgcRecommendation, Xr as getUgcRecord, oi as getUgcs, Ur as getUnlimitQrcodeScene, Rr as getUserEngagementCount, zr as getUserEngagements, Lr as getUserFeatureStatus, ri as getUserItemCount, ti as getUserRewards, ni as getUserRewardsCount, Jr as getVote2Leaderboard, Wi as isWeixinSignResponse, Hr as submitUserRewardAddress, ii as ugcUploadImage, ei as verifyActivationKey, jr as verifyMobileAllowed, Ir as visit, qr as vote2Rewards };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/gamer-api",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "agent for gamer api",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "web@seayoo.com",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.13.1",
|
|
30
|
+
"@seayoo-web/validator": "2.3.0",
|
|
30
31
|
"@seayoo-web/tsconfig": "1.0.6",
|
|
31
|
-
"@seayoo-web/scripts": "4.3.3",
|
|
32
32
|
"@seayoo-web/combo-webview": "2.9.7",
|
|
33
|
-
"@seayoo-web/validator": "2.3.0",
|
|
34
33
|
"@seayoo-web/utils": "4.4.1",
|
|
35
|
-
"@seayoo-web/request": "4.1.0"
|
|
34
|
+
"@seayoo-web/request": "4.1.0",
|
|
35
|
+
"@seayoo-web/scripts": "4.3.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@seayoo-web/combo-webview": "^2.9.7",
|
|
39
38
|
"@seayoo-web/utils": "^4.4.1",
|
|
39
|
+
"@seayoo-web/combo-webview": "^2.9.7",
|
|
40
40
|
"@seayoo-web/validator": "^2.3.0"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./src/event";
|
|
|
7
7
|
export * from "./src/event.methods";
|
|
8
8
|
export * from "./src/event.define";
|
|
9
9
|
export * from "./src/event.enums";
|
|
10
|
+
export * from "./src/ggd";
|
|
10
11
|
export * from "./src/community";
|
|
11
12
|
export * from "./src/community.define";
|
|
12
13
|
export * from "./src/community.enums";
|
|
@@ -32,6 +32,8 @@ export interface FeatureVote2Config {
|
|
|
32
32
|
winner_rewards?: EventRewardItemConfig[];
|
|
33
33
|
/** 安慰奖 */
|
|
34
34
|
consolation_rewards?: EventRewardItemConfig[];
|
|
35
|
+
/** 同一用户在一个周期内对同一候选作品可投出的最大票数 0 表示不限制 */
|
|
36
|
+
max_votes_per_user_per_candidate_per_cycle?: number;
|
|
35
37
|
}
|
|
36
38
|
export type EventFeatureConfigOfVote2 = EventFeatureBaseConfig & {
|
|
37
39
|
feature_type: typeof featureType;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { NetRequestFactory, RequestInternalError } from "@seayoo-web/request";
|
|
2
|
+
/**
|
|
3
|
+
* 鹅鸭杀(ggd)定制化 public 接口
|
|
4
|
+
*/
|
|
5
|
+
export declare class GGDPublicApi {
|
|
6
|
+
req: ReturnType<NetRequestFactory>;
|
|
7
|
+
constructor(endpoint: string, NetRequest: NetRequestFactory);
|
|
8
|
+
/**
|
|
9
|
+
* 获取鹅鸭杀房间内详情,参数 `invitationCode` 默认从 url query 的 `invitation_code` 参数读取
|
|
10
|
+
*
|
|
11
|
+
* 接口文档 https://www.kdocs.cn/l/cf2mO2uRLqh9?linkname=vpkahwYfte
|
|
12
|
+
*
|
|
13
|
+
* 响应依据 GM 协议 https://www.kdocs.cn/l/cnZbBuB5x12C?linkname=pRQPKz6vUa
|
|
14
|
+
*/
|
|
15
|
+
describeRoomByCode(invitationCode?: string): Promise<{
|
|
16
|
+
room_id: string;
|
|
17
|
+
inviter_role_id: number;
|
|
18
|
+
room_status: import("./ggd.enum").GGDRoomStatus;
|
|
19
|
+
room_mode: string;
|
|
20
|
+
room_tags: string[];
|
|
21
|
+
max_members: number;
|
|
22
|
+
members: {
|
|
23
|
+
role_id: /*elided*/ any;
|
|
24
|
+
role_name: /*elided*/ any;
|
|
25
|
+
avatar_url: /*elided*/ any;
|
|
26
|
+
}[];
|
|
27
|
+
} | {
|
|
28
|
+
error: RequestInternalError | "invitation_code_invalid" | "invitation_code_expired";
|
|
29
|
+
message: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ValueOf } from "@seayoo-web/utils";
|
|
2
|
+
/** 房间状态 */
|
|
3
|
+
export declare const GGDRoomStatus: {
|
|
4
|
+
/** 等待中 */
|
|
5
|
+
readonly Waiting: 1;
|
|
6
|
+
/** 游戏中 */
|
|
7
|
+
readonly Playing: 2;
|
|
8
|
+
};
|
|
9
|
+
export type GGDRoomStatus = ValueOf<typeof GGDRoomStatus>;
|
|
10
|
+
export declare const GGDRoomStatusValidator: import("@seayoo-web/validator").NumberValidator<GGDRoomStatus, false, false> & {
|
|
11
|
+
int: never;
|
|
12
|
+
min: never;
|
|
13
|
+
max: never;
|
|
14
|
+
allowNaN: never;
|
|
15
|
+
allowInfinity: never;
|
|
16
|
+
unsafe: never;
|
|
17
|
+
enum: never;
|
|
18
|
+
disallow: never;
|
|
19
|
+
optional: never;
|
|
20
|
+
maybeNull: never;
|
|
21
|
+
lock: never;
|
|
22
|
+
};
|