fishpi 0.0.21 → 0.0.22

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/lib/typing.js ADDED
@@ -0,0 +1,446 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VoteStatus = exports.ArticleListType = exports.ArticleStatus = exports.YesNoStatus = exports.PublicStatus = exports.ArticleType = exports.ReportType = exports.ReportDataType = exports.NoticeType = exports.ChatRoomMessageType = exports.ChatMessageType = exports.ChatContentType = exports.RedPacketType = exports.GestureType = exports.UserAppRole = exports.DataType = void 0;
4
+ /**
5
+ * 数据类型
6
+ */
7
+ var DataType;
8
+ (function (DataType) {
9
+ /**
10
+ * 文章
11
+ */
12
+ DataType[DataType["article"] = 0] = "article";
13
+ /**
14
+ * 评论
15
+ */
16
+ DataType[DataType["comment"] = 1] = "comment";
17
+ /**
18
+ * @
19
+ */
20
+ DataType[DataType["at"] = 2] = "at";
21
+ /**
22
+ * 被评论
23
+ */
24
+ DataType[DataType["commented"] = 3] = "commented";
25
+ /**
26
+ * 关注者
27
+ */
28
+ DataType[DataType["followingUser"] = 4] = "followingUser";
29
+ /**
30
+ * 积分 - 充值
31
+ */
32
+ DataType[DataType["pointCharge"] = 5] = "pointCharge";
33
+ /**
34
+ * 积分 - 转账
35
+ */
36
+ DataType[DataType["pointTransfer"] = 6] = "pointTransfer";
37
+ /**
38
+ * 积分 - 文章打赏
39
+ */
40
+ DataType[DataType["pointArticleReward"] = 7] = "pointArticleReward";
41
+ /**
42
+ * 积分 - 评论感谢
43
+ */
44
+ DataType[DataType["pointCommentThank"] = 8] = "pointCommentThank";
45
+ /**
46
+ * 同城广播
47
+ */
48
+ DataType[DataType["broadcast"] = 9] = "broadcast";
49
+ /**
50
+ * 积分 - 交易
51
+ */
52
+ DataType[DataType["pointExchange"] = 10] = "pointExchange";
53
+ /**
54
+ * 积分 - 滥用扣除
55
+ */
56
+ DataType[DataType["abusePointDeduct"] = 11] = "abusePointDeduct";
57
+ /**
58
+ * 积分 - 文章被感谢
59
+ */
60
+ DataType[DataType["pointArticleThank"] = 12] = "pointArticleThank";
61
+ /**
62
+ * 回复
63
+ */
64
+ DataType[DataType["reply"] = 13] = "reply";
65
+ /**
66
+ * 使用邀请码
67
+ */
68
+ DataType[DataType["invitecodeUsed"] = 14] = "invitecodeUsed";
69
+ /**
70
+ * 系统公告 - 文章
71
+ */
72
+ DataType[DataType["sysAnnounceArticle"] = 15] = "sysAnnounceArticle";
73
+ /**
74
+ * 系统公告 - 新用户
75
+ */
76
+ DataType[DataType["sysAnnounceNewUser"] = 16] = "sysAnnounceNewUser";
77
+ /**
78
+ * 新的关注者
79
+ */
80
+ DataType[DataType["newFollower"] = 17] = "newFollower";
81
+ /**
82
+ * 邀请链接
83
+ */
84
+ DataType[DataType["invitationLinkUsed"] = 18] = "invitationLinkUsed";
85
+ /**
86
+ * 系统通知 - 角色变化
87
+ */
88
+ DataType[DataType["sysAnnounceRoleChanged"] = 19] = "sysAnnounceRoleChanged";
89
+ /**
90
+ * 关注的文章更新
91
+ */
92
+ DataType[DataType["followingArticleUpdate"] = 20] = "followingArticleUpdate";
93
+ /**
94
+ * 关注的文章评论
95
+ */
96
+ DataType[DataType["followingArticleComment"] = 21] = "followingArticleComment";
97
+ /**
98
+ * 积分 - 文章优选
99
+ */
100
+ DataType[DataType["pointPerfectArticle"] = 22] = "pointPerfectArticle";
101
+ /**
102
+ * 文章新的被关注者
103
+ */
104
+ DataType[DataType["articleNewFollower"] = 23] = "articleNewFollower";
105
+ /**
106
+ * 文章新的关注者
107
+ */
108
+ DataType[DataType["articleNewWatcher"] = 24] = "articleNewWatcher";
109
+ /**
110
+ * 评论点赞
111
+ */
112
+ DataType[DataType["commentVoteUp"] = 25] = "commentVoteUp";
113
+ /**
114
+ * 评论点踩
115
+ */
116
+ DataType[DataType["commentVoteDown"] = 26] = "commentVoteDown";
117
+ /**
118
+ * 文章被点赞
119
+ */
120
+ DataType[DataType["articleVoteUp"] = 27] = "articleVoteUp";
121
+ /**
122
+ * 文章被点踩
123
+ */
124
+ DataType[DataType["articleVoteDown"] = 28] = "articleVoteDown";
125
+ /**
126
+ * 积分 - 评论被接受
127
+ */
128
+ DataType[DataType["pointCommentAccept"] = 33] = "pointCommentAccept";
129
+ /**
130
+ * 积分 - 举报处理
131
+ */
132
+ DataType[DataType["pointReportHandled"] = 36] = "pointReportHandled";
133
+ /**
134
+ * 聊天室 @
135
+ */
136
+ DataType[DataType["chatRoomAt"] = 38] = "chatRoomAt";
137
+ /**
138
+ * 专属红包提醒
139
+ */
140
+ DataType[DataType["redPacket"] = 39] = "redPacket";
141
+ })(DataType = exports.DataType || (exports.DataType = {}));
142
+ var UserAppRole;
143
+ (function (UserAppRole) {
144
+ /**
145
+ * 黑客
146
+ */
147
+ UserAppRole[UserAppRole["Hack"] = 0] = "Hack";
148
+ /**
149
+ * 画家
150
+ */
151
+ UserAppRole[UserAppRole["Artist"] = 1] = "Artist";
152
+ })(UserAppRole = exports.UserAppRole || (exports.UserAppRole = {}));
153
+ /**
154
+ * 猜拳类型
155
+ */
156
+ var GestureType;
157
+ (function (GestureType) {
158
+ /**
159
+ * 石头
160
+ */
161
+ GestureType[GestureType["Rock"] = 0] = "Rock";
162
+ /**
163
+ * 剪刀
164
+ */
165
+ GestureType[GestureType["Scissors"] = 1] = "Scissors";
166
+ /**
167
+ * 布
168
+ */
169
+ GestureType[GestureType["Paper"] = 2] = "Paper";
170
+ })(GestureType = exports.GestureType || (exports.GestureType = {}));
171
+ /**
172
+ * 红包类型
173
+ */
174
+ var RedPacketType;
175
+ (function (RedPacketType) {
176
+ /**
177
+ * 拼手气
178
+ */
179
+ RedPacketType["Random"] = "random";
180
+ /**
181
+ * 平分
182
+ */
183
+ RedPacketType["Average"] = "average";
184
+ /**
185
+ * 专属
186
+ */
187
+ RedPacketType["Specify"] = "specify";
188
+ /**
189
+ * 心跳
190
+ */
191
+ RedPacketType["Heartbeat"] = "heartbeat";
192
+ /**
193
+ * 猜拳
194
+ */
195
+ RedPacketType["RockPaperScissors"] = "rockPaperScissors";
196
+ })(RedPacketType = exports.RedPacketType || (exports.RedPacketType = {}));
197
+ /**
198
+ * 历史消息类型
199
+ */
200
+ var ChatContentType;
201
+ (function (ChatContentType) {
202
+ /**
203
+ * 原始 Markdown
204
+ */
205
+ ChatContentType["Markdown"] = "md";
206
+ /**
207
+ * 渲染 HTML
208
+ */
209
+ ChatContentType["HTML"] = "html";
210
+ })(ChatContentType = exports.ChatContentType || (exports.ChatContentType = {}));
211
+ /**
212
+ * chatroom get 接口获取 oId 的相关消息类型
213
+ */
214
+ var ChatMessageType;
215
+ (function (ChatMessageType) {
216
+ /**
217
+ * 前后消息
218
+ */
219
+ ChatMessageType[ChatMessageType["Context"] = 0] = "Context";
220
+ /**
221
+ * 前面的消息
222
+ */
223
+ ChatMessageType[ChatMessageType["Before"] = 1] = "Before";
224
+ /**
225
+ * 后面的消息
226
+ */
227
+ ChatMessageType[ChatMessageType["After"] = 2] = "After";
228
+ })(ChatMessageType = exports.ChatMessageType || (exports.ChatMessageType = {}));
229
+ /**
230
+ * 聊天室消息类型
231
+ */
232
+ var ChatRoomMessageType;
233
+ (function (ChatRoomMessageType) {
234
+ /**
235
+ * 在线用户
236
+ */
237
+ ChatRoomMessageType["online"] = "online";
238
+ /**
239
+ * 话题修改
240
+ */
241
+ ChatRoomMessageType["discussChanged"] = "discussChanged";
242
+ /**
243
+ * 消息撤回
244
+ */
245
+ ChatRoomMessageType["revoke"] = "revoke";
246
+ /**
247
+ * 消息
248
+ */
249
+ ChatRoomMessageType["msg"] = "msg";
250
+ /**
251
+ * 红包
252
+ */
253
+ ChatRoomMessageType["redPacket"] = "redPacket";
254
+ /**
255
+ * 红包状态
256
+ */
257
+ ChatRoomMessageType["redPacketStatus"] = "redPacketStatus";
258
+ /**
259
+ * 弹幕
260
+ */
261
+ ChatRoomMessageType["barrager"] = "barrager";
262
+ })(ChatRoomMessageType = exports.ChatRoomMessageType || (exports.ChatRoomMessageType = {}));
263
+ /**
264
+ * 通知类型
265
+ */
266
+ var NoticeType;
267
+ (function (NoticeType) {
268
+ /**
269
+ * 积分
270
+ */
271
+ NoticeType["Point"] = "point";
272
+ /**
273
+ * 评论
274
+ */
275
+ NoticeType["Comment"] = "commented";
276
+ /**
277
+ * 回复
278
+ */
279
+ NoticeType["Reply"] = "reply";
280
+ /**
281
+ * 提及我的
282
+ */
283
+ NoticeType["At"] = "at";
284
+ /**
285
+ * 我关注的
286
+ */
287
+ NoticeType["Following"] = "following";
288
+ /**
289
+ * 同城
290
+ */
291
+ NoticeType["Broadcast"] = "broadcast";
292
+ /**
293
+ * 系统
294
+ */
295
+ NoticeType["System"] = "sys-announce";
296
+ })(NoticeType = exports.NoticeType || (exports.NoticeType = {}));
297
+ /**
298
+ * 举报数据类型
299
+ */
300
+ var ReportDataType;
301
+ (function (ReportDataType) {
302
+ /**
303
+ * 文章
304
+ */
305
+ ReportDataType[ReportDataType["article"] = 0] = "article";
306
+ /**
307
+ * 评论
308
+ */
309
+ ReportDataType[ReportDataType["comment"] = 1] = "comment";
310
+ /**
311
+ * 用户
312
+ */
313
+ ReportDataType[ReportDataType["user"] = 2] = "user";
314
+ /**
315
+ * 聊天消息
316
+ */
317
+ ReportDataType[ReportDataType["chatroom"] = 3] = "chatroom";
318
+ })(ReportDataType = exports.ReportDataType || (exports.ReportDataType = {}));
319
+ /**
320
+ * 举报类型
321
+ */
322
+ var ReportType;
323
+ (function (ReportType) {
324
+ /**
325
+ * 垃圾广告
326
+ */
327
+ ReportType[ReportType["advertise"] = 0] = "advertise";
328
+ /**
329
+ * 色情
330
+ */
331
+ ReportType[ReportType["porn"] = 1] = "porn";
332
+ /**
333
+ * 违规
334
+ */
335
+ ReportType[ReportType["violate"] = 2] = "violate";
336
+ /**
337
+ * 侵权
338
+ */
339
+ ReportType[ReportType["infringement"] = 3] = "infringement";
340
+ /**
341
+ * 人身攻击
342
+ */
343
+ ReportType[ReportType["attacks"] = 4] = "attacks";
344
+ /**
345
+ * 冒充他人账号
346
+ */
347
+ ReportType[ReportType["impersonate"] = 5] = "impersonate";
348
+ /**
349
+ * 垃圾广告账号
350
+ */
351
+ ReportType[ReportType["advertisingAccount"] = 6] = "advertisingAccount";
352
+ /**
353
+ * 违规泄露个人信息
354
+ */
355
+ ReportType[ReportType["leakPrivacy"] = 7] = "leakPrivacy";
356
+ /**
357
+ * 其它
358
+ */
359
+ ReportType[ReportType["other"] = 8] = "other";
360
+ })(ReportType = exports.ReportType || (exports.ReportType = {}));
361
+ /**
362
+ * 帖子类型
363
+ */
364
+ var ArticleType;
365
+ (function (ArticleType) {
366
+ ArticleType[ArticleType["Normal"] = 0] = "Normal";
367
+ ArticleType[ArticleType["Private"] = 1] = "Private";
368
+ ArticleType[ArticleType["Broadcast"] = 2] = "Broadcast";
369
+ ArticleType[ArticleType["Thought"] = 3] = "Thought";
370
+ ArticleType[ArticleType["Question"] = 5] = "Question";
371
+ })(ArticleType = exports.ArticleType || (exports.ArticleType = {}));
372
+ /**
373
+ * 公开状态
374
+ */
375
+ var PublicStatus;
376
+ (function (PublicStatus) {
377
+ PublicStatus[PublicStatus["Public"] = 0] = "Public";
378
+ PublicStatus[PublicStatus["Private"] = 1] = "Private";
379
+ })(PublicStatus = exports.PublicStatus || (exports.PublicStatus = {}));
380
+ /**
381
+ * 是否状态
382
+ */
383
+ var YesNoStatus;
384
+ (function (YesNoStatus) {
385
+ YesNoStatus[YesNoStatus["Yes"] = 0] = "Yes";
386
+ YesNoStatus[YesNoStatus["No"] = 1] = "No";
387
+ })(YesNoStatus = exports.YesNoStatus || (exports.YesNoStatus = {}));
388
+ /**
389
+ * 文章状态
390
+ */
391
+ var ArticleStatus;
392
+ (function (ArticleStatus) {
393
+ /**
394
+ * 正常
395
+ */
396
+ ArticleStatus[ArticleStatus["Normal"] = 0] = "Normal";
397
+ /**
398
+ * 封禁
399
+ */
400
+ ArticleStatus[ArticleStatus["Ban"] = 1] = "Ban";
401
+ /**
402
+ * 锁定
403
+ */
404
+ ArticleStatus[ArticleStatus["Lock"] = 2] = "Lock";
405
+ })(ArticleStatus = exports.ArticleStatus || (exports.ArticleStatus = {}));
406
+ ;
407
+ /**
408
+ * 帖子列表查询类型
409
+ */
410
+ var ArticleListType;
411
+ (function (ArticleListType) {
412
+ /**
413
+ * 最近
414
+ */
415
+ ArticleListType["Recent"] = "";
416
+ /**
417
+ * 热门
418
+ */
419
+ ArticleListType["Hot"] = "/hot";
420
+ /**
421
+ * 点赞
422
+ */
423
+ ArticleListType["Good"] = "/good";
424
+ /**
425
+ * 最近回复
426
+ */
427
+ ArticleListType["Reply"] = "/reply";
428
+ /**
429
+ * 优选,需包含标签
430
+ */
431
+ ArticleListType["Perfect"] = "/perfact";
432
+ })(ArticleListType = exports.ArticleListType || (exports.ArticleListType = {}));
433
+ /**
434
+ * 点赞类型
435
+ */
436
+ var VoteStatus;
437
+ (function (VoteStatus) {
438
+ /**
439
+ * 点赞
440
+ */
441
+ VoteStatus[VoteStatus["Voted"] = 0] = "Voted";
442
+ /**
443
+ * 取消点赞
444
+ */
445
+ VoteStatus[VoteStatus["Unvote"] = -1] = "Unvote";
446
+ })(VoteStatus = exports.VoteStatus || (exports.VoteStatus = {}));
package/lib/user.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { ApiResponse, UserInfo } from './typing';
2
+ declare class User {
3
+ private _apiKey;
4
+ constructor(token?: string);
5
+ /**
6
+ * 重新设置请求 Token
7
+ * @param apiKey 接口 API Key
8
+ */
9
+ setToken(token: string): void;
10
+ /**
11
+ * 返回登录账户信息,需要先登录或设置有效的 api key
12
+ */
13
+ info(): Promise<ApiResponse<UserInfo>>;
14
+ /**
15
+ * 查询登录用户常用表情
16
+ */
17
+ emotions(): Promise<ApiResponse<Array<string>>>;
18
+ /**
19
+ * 查询登录用户当前活跃度,请求频率请控制在 30 ~ 60 秒一次
20
+ */
21
+ liveness(): Promise<number>;
22
+ /**
23
+ * 检查登录用户是否已经签到
24
+ */
25
+ isCheckIn(): Promise<boolean>;
26
+ /**
27
+ * 检查登录用户是否已经领取昨日活跃奖励
28
+ */
29
+ isCollectedLiveness(): Promise<boolean>;
30
+ /**
31
+ * 领取昨日活跃度奖励
32
+ */
33
+ rewardLiveness(): Promise<number>;
34
+ }
35
+ export default User;
package/lib/user.js ADDED
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var utils_1 = require("./utils");
40
+ var User = /** @class */ (function () {
41
+ function User(token) {
42
+ if (token === void 0) { token = ''; }
43
+ this._apiKey = '';
44
+ if (!token) {
45
+ return;
46
+ }
47
+ this._apiKey = token;
48
+ }
49
+ /**
50
+ * 重新设置请求 Token
51
+ * @param apiKey 接口 API Key
52
+ */
53
+ User.prototype.setToken = function (token) {
54
+ this._apiKey = token;
55
+ };
56
+ /**
57
+ * 返回登录账户信息,需要先登录或设置有效的 api key
58
+ */
59
+ User.prototype.info = function () {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ var rsp, e_1;
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0:
65
+ _a.trys.push([0, 2, , 3]);
66
+ return [4 /*yield*/, (0, utils_1.request)({
67
+ url: "api/user?apiKey=".concat(this._apiKey)
68
+ })];
69
+ case 1:
70
+ rsp = _a.sent();
71
+ if (rsp.data)
72
+ rsp.data.sysMetal = (0, utils_1.toMetal)(rsp.data.sysMetal);
73
+ return [2 /*return*/, rsp.data];
74
+ case 2:
75
+ e_1 = _a.sent();
76
+ throw e_1;
77
+ case 3: return [2 /*return*/];
78
+ }
79
+ });
80
+ });
81
+ };
82
+ /**
83
+ * 查询登录用户常用表情
84
+ */
85
+ User.prototype.emotions = function () {
86
+ return __awaiter(this, void 0, void 0, function () {
87
+ var rsp, e_2;
88
+ return __generator(this, function (_a) {
89
+ switch (_a.label) {
90
+ case 0:
91
+ _a.trys.push([0, 2, , 3]);
92
+ return [4 /*yield*/, (0, utils_1.request)({
93
+ url: "users/emotions?apiKey=".concat(this._apiKey),
94
+ })];
95
+ case 1:
96
+ rsp = _a.sent();
97
+ rsp.data = Object.keys(rsp.data);
98
+ return [2 /*return*/, rsp.data];
99
+ case 2:
100
+ e_2 = _a.sent();
101
+ throw e_2;
102
+ case 3: return [2 /*return*/];
103
+ }
104
+ });
105
+ });
106
+ };
107
+ /**
108
+ * 查询登录用户当前活跃度,请求频率请控制在 30 ~ 60 秒一次
109
+ */
110
+ User.prototype.liveness = function () {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ var rsp, e_3;
113
+ return __generator(this, function (_a) {
114
+ switch (_a.label) {
115
+ case 0:
116
+ if (!this._apiKey) {
117
+ return [2 /*return*/, 0];
118
+ }
119
+ _a.label = 1;
120
+ case 1:
121
+ _a.trys.push([1, 3, , 4]);
122
+ return [4 /*yield*/, (0, utils_1.request)({
123
+ url: "user/liveness?apiKey=".concat(this._apiKey)
124
+ })];
125
+ case 2:
126
+ rsp = _a.sent();
127
+ return [2 /*return*/, rsp.liveness || 0];
128
+ case 3:
129
+ e_3 = _a.sent();
130
+ throw e_3;
131
+ case 4: return [2 /*return*/];
132
+ }
133
+ });
134
+ });
135
+ };
136
+ /**
137
+ * 检查登录用户是否已经签到
138
+ */
139
+ User.prototype.isCheckIn = function () {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ var rsp, e_4;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ if (!this._apiKey) {
146
+ return [2 /*return*/, false];
147
+ }
148
+ _a.label = 1;
149
+ case 1:
150
+ _a.trys.push([1, 3, , 4]);
151
+ return [4 /*yield*/, (0, utils_1.request)({
152
+ url: "user/checkedIn?apiKey=".concat(this._apiKey)
153
+ })];
154
+ case 2:
155
+ rsp = _a.sent();
156
+ return [2 /*return*/, rsp.checkedIn || false];
157
+ case 3:
158
+ e_4 = _a.sent();
159
+ throw e_4;
160
+ case 4: return [2 /*return*/];
161
+ }
162
+ });
163
+ });
164
+ };
165
+ /**
166
+ * 检查登录用户是否已经领取昨日活跃奖励
167
+ */
168
+ User.prototype.isCollectedLiveness = function () {
169
+ return __awaiter(this, void 0, void 0, function () {
170
+ var rsp, e_5;
171
+ return __generator(this, function (_a) {
172
+ switch (_a.label) {
173
+ case 0:
174
+ if (!this._apiKey) {
175
+ return [2 /*return*/, false];
176
+ }
177
+ _a.label = 1;
178
+ case 1:
179
+ _a.trys.push([1, 3, , 4]);
180
+ return [4 /*yield*/, (0, utils_1.request)({
181
+ url: "api/activity/is-collected-liveness?apiKey=".concat(this._apiKey)
182
+ })];
183
+ case 2:
184
+ rsp = _a.sent();
185
+ return [2 /*return*/, rsp.isCollectedYesterdayLivenessReward || false];
186
+ case 3:
187
+ e_5 = _a.sent();
188
+ throw e_5;
189
+ case 4: return [2 /*return*/];
190
+ }
191
+ });
192
+ });
193
+ };
194
+ /**
195
+ * 领取昨日活跃度奖励
196
+ */
197
+ User.prototype.rewardLiveness = function () {
198
+ return __awaiter(this, void 0, void 0, function () {
199
+ var rsp, e_6;
200
+ return __generator(this, function (_a) {
201
+ switch (_a.label) {
202
+ case 0:
203
+ if (!this._apiKey) {
204
+ return [2 /*return*/, 0];
205
+ }
206
+ _a.label = 1;
207
+ case 1:
208
+ _a.trys.push([1, 3, , 4]);
209
+ return [4 /*yield*/, (0, utils_1.request)({
210
+ url: "activity/yesterday-liveness-reward-api?apiKey=".concat(this._apiKey)
211
+ })];
212
+ case 2:
213
+ rsp = _a.sent();
214
+ return [2 /*return*/, rsp.sum || 0];
215
+ case 3:
216
+ e_6 = _a.sent();
217
+ throw e_6;
218
+ case 4: return [2 /*return*/];
219
+ }
220
+ });
221
+ });
222
+ };
223
+ return User;
224
+ }());
225
+ exports.default = User;