@seayoo-web/gamer-api 4.1.4 → 4.2.1
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 -127
- package/package.json +5 -5
- package/types/index.d.ts +2 -0
- package/types/src/ggd.d.ts +31 -0
- package/types/src/ggd.enum.d.ts +22 -0
- package/types/src/ggd.enums.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(),
|
|
@@ -1374,20 +1374,61 @@ async function ci(e, t) {
|
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
1376
|
//#endregion
|
|
1377
|
-
//#region src/
|
|
1377
|
+
//#region src/ggd.enums.ts
|
|
1378
1378
|
var li = {
|
|
1379
|
+
Waiting: 1,
|
|
1380
|
+
Playing: 2
|
|
1381
|
+
}, ui = u.number().enum(li).lock(), di = class {
|
|
1382
|
+
req;
|
|
1383
|
+
constructor(e, t) {
|
|
1384
|
+
let n = d(e) ? e : `https://${o(e)}`;
|
|
1385
|
+
this.req = t({
|
|
1386
|
+
baseURL: `${n}/v1/ggd`,
|
|
1387
|
+
timeout: 1e4,
|
|
1388
|
+
maxRetry: 2,
|
|
1389
|
+
retryInterval: "2EB",
|
|
1390
|
+
responseRule: {
|
|
1391
|
+
ok: { resolve: "body" },
|
|
1392
|
+
failed: {
|
|
1393
|
+
resolve: "json",
|
|
1394
|
+
statusField: "error",
|
|
1395
|
+
messageField: ["user_message", "message"]
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
async describeRoomByCode(e) {
|
|
1401
|
+
let { data: t, ok: n, code: r, message: i } = await this.req.get("describe-room", { invitation_code: e || s("invitation_code") }, l({
|
|
1402
|
+
room_id: u.string(),
|
|
1403
|
+
inviter_role_id: u.number(),
|
|
1404
|
+
room_status: ui,
|
|
1405
|
+
room_mode: u.string(),
|
|
1406
|
+
room_tags: u.array(u.string()),
|
|
1407
|
+
max_members: u.number(),
|
|
1408
|
+
members: u.array(u.object({
|
|
1409
|
+
role_id: u.number(),
|
|
1410
|
+
role_name: u.string(),
|
|
1411
|
+
avatar_url: u.string()
|
|
1412
|
+
}))
|
|
1413
|
+
}), { message: !1 });
|
|
1414
|
+
return n && t ? t : {
|
|
1415
|
+
error: r,
|
|
1416
|
+
message: i
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
}, fi = {
|
|
1379
1420
|
All: "all",
|
|
1380
1421
|
Limit: "limit"
|
|
1381
|
-
},
|
|
1422
|
+
}, pi = u.string().enum(fi).lock(), mi = {
|
|
1382
1423
|
Pending: "pending",
|
|
1383
1424
|
Approved: "approved",
|
|
1384
1425
|
Failed: "failed",
|
|
1385
1426
|
Suspect: "suspect"
|
|
1386
|
-
}, V = u.string().enum(
|
|
1427
|
+
}, V = u.string().enum(mi).lock(), hi = {
|
|
1387
1428
|
System: "system",
|
|
1388
1429
|
Comment: "comment",
|
|
1389
1430
|
Like: "like"
|
|
1390
|
-
},
|
|
1431
|
+
}, gi = u.string().enum(hi).lock(), H = {
|
|
1391
1432
|
System: "system",
|
|
1392
1433
|
PostPinned: "post_pinned",
|
|
1393
1434
|
PostHighlighted: "post_highlighted",
|
|
@@ -1400,13 +1441,13 @@ var li = {
|
|
|
1400
1441
|
ReplyReplied: "reply_replied",
|
|
1401
1442
|
ReplyLiked: "reply_liked",
|
|
1402
1443
|
ReplyDeleted: "reply_deleted"
|
|
1403
|
-
},
|
|
1444
|
+
}, _i = u.string().enum(H).lock(), U = u.object({
|
|
1404
1445
|
forum_id: u.number(),
|
|
1405
1446
|
icon_url: u.string(),
|
|
1406
1447
|
name: u.string(),
|
|
1407
1448
|
tags: u.array(u.string()),
|
|
1408
1449
|
sort: u.number(),
|
|
1409
|
-
mode:
|
|
1450
|
+
mode: pi,
|
|
1410
1451
|
member_ids: u.array(u.number())
|
|
1411
1452
|
}).lock(), W = u.object({
|
|
1412
1453
|
topic_id: u.number(),
|
|
@@ -1435,7 +1476,7 @@ var li = {
|
|
|
1435
1476
|
is_highlighted: u.bool(),
|
|
1436
1477
|
status: V,
|
|
1437
1478
|
create_time: u.number()
|
|
1438
|
-
}).lock(), K = u.object({ err_msg: u.string().optional() }).optional().lock(),
|
|
1479
|
+
}).lock(), K = u.object({ err_msg: u.string().optional() }).optional().lock(), vi = u.object({
|
|
1439
1480
|
reply_id: u.number(),
|
|
1440
1481
|
reply_content: u.string().optional(),
|
|
1441
1482
|
replied_by: u.string(),
|
|
@@ -1454,7 +1495,7 @@ var li = {
|
|
|
1454
1495
|
content: u.string(),
|
|
1455
1496
|
like_num: u.number(),
|
|
1456
1497
|
liked: u.bool(),
|
|
1457
|
-
reply_to:
|
|
1498
|
+
reply_to: vi,
|
|
1458
1499
|
create_time: u.number()
|
|
1459
1500
|
}).lock(), J = u.object({
|
|
1460
1501
|
comment_id: u.number(),
|
|
@@ -1476,19 +1517,19 @@ var li = {
|
|
|
1476
1517
|
create_time: u.number(),
|
|
1477
1518
|
status: V,
|
|
1478
1519
|
replies: u.array(q).optional()
|
|
1479
|
-
}).lock(),
|
|
1520
|
+
}).lock(), yi = u.object({
|
|
1480
1521
|
image_url: u.string(),
|
|
1481
1522
|
upload_url: u.string(),
|
|
1482
1523
|
existed: u.bool()
|
|
1483
1524
|
}).lock(), Y = u.object({
|
|
1484
1525
|
notification_id: u.string(),
|
|
1485
|
-
notification_type:
|
|
1526
|
+
notification_type: _i,
|
|
1486
1527
|
is_read: u.bool(),
|
|
1487
1528
|
create_time: u.number(),
|
|
1488
1529
|
origin_user_id: u.string(),
|
|
1489
1530
|
origin_user_name: u.string(),
|
|
1490
1531
|
origin_user_avatar_url: u.string()
|
|
1491
|
-
}).lock(),
|
|
1532
|
+
}).lock(), bi = u.object({
|
|
1492
1533
|
system_message_subject: u.string(),
|
|
1493
1534
|
system_message_content: u.string()
|
|
1494
1535
|
}).lock(), X = u.object({
|
|
@@ -1502,86 +1543,86 @@ var li = {
|
|
|
1502
1543
|
}).lock(), Q = u.object({
|
|
1503
1544
|
reply_id: u.number(),
|
|
1504
1545
|
reply_content: u.string()
|
|
1505
|
-
}).lock(),
|
|
1546
|
+
}).lock(), xi = u.object({
|
|
1506
1547
|
...Y.shape,
|
|
1507
|
-
...
|
|
1548
|
+
...bi.shape,
|
|
1508
1549
|
notification_type: u.string().enum(H.System)
|
|
1509
|
-
}),
|
|
1550
|
+
}), Si = u.object({
|
|
1510
1551
|
...Y.shape,
|
|
1511
1552
|
...X.shape,
|
|
1512
1553
|
notification_type: u.string().enum(H.PostPinned, H.PostHighlighted, H.PostDeleted, H.PostLiked)
|
|
1513
|
-
}),
|
|
1554
|
+
}), Ci = u.object({
|
|
1514
1555
|
...Y.shape,
|
|
1515
1556
|
...X.shape,
|
|
1516
1557
|
...Z.shape,
|
|
1517
1558
|
notification_type: u.string().enum(H.PostCommented)
|
|
1518
|
-
}),
|
|
1559
|
+
}), wi = u.object({
|
|
1519
1560
|
...Y.shape,
|
|
1520
1561
|
...Z.shape,
|
|
1521
1562
|
...Q.shape,
|
|
1522
1563
|
notification_type: u.string().enum(H.CommentReplied)
|
|
1523
|
-
}),
|
|
1564
|
+
}), Ti = u.object({
|
|
1524
1565
|
...Y.shape,
|
|
1525
1566
|
...Z.shape,
|
|
1526
1567
|
...X.shape,
|
|
1527
1568
|
notification_type: u.string().enum(H.CommentLiked, H.CommentDeleted)
|
|
1528
|
-
}),
|
|
1569
|
+
}), Ei = u.object({
|
|
1529
1570
|
...Y.shape,
|
|
1530
1571
|
...Q.shape,
|
|
1531
1572
|
notification_type: u.string().enum(H.ReplyReplied),
|
|
1532
1573
|
comment_id: u.number(),
|
|
1533
1574
|
reply_to_reply_id: u.number(),
|
|
1534
1575
|
reply_to_reply_content: u.string()
|
|
1535
|
-
}),
|
|
1576
|
+
}), Di = u.object({
|
|
1536
1577
|
...Y.shape,
|
|
1537
1578
|
...Q.shape,
|
|
1538
1579
|
...Z.shape,
|
|
1539
1580
|
notification_type: u.string().enum(H.ReplyLiked, H.ReplyDeleted)
|
|
1540
|
-
}),
|
|
1581
|
+
}), Oi = u.union(xi, Si, Ci, wi, Ti, Ei, Di).satisfies().lock(), ki = l({ forums: u.array(U) }), Ai = l({ topics: u.array(W) }), ji = l({ topic: W }), Mi = l({ post: G }), Ni = l({
|
|
1541
1582
|
posts: u.array(G),
|
|
1542
1583
|
next_token: u.string().optional()
|
|
1543
|
-
}),
|
|
1584
|
+
}), Pi = l({
|
|
1544
1585
|
post: G.clone().optional(),
|
|
1545
1586
|
antispam: K.clone().optional()
|
|
1546
|
-
}),
|
|
1587
|
+
}), Fi = l({
|
|
1547
1588
|
replies: u.array(q),
|
|
1548
1589
|
next_token: u.string().optional()
|
|
1549
|
-
}),
|
|
1590
|
+
}), Ii = l({ reply: q }), Li = l({
|
|
1550
1591
|
reply: q.clone().optional(),
|
|
1551
1592
|
antispam: K.clone().optional()
|
|
1552
|
-
}),
|
|
1593
|
+
}), Ri = l({ comment: J }), zi = l({
|
|
1553
1594
|
comments: u.array(J),
|
|
1554
1595
|
next_token: u.string().optional()
|
|
1555
|
-
}),
|
|
1596
|
+
}), Bi = l({
|
|
1556
1597
|
comment: J.clone().optional(),
|
|
1557
1598
|
antispam: J.clone().optional()
|
|
1558
|
-
}),
|
|
1559
|
-
notifications: u.array(
|
|
1599
|
+
}), Vi = u.guard(yi), Hi = l({
|
|
1600
|
+
notifications: u.array(Oi),
|
|
1560
1601
|
next_token: u.string().optional()
|
|
1561
|
-
}),
|
|
1602
|
+
}), Ui = l({
|
|
1562
1603
|
system: u.number(),
|
|
1563
1604
|
comment: u.number(),
|
|
1564
1605
|
like: u.number()
|
|
1565
|
-
}),
|
|
1606
|
+
}), Wi = class {
|
|
1566
1607
|
token;
|
|
1567
1608
|
req;
|
|
1568
1609
|
constructor(e) {
|
|
1569
1610
|
this.token = e, this.req = e.req;
|
|
1570
1611
|
}
|
|
1571
1612
|
async getForums(e) {
|
|
1572
|
-
let { data: t } = await this.req.get("community/forums", null,
|
|
1613
|
+
let { data: t } = await this.req.get("community/forums", null, ki, e);
|
|
1573
1614
|
return t?.forums || [];
|
|
1574
1615
|
}
|
|
1575
1616
|
async getTopics(e) {
|
|
1576
|
-
let { data: t } = await this.req.get("community/topics", null,
|
|
1617
|
+
let { data: t } = await this.req.get("community/topics", null, Ai, e);
|
|
1577
1618
|
return t?.topics || [];
|
|
1578
1619
|
}
|
|
1579
1620
|
async getTopic(e, t) {
|
|
1580
|
-
let { data: n, code: r } = await this.req.get("community/topic", { topic_id: e },
|
|
1621
|
+
let { data: n, code: r } = await this.req.get("community/topic", { topic_id: e }, ji, t);
|
|
1581
1622
|
return n?.topic ?? { error: r };
|
|
1582
1623
|
}
|
|
1583
1624
|
async getPosts(e, t) {
|
|
1584
|
-
let { data: n, code: r, message: i } = await this.req.get("community/posts", e || null,
|
|
1625
|
+
let { data: n, code: r, message: i } = await this.req.get("community/posts", e || null, Ni, t);
|
|
1585
1626
|
return n ?? {
|
|
1586
1627
|
message: i,
|
|
1587
1628
|
error: r
|
|
@@ -1592,35 +1633,35 @@ var li = {
|
|
|
1592
1633
|
forum_id: e,
|
|
1593
1634
|
max_results: t,
|
|
1594
1635
|
next_token: n
|
|
1595
|
-
},
|
|
1636
|
+
}, Ni, r);
|
|
1596
1637
|
return i ?? {
|
|
1597
1638
|
message: o,
|
|
1598
1639
|
error: a
|
|
1599
1640
|
};
|
|
1600
1641
|
}
|
|
1601
1642
|
async getPost(e, t) {
|
|
1602
|
-
let { data: n, code: r, message: i } = await this.req.get("community/post", { post_id: e },
|
|
1643
|
+
let { data: n, code: r, message: i } = await this.req.get("community/post", { post_id: e }, Mi, t);
|
|
1603
1644
|
return n?.post ?? {
|
|
1604
1645
|
message: i,
|
|
1605
1646
|
error: r
|
|
1606
1647
|
};
|
|
1607
1648
|
}
|
|
1608
1649
|
async post(e, t) {
|
|
1609
|
-
let { data: n, code: r, message: i } = await this.req.post("community/post", a(e),
|
|
1650
|
+
let { data: n, code: r, message: i } = await this.req.post("community/post", a(e), Pi, t);
|
|
1610
1651
|
return n ?? {
|
|
1611
1652
|
message: i,
|
|
1612
1653
|
error: r
|
|
1613
1654
|
};
|
|
1614
1655
|
}
|
|
1615
1656
|
async getComments(e, t) {
|
|
1616
|
-
let { data: n, code: r, message: i } = await this.req.get("community/comments", e,
|
|
1657
|
+
let { data: n, code: r, message: i } = await this.req.get("community/comments", e, zi, t);
|
|
1617
1658
|
return n ?? {
|
|
1618
1659
|
message: i,
|
|
1619
1660
|
error: r
|
|
1620
1661
|
};
|
|
1621
1662
|
}
|
|
1622
1663
|
async getComment(e, t) {
|
|
1623
|
-
let { data: n, code: r, message: i } = await this.req.get("community/comment", { comment_id: e },
|
|
1664
|
+
let { data: n, code: r, message: i } = await this.req.get("community/comment", { comment_id: e }, Ri, t);
|
|
1624
1665
|
return n?.comment ?? {
|
|
1625
1666
|
message: i,
|
|
1626
1667
|
error: r
|
|
@@ -1628,7 +1669,7 @@ var li = {
|
|
|
1628
1669
|
}
|
|
1629
1670
|
async comment(e, t) {
|
|
1630
1671
|
await this.token.autoLogin();
|
|
1631
|
-
let { data: n, code: r, message: i } = await this.req.post("community/comment", a(e),
|
|
1672
|
+
let { data: n, code: r, message: i } = await this.req.post("community/comment", a(e), Bi, t);
|
|
1632
1673
|
return n ?? {
|
|
1633
1674
|
message: i,
|
|
1634
1675
|
error: r
|
|
@@ -1638,14 +1679,14 @@ var li = {
|
|
|
1638
1679
|
let { data: n } = await this.req.get("community/replies", {
|
|
1639
1680
|
max_results: 20,
|
|
1640
1681
|
...e
|
|
1641
|
-
},
|
|
1682
|
+
}, Fi, t);
|
|
1642
1683
|
return {
|
|
1643
1684
|
replies: n?.replies || [],
|
|
1644
1685
|
next_token: n?.next_token || ""
|
|
1645
1686
|
};
|
|
1646
1687
|
}
|
|
1647
1688
|
async getReply(e, t) {
|
|
1648
|
-
let { data: n, code: r, message: i } = await this.req.get("community/reply", { reply_id: e },
|
|
1689
|
+
let { data: n, code: r, message: i } = await this.req.get("community/reply", { reply_id: e }, Ii, t);
|
|
1649
1690
|
return n?.reply ?? {
|
|
1650
1691
|
message: i,
|
|
1651
1692
|
error: r
|
|
@@ -1653,7 +1694,7 @@ var li = {
|
|
|
1653
1694
|
}
|
|
1654
1695
|
async reply(e, t) {
|
|
1655
1696
|
await this.token.autoLogin();
|
|
1656
|
-
let { data: n, code: r, message: i } = await this.req.post("community/reply", a(e),
|
|
1697
|
+
let { data: n, code: r, message: i } = await this.req.post("community/reply", a(e), Li, t);
|
|
1657
1698
|
return n ?? {
|
|
1658
1699
|
message: i,
|
|
1659
1700
|
error: r
|
|
@@ -1683,7 +1724,7 @@ var li = {
|
|
|
1683
1724
|
}
|
|
1684
1725
|
async getMediaPresignedUrl(e, t) {
|
|
1685
1726
|
await this.token.autoLogin();
|
|
1686
|
-
let { data: n } = await this.req.get("community/media-presign-url", e,
|
|
1727
|
+
let { data: n } = await this.req.get("community/media-presign-url", e, Vi, t);
|
|
1687
1728
|
return n;
|
|
1688
1729
|
}
|
|
1689
1730
|
async getNotifications(e, t) {
|
|
@@ -1691,7 +1732,7 @@ var li = {
|
|
|
1691
1732
|
let { data: n } = await this.req.get("community/notifications", {
|
|
1692
1733
|
max_results: 20,
|
|
1693
1734
|
...e
|
|
1694
|
-
},
|
|
1735
|
+
}, Hi, t);
|
|
1695
1736
|
return {
|
|
1696
1737
|
notifications: n?.notifications || [],
|
|
1697
1738
|
next_token: n?.next_token || ""
|
|
@@ -1699,7 +1740,7 @@ var li = {
|
|
|
1699
1740
|
}
|
|
1700
1741
|
async getUnreadNotificationsCount(e) {
|
|
1701
1742
|
if (!await this.token.autoLogin()) return null;
|
|
1702
|
-
let { data: t } = await this.req.get("community/unread-notifications-count", null,
|
|
1743
|
+
let { data: t } = await this.req.get("community/unread-notifications-count", null, Ui, e);
|
|
1703
1744
|
return t;
|
|
1704
1745
|
}
|
|
1705
1746
|
async clearUnreadNotifications(e, t) {
|
|
@@ -1707,11 +1748,11 @@ var li = {
|
|
|
1707
1748
|
let { ok: n } = await this.req.post("community/clear-unread-notifications", { category: e }, null, t);
|
|
1708
1749
|
return n;
|
|
1709
1750
|
}
|
|
1710
|
-
},
|
|
1751
|
+
}, Gi = l({
|
|
1711
1752
|
nonce_str: u.string(),
|
|
1712
1753
|
timestamp: u.number(),
|
|
1713
1754
|
signature: u.string()
|
|
1714
|
-
}),
|
|
1755
|
+
}), Ki = /* @__PURE__ */ function(e) {
|
|
1715
1756
|
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
1757
|
}({});
|
|
1717
1758
|
//#endregion
|
|
@@ -1721,7 +1762,7 @@ function $(e) {
|
|
|
1721
1762
|
}
|
|
1722
1763
|
//#endregion
|
|
1723
1764
|
//#region src/weixin.ts
|
|
1724
|
-
var
|
|
1765
|
+
var qi = "wx_login_cache", Ji = class {
|
|
1725
1766
|
token;
|
|
1726
1767
|
_appid;
|
|
1727
1768
|
req;
|
|
@@ -1732,7 +1773,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1732
1773
|
return this._appid;
|
|
1733
1774
|
}
|
|
1734
1775
|
async getLoginCache() {
|
|
1735
|
-
let e = this.token.storage.get(
|
|
1776
|
+
let e = this.token.storage.get(qi);
|
|
1736
1777
|
if (!e) return null;
|
|
1737
1778
|
let t = i(e);
|
|
1738
1779
|
return $(t) ? (this.token.weixinToken = t.weixin_token, await this.token.autoLogin(), t) : null;
|
|
@@ -1741,14 +1782,14 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1741
1782
|
if (!c()) throw Error("当前环境非微信小程序");
|
|
1742
1783
|
let t = await this.getLoginCache();
|
|
1743
1784
|
if (t) return t;
|
|
1744
|
-
let n = await
|
|
1785
|
+
let n = await ce(), { data: r, code: i, message: a } = await this.req.post("weixin/login", {
|
|
1745
1786
|
code: n,
|
|
1746
1787
|
appid: this.appid
|
|
1747
1788
|
}, $, {
|
|
1748
1789
|
...e,
|
|
1749
1790
|
message: !1
|
|
1750
1791
|
});
|
|
1751
|
-
return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(
|
|
1792
|
+
return r && (this.token.weixinToken = r.weixin_token, this.token.storage.set(qi, JSON.stringify(r))), r ?? {
|
|
1752
1793
|
message: a,
|
|
1753
1794
|
error: i
|
|
1754
1795
|
};
|
|
@@ -1790,7 +1831,7 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1790
1831
|
let { data: t } = await this.req.get("weixin/offiaccount/jssdk-sign", {
|
|
1791
1832
|
appid: this.appid,
|
|
1792
1833
|
url: location.href.split("#")[0]
|
|
1793
|
-
},
|
|
1834
|
+
}, Gi, e);
|
|
1794
1835
|
return t ? {
|
|
1795
1836
|
appid: this.appid,
|
|
1796
1837
|
nonceStr: t.nonce_str,
|
|
@@ -1800,4 +1841,4 @@ var Wi = "wx_login_cache", Gi = class {
|
|
|
1800
1841
|
}
|
|
1801
1842
|
};
|
|
1802
1843
|
//#endregion
|
|
1803
|
-
export { K as AntispamValidator,
|
|
1844
|
+
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, Wi 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, fi as ForumMode, pi as ForumModeValidator, U as ForumValidator, di as GGDPublicApi, li as GGDRoomStatus, ui as GGDRoomStatusValidator, 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, hi as NotificationCategory, gi as NotificationCategoryValidator, wi as NotificationCommentReplyValidator, Ti as NotificationCommentValidator, Z as NotificationPayloadCommentValidator, X as NotificationPayloadPostValidator, Q as NotificationPayloadReplyValidator, bi as NotificationPayloadSystemValidator, Ci as NotificationPostCommentValidator, Si as NotificationPostValidator, Ei as NotificationReplyRepliedValidator, Di as NotificationReplyValidator, xi as NotificationSystemValidator, H as NotificationType, _i as NotificationTypeValidator, Oi as NotificationValidator, Ce as PlayerRoleCardValidator, m as PlayerRoleValidator, mi as PostStatus, V as PostStatusValidator, G as PostValidator, xn as PreregisterEngagementDataValidator, yi 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, vi 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, Ji as WeixinApi, On as WeixinSubscribeEngagementDataValidator, Ki 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, Gi 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.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "agent for gamer api",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "web@seayoo.com",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.13.1",
|
|
30
|
-
"@seayoo-web/
|
|
31
|
-
"@seayoo-web/combo-webview": "2.9.7",
|
|
30
|
+
"@seayoo-web/tsconfig": "1.0.6",
|
|
32
31
|
"@seayoo-web/scripts": "4.3.6",
|
|
32
|
+
"@seayoo-web/combo-webview": "2.9.7",
|
|
33
|
+
"@seayoo-web/validator": "2.3.0",
|
|
33
34
|
"@seayoo-web/utils": "4.4.1",
|
|
34
|
-
"@seayoo-web/
|
|
35
|
-
"@seayoo-web/validator": "2.3.0"
|
|
35
|
+
"@seayoo-web/request": "4.1.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@seayoo-web/combo-webview": "^2.9.7",
|
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ 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";
|
|
11
|
+
export * from "./src/ggd.enums";
|
|
10
12
|
export * from "./src/community";
|
|
11
13
|
export * from "./src/community.define";
|
|
12
14
|
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.enums").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
|
+
};
|
|
@@ -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
|
+
};
|