@seayoo-web/gamer-api 4.1.4 → 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 +168 -129
- package/package.json +6 -6
- package/types/index.d.ts +1 -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(),
|
|
@@ -1373,21 +1373,60 @@ async function ci(e, t) {
|
|
|
1373
1373
|
error: r
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
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 = {
|
|
1379
1418
|
All: "all",
|
|
1380
1419
|
Limit: "limit"
|
|
1381
|
-
},
|
|
1420
|
+
}, fi = u.string().enum(di).lock(), pi = {
|
|
1382
1421
|
Pending: "pending",
|
|
1383
1422
|
Approved: "approved",
|
|
1384
1423
|
Failed: "failed",
|
|
1385
1424
|
Suspect: "suspect"
|
|
1386
|
-
}, V = u.string().enum(
|
|
1425
|
+
}, V = u.string().enum(pi).lock(), mi = {
|
|
1387
1426
|
System: "system",
|
|
1388
1427
|
Comment: "comment",
|
|
1389
1428
|
Like: "like"
|
|
1390
|
-
},
|
|
1429
|
+
}, hi = u.string().enum(mi).lock(), H = {
|
|
1391
1430
|
System: "system",
|
|
1392
1431
|
PostPinned: "post_pinned",
|
|
1393
1432
|
PostHighlighted: "post_highlighted",
|
|
@@ -1400,13 +1439,13 @@ var li = {
|
|
|
1400
1439
|
ReplyReplied: "reply_replied",
|
|
1401
1440
|
ReplyLiked: "reply_liked",
|
|
1402
1441
|
ReplyDeleted: "reply_deleted"
|
|
1403
|
-
},
|
|
1442
|
+
}, gi = u.string().enum(H).lock(), U = u.object({
|
|
1404
1443
|
forum_id: u.number(),
|
|
1405
1444
|
icon_url: u.string(),
|
|
1406
1445
|
name: u.string(),
|
|
1407
1446
|
tags: u.array(u.string()),
|
|
1408
1447
|
sort: u.number(),
|
|
1409
|
-
mode:
|
|
1448
|
+
mode: fi,
|
|
1410
1449
|
member_ids: u.array(u.number())
|
|
1411
1450
|
}).lock(), W = u.object({
|
|
1412
1451
|
topic_id: u.number(),
|
|
@@ -1435,7 +1474,7 @@ var li = {
|
|
|
1435
1474
|
is_highlighted: u.bool(),
|
|
1436
1475
|
status: V,
|
|
1437
1476
|
create_time: u.number()
|
|
1438
|
-
}).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({
|
|
1439
1478
|
reply_id: u.number(),
|
|
1440
1479
|
reply_content: u.string().optional(),
|
|
1441
1480
|
replied_by: u.string(),
|
|
@@ -1454,7 +1493,7 @@ var li = {
|
|
|
1454
1493
|
content: u.string(),
|
|
1455
1494
|
like_num: u.number(),
|
|
1456
1495
|
liked: u.bool(),
|
|
1457
|
-
reply_to:
|
|
1496
|
+
reply_to: _i,
|
|
1458
1497
|
create_time: u.number()
|
|
1459
1498
|
}).lock(), J = u.object({
|
|
1460
1499
|
comment_id: u.number(),
|
|
@@ -1476,19 +1515,19 @@ var li = {
|
|
|
1476
1515
|
create_time: u.number(),
|
|
1477
1516
|
status: V,
|
|
1478
1517
|
replies: u.array(q).optional()
|
|
1479
|
-
}).lock(),
|
|
1518
|
+
}).lock(), vi = u.object({
|
|
1480
1519
|
image_url: u.string(),
|
|
1481
1520
|
upload_url: u.string(),
|
|
1482
1521
|
existed: u.bool()
|
|
1483
1522
|
}).lock(), Y = u.object({
|
|
1484
1523
|
notification_id: u.string(),
|
|
1485
|
-
notification_type:
|
|
1524
|
+
notification_type: gi,
|
|
1486
1525
|
is_read: u.bool(),
|
|
1487
1526
|
create_time: u.number(),
|
|
1488
1527
|
origin_user_id: u.string(),
|
|
1489
1528
|
origin_user_name: u.string(),
|
|
1490
1529
|
origin_user_avatar_url: u.string()
|
|
1491
|
-
}).lock(),
|
|
1530
|
+
}).lock(), yi = u.object({
|
|
1492
1531
|
system_message_subject: u.string(),
|
|
1493
1532
|
system_message_content: u.string()
|
|
1494
1533
|
}).lock(), X = u.object({
|
|
@@ -1502,86 +1541,86 @@ var li = {
|
|
|
1502
1541
|
}).lock(), Q = u.object({
|
|
1503
1542
|
reply_id: u.number(),
|
|
1504
1543
|
reply_content: u.string()
|
|
1505
|
-
}).lock(),
|
|
1544
|
+
}).lock(), bi = u.object({
|
|
1506
1545
|
...Y.shape,
|
|
1507
|
-
...
|
|
1546
|
+
...yi.shape,
|
|
1508
1547
|
notification_type: u.string().enum(H.System)
|
|
1509
|
-
}),
|
|
1548
|
+
}), xi = u.object({
|
|
1510
1549
|
...Y.shape,
|
|
1511
1550
|
...X.shape,
|
|
1512
1551
|
notification_type: u.string().enum(H.PostPinned, H.PostHighlighted, H.PostDeleted, H.PostLiked)
|
|
1513
|
-
}),
|
|
1552
|
+
}), Si = u.object({
|
|
1514
1553
|
...Y.shape,
|
|
1515
1554
|
...X.shape,
|
|
1516
1555
|
...Z.shape,
|
|
1517
1556
|
notification_type: u.string().enum(H.PostCommented)
|
|
1518
|
-
}),
|
|
1557
|
+
}), Ci = u.object({
|
|
1519
1558
|
...Y.shape,
|
|
1520
1559
|
...Z.shape,
|
|
1521
1560
|
...Q.shape,
|
|
1522
1561
|
notification_type: u.string().enum(H.CommentReplied)
|
|
1523
|
-
}),
|
|
1562
|
+
}), wi = u.object({
|
|
1524
1563
|
...Y.shape,
|
|
1525
1564
|
...Z.shape,
|
|
1526
1565
|
...X.shape,
|
|
1527
1566
|
notification_type: u.string().enum(H.CommentLiked, H.CommentDeleted)
|
|
1528
|
-
}),
|
|
1567
|
+
}), Ti = u.object({
|
|
1529
1568
|
...Y.shape,
|
|
1530
1569
|
...Q.shape,
|
|
1531
1570
|
notification_type: u.string().enum(H.ReplyReplied),
|
|
1532
1571
|
comment_id: u.number(),
|
|
1533
1572
|
reply_to_reply_id: u.number(),
|
|
1534
1573
|
reply_to_reply_content: u.string()
|
|
1535
|
-
}),
|
|
1574
|
+
}), Ei = u.object({
|
|
1536
1575
|
...Y.shape,
|
|
1537
1576
|
...Q.shape,
|
|
1538
1577
|
...Z.shape,
|
|
1539
1578
|
notification_type: u.string().enum(H.ReplyLiked, H.ReplyDeleted)
|
|
1540
|
-
}),
|
|
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({
|
|
1541
1580
|
posts: u.array(G),
|
|
1542
1581
|
next_token: u.string().optional()
|
|
1543
|
-
}),
|
|
1582
|
+
}), Ni = l({
|
|
1544
1583
|
post: G.clone().optional(),
|
|
1545
1584
|
antispam: K.clone().optional()
|
|
1546
|
-
}),
|
|
1585
|
+
}), Pi = l({
|
|
1547
1586
|
replies: u.array(q),
|
|
1548
1587
|
next_token: u.string().optional()
|
|
1549
|
-
}),
|
|
1588
|
+
}), Fi = l({ reply: q }), Ii = l({
|
|
1550
1589
|
reply: q.clone().optional(),
|
|
1551
1590
|
antispam: K.clone().optional()
|
|
1552
|
-
}),
|
|
1591
|
+
}), Li = l({ comment: J }), Ri = l({
|
|
1553
1592
|
comments: u.array(J),
|
|
1554
1593
|
next_token: u.string().optional()
|
|
1555
|
-
}),
|
|
1594
|
+
}), zi = l({
|
|
1556
1595
|
comment: J.clone().optional(),
|
|
1557
1596
|
antispam: J.clone().optional()
|
|
1558
|
-
}),
|
|
1559
|
-
notifications: u.array(
|
|
1597
|
+
}), Bi = u.guard(vi), Vi = l({
|
|
1598
|
+
notifications: u.array(Di),
|
|
1560
1599
|
next_token: u.string().optional()
|
|
1561
|
-
}),
|
|
1600
|
+
}), Hi = l({
|
|
1562
1601
|
system: u.number(),
|
|
1563
1602
|
comment: u.number(),
|
|
1564
1603
|
like: u.number()
|
|
1565
|
-
}),
|
|
1604
|
+
}), Ui = class {
|
|
1566
1605
|
token;
|
|
1567
1606
|
req;
|
|
1568
1607
|
constructor(e) {
|
|
1569
1608
|
this.token = e, this.req = e.req;
|
|
1570
1609
|
}
|
|
1571
1610
|
async getForums(e) {
|
|
1572
|
-
let { data: t } = await this.req.get("community/forums", null,
|
|
1611
|
+
let { data: t } = await this.req.get("community/forums", null, Oi, e);
|
|
1573
1612
|
return t?.forums || [];
|
|
1574
1613
|
}
|
|
1575
1614
|
async getTopics(e) {
|
|
1576
|
-
let { data: t } = await this.req.get("community/topics", null,
|
|
1615
|
+
let { data: t } = await this.req.get("community/topics", null, ki, e);
|
|
1577
1616
|
return t?.topics || [];
|
|
1578
1617
|
}
|
|
1579
1618
|
async getTopic(e, t) {
|
|
1580
|
-
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);
|
|
1581
1620
|
return n?.topic ?? { error: r };
|
|
1582
1621
|
}
|
|
1583
1622
|
async getPosts(e, t) {
|
|
1584
|
-
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);
|
|
1585
1624
|
return n ?? {
|
|
1586
1625
|
message: i,
|
|
1587
1626
|
error: r
|
|
@@ -1592,35 +1631,35 @@ var li = {
|
|
|
1592
1631
|
forum_id: e,
|
|
1593
1632
|
max_results: t,
|
|
1594
1633
|
next_token: n
|
|
1595
|
-
},
|
|
1634
|
+
}, Mi, r);
|
|
1596
1635
|
return i ?? {
|
|
1597
1636
|
message: o,
|
|
1598
1637
|
error: a
|
|
1599
1638
|
};
|
|
1600
1639
|
}
|
|
1601
1640
|
async getPost(e, t) {
|
|
1602
|
-
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);
|
|
1603
1642
|
return n?.post ?? {
|
|
1604
1643
|
message: i,
|
|
1605
1644
|
error: r
|
|
1606
1645
|
};
|
|
1607
1646
|
}
|
|
1608
1647
|
async post(e, t) {
|
|
1609
|
-
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);
|
|
1610
1649
|
return n ?? {
|
|
1611
1650
|
message: i,
|
|
1612
1651
|
error: r
|
|
1613
1652
|
};
|
|
1614
1653
|
}
|
|
1615
1654
|
async getComments(e, t) {
|
|
1616
|
-
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);
|
|
1617
1656
|
return n ?? {
|
|
1618
1657
|
message: i,
|
|
1619
1658
|
error: r
|
|
1620
1659
|
};
|
|
1621
1660
|
}
|
|
1622
1661
|
async getComment(e, t) {
|
|
1623
|
-
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);
|
|
1624
1663
|
return n?.comment ?? {
|
|
1625
1664
|
message: i,
|
|
1626
1665
|
error: r
|
|
@@ -1628,7 +1667,7 @@ var li = {
|
|
|
1628
1667
|
}
|
|
1629
1668
|
async comment(e, t) {
|
|
1630
1669
|
await this.token.autoLogin();
|
|
1631
|
-
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);
|
|
1632
1671
|
return n ?? {
|
|
1633
1672
|
message: i,
|
|
1634
1673
|
error: r
|
|
@@ -1638,14 +1677,14 @@ var li = {
|
|
|
1638
1677
|
let { data: n } = await this.req.get("community/replies", {
|
|
1639
1678
|
max_results: 20,
|
|
1640
1679
|
...e
|
|
1641
|
-
},
|
|
1680
|
+
}, Pi, t);
|
|
1642
1681
|
return {
|
|
1643
1682
|
replies: n?.replies || [],
|
|
1644
1683
|
next_token: n?.next_token || ""
|
|
1645
1684
|
};
|
|
1646
1685
|
}
|
|
1647
1686
|
async getReply(e, t) {
|
|
1648
|
-
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);
|
|
1649
1688
|
return n?.reply ?? {
|
|
1650
1689
|
message: i,
|
|
1651
1690
|
error: r
|
|
@@ -1653,7 +1692,7 @@ var li = {
|
|
|
1653
1692
|
}
|
|
1654
1693
|
async reply(e, t) {
|
|
1655
1694
|
await this.token.autoLogin();
|
|
1656
|
-
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);
|
|
1657
1696
|
return n ?? {
|
|
1658
1697
|
message: i,
|
|
1659
1698
|
error: r
|
|
@@ -1683,7 +1722,7 @@ var li = {
|
|
|
1683
1722
|
}
|
|
1684
1723
|
async getMediaPresignedUrl(e, t) {
|
|
1685
1724
|
await this.token.autoLogin();
|
|
1686
|
-
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);
|
|
1687
1726
|
return n;
|
|
1688
1727
|
}
|
|
1689
1728
|
async getNotifications(e, t) {
|
|
@@ -1691,7 +1730,7 @@ var li = {
|
|
|
1691
1730
|
let { data: n } = await this.req.get("community/notifications", {
|
|
1692
1731
|
max_results: 20,
|
|
1693
1732
|
...e
|
|
1694
|
-
},
|
|
1733
|
+
}, Vi, t);
|
|
1695
1734
|
return {
|
|
1696
1735
|
notifications: n?.notifications || [],
|
|
1697
1736
|
next_token: n?.next_token || ""
|
|
@@ -1699,7 +1738,7 @@ var li = {
|
|
|
1699
1738
|
}
|
|
1700
1739
|
async getUnreadNotificationsCount(e) {
|
|
1701
1740
|
if (!await this.token.autoLogin()) return null;
|
|
1702
|
-
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);
|
|
1703
1742
|
return t;
|
|
1704
1743
|
}
|
|
1705
1744
|
async clearUnreadNotifications(e, t) {
|
|
@@ -1707,11 +1746,11 @@ var li = {
|
|
|
1707
1746
|
let { ok: n } = await this.req.post("community/clear-unread-notifications", { category: e }, null, t);
|
|
1708
1747
|
return n;
|
|
1709
1748
|
}
|
|
1710
|
-
},
|
|
1749
|
+
}, Wi = l({
|
|
1711
1750
|
nonce_str: u.string(),
|
|
1712
1751
|
timestamp: u.number(),
|
|
1713
1752
|
signature: u.string()
|
|
1714
|
-
}),
|
|
1753
|
+
}), Gi = /* @__PURE__ */ function(e) {
|
|
1715
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;
|
|
1716
1755
|
}({});
|
|
1717
1756
|
//#endregion
|
|
@@ -1721,7 +1760,7 @@ function $(e) {
|
|
|
1721
1760
|
}
|
|
1722
1761
|
//#endregion
|
|
1723
1762
|
//#region src/weixin.ts
|
|
1724
|
-
var
|
|
1763
|
+
var Ki = "wx_login_cache", qi = class {
|
|
1725
1764
|
token;
|
|
1726
1765
|
_appid;
|
|
1727
1766
|
req;
|
|
@@ -1732,7 +1771,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1732
1771
|
return this._appid;
|
|
1733
1772
|
}
|
|
1734
1773
|
async getLoginCache() {
|
|
1735
|
-
let e = this.token.storage.get(
|
|
1774
|
+
let e = this.token.storage.get(Ki);
|
|
1736
1775
|
if (!e) return null;
|
|
1737
1776
|
let t = i(e);
|
|
1738
1777
|
return $(t) ? (this.token.weixinToken = t.weixin_token, await this.token.autoLogin(), t) : null;
|
|
@@ -1741,14 +1780,14 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1741
1780
|
if (!c()) throw Error("当前环境非微信小程序");
|
|
1742
1781
|
let t = await this.getLoginCache();
|
|
1743
1782
|
if (t) return t;
|
|
1744
|
-
let n = await
|
|
1783
|
+
let n = await ce(), { data: r, code: i, message: a } = await this.req.post("weixin/login", {
|
|
1745
1784
|
code: n,
|
|
1746
1785
|
appid: this.appid
|
|
1747
1786
|
}, $, {
|
|
1748
1787
|
...e,
|
|
1749
1788
|
message: !1
|
|
1750
1789
|
});
|
|
1751
|
-
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 ?? {
|
|
1752
1791
|
message: a,
|
|
1753
1792
|
error: i
|
|
1754
1793
|
};
|
|
@@ -1790,7 +1829,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1790
1829
|
let { data: t } = await this.req.get("weixin/offiaccount/jssdk-sign", {
|
|
1791
1830
|
appid: this.appid,
|
|
1792
1831
|
url: location.href.split("#")[0]
|
|
1793
|
-
},
|
|
1832
|
+
}, Wi, e);
|
|
1794
1833
|
return t ? {
|
|
1795
1834
|
appid: this.appid,
|
|
1796
1835
|
nonceStr: t.nonce_str,
|
|
@@ -1800,4 +1839,4 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1800
1839
|
}
|
|
1801
1840
|
};
|
|
1802
1841
|
//#endregion
|
|
1803
|
-
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/
|
|
30
|
+
"@seayoo-web/validator": "2.3.0",
|
|
31
|
+
"@seayoo-web/tsconfig": "1.0.6",
|
|
31
32
|
"@seayoo-web/combo-webview": "2.9.7",
|
|
32
|
-
"@seayoo-web/scripts": "4.3.6",
|
|
33
33
|
"@seayoo-web/utils": "4.4.1",
|
|
34
|
-
"@seayoo-web/
|
|
35
|
-
"@seayoo-web/
|
|
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";
|
|
@@ -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
|
+
};
|