@newbeebox/newbeebox-client-web-sdk 1.0.14 → 1.0.18

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/README.md CHANGED
@@ -29,64 +29,96 @@ console.log(info);
29
29
  // 获取当前登录用户信息
30
30
  let user = await client.GetUserInfo();
31
31
  console.log(user);
32
+
33
+ // 获取客户端当前选中的魔兽世界版本
34
+ let version = await client.GetWoWCurrentVersion();
35
+ console.log(version); // { id: 8, name: "燃烧的远征" }
36
+
37
+ // 获取新手盒子客户端版本号
38
+ let clientVersion = client.GetClientVersion();
39
+ console.log(clientVersion); // "0.70.41"
32
40
  ```
33
41
 
34
42
  ### API
35
43
 
44
+ 除 `GetClientVersion` 外均为异步接口,需 `await`。调用任何接口前必须先 `Init`。
45
+
46
+ ---
47
+
36
48
  #### `Init(app_id: string): Promise<void>`
37
49
 
38
50
  初始化SDK,扫描本地端口连接新手盒子客户端。
39
51
 
40
- | 参数 | 类型 | 说明 |
41
- |------|------|------|
42
- | app_id | string | 应用ID,从后台获取 |
52
+ **入参**
43
53
 
44
- #### `ShowSubscriptionPage(): Promise<boolean>`
54
+ | 参数 | 类型 | 必填 | 说明 |
55
+ |------|------|------|------|
56
+ | app_id | string | 是 | 应用ID,从后台获取 |
45
57
 
46
- 打开应用订阅界面。
58
+ **出参**
47
59
 
48
- #### `GetUserSubscription(): Promise<UserSubscribeInfo>`
60
+ 无返回值。未检测到客户端时抛出错误。
49
61
 
50
- 获取当前用户的订阅信息。
62
+ ---
51
63
 
52
- #### `GetUserInfo(): Promise<UserAccountInfo>`
64
+ #### `GetClientVersion(): string`
53
65
 
54
- 获取当前登录用户的基础信息。用户未登录时抛出错误。
66
+ 获取新手盒子客户端的版本号。同步方法,无需 `await`。
55
67
 
56
- #### `InstallWoWAddon(game_version_id, addon_id, secret_key?): Promise<any>`
68
+ **入参**
57
69
 
58
- 安装魔兽世界插件。
70
+ 无。
59
71
 
60
- | 参数 | 类型 | 说明 |
61
- |------|------|------|
62
- | game_version_id | string \| number | 游戏版本ID |
63
- | addon_id | string \| number | 插件ID |
64
- | secret_key | string | 密钥(可选) |
72
+ **出参**
65
73
 
66
- #### `Patch(tool_name, data?): Promise<any>`
74
+ | 类型 | 说明 |
75
+ |------|------|
76
+ | string | 客户端版本号,如 `"0.70.41"`;客户端未提供版本号时为空字符串 |
67
77
 
68
- 通用请求接口,当SDK未导出指定接口时可使用此方法。
78
+ 版本号形如 `主.次.修订`,比较时需按段拆成数字。
69
79
 
70
- | 参数 | 类型 | 说明 |
71
- |------|------|------|
72
- | tool_name | string | 完整API路径,如 `/tool/some_api` |
73
- | data | object | 请求数据(可选) |
80
+ ---
74
81
 
75
- ### 错误处理
82
+ #### `ShowSubscriptionPage(): Promise<boolean>`
76
83
 
77
- 所有接口失败时都会抛出 `Error`,`message` 格式统一为 `<操作>发生错误:<原因>`。
84
+ 打开应用订阅界面。
78
85
 
79
- 如果用户安装的客户端版本过低、没有所调用的接口,`<原因>` 固定为:
86
+ **入参**
80
87
 
81
- ```
82
- 当前客户端不支持该接口,请升级新手盒子客户端
83
- ```
88
+ 无。
84
89
 
85
- 所有接口(含 `Patch`)行为一致,第三方应用可据此提示用户升级客户端。
90
+ **出参**
91
+
92
+ | 类型 | 说明 |
93
+ |------|------|
94
+ | boolean | 打开成功返回 `true`,失败抛出错误 |
86
95
 
87
96
  ---
88
97
 
89
- **订阅信息返回结构**:
98
+ #### `GetUserSubscription(): Promise<UserSubscribeInfo>`
99
+
100
+ 获取当前用户的订阅信息。
101
+
102
+ **入参**
103
+
104
+ 无。
105
+
106
+ **出参**
107
+
108
+ | 字段 | 类型 | 说明 |
109
+ |------|------|------|
110
+ | app_id | string | 应用ID |
111
+ | user.open_id | string | 用户平台ID |
112
+ | user.nickname | string | 用户昵称 |
113
+ | user.avatar | string | 用户头像地址 |
114
+ | subscribe_mode | number | 订阅模式,`1`=作者订阅,`2`=应用订阅 |
115
+ | end_time | number | 订阅到期时间戳,`0` 表示无到期时间 |
116
+ | level | number | 订阅等级 |
117
+ | level_label | string | 订阅等级标签 |
118
+ | is_yearly | boolean | 是否年订阅 |
119
+ | timestamp | number | 时间戳 |
120
+ | nonce | string | 随机数 |
121
+ | sign | string | 签名,用于服务端验证 |
90
122
 
91
123
  ```javascript
92
124
  {
@@ -96,30 +128,140 @@ console.log(user);
96
128
  "nickname": "Kyuu",
97
129
  "avatar": "https://cdn8.newbeebox.com/...."
98
130
  },
99
- "subscribe_mode": 1, // 1=作者订阅, 2=应用订阅
100
- "end_time": 0, // 到期时间戳
101
- "level": 0, // 订阅等级
102
- "level_label": "", // 等级标签
103
- "is_yearly": false, // 是否年订阅
131
+ "subscribe_mode": 1,
132
+ "end_time": 0,
133
+ "level": 0,
134
+ "level_label": "",
135
+ "is_yearly": false,
104
136
  "timestamp": 1758613861250,
105
137
  "nonce": 6363921989,
106
- "sign": "485d82860578ff..." // 签名,用于服务端验证
138
+ "sign": "485d82860578ff..."
107
139
  }
108
140
  ```
109
141
 
142
+ ---
110
143
 
111
- **用户信息返回结构**:
144
+ #### `GetUserInfo(): Promise<UserAccountInfo>`
145
+
146
+ 获取当前登录用户的基础信息。用户未登录时抛出错误。
147
+
148
+ **入参**
149
+
150
+ 无。
151
+
152
+ **出参**
153
+
154
+ | 字段 | 类型 | 说明 |
155
+ |------|------|------|
156
+ | id | number | 用户ID |
157
+ | username | string | 用户名 |
158
+ | avatar | string | 用户头像地址 |
159
+ | isVip | boolean | 是否是 VIP |
160
+ | vip | object \| null | VIP 信息,非 VIP 时为 `null` |
161
+ | vip.isYearly | boolean | 是否年费会员 |
162
+ | vip.adFree | boolean | 是否免广告 |
163
+ | vip.endTime | number \| null | 会员到期时间戳 |
112
164
 
113
165
  ```javascript
114
166
  {
115
- "id": 10001, // 用户ID
116
- "username": "Kyuu", // 用户名
167
+ "id": 10001,
168
+ "username": "Kyuu",
117
169
  "avatar": "https://cdn8.newbeebox.com/....",
118
- "isVip": true, // 是否是 VIP
119
- "vip": { // 非 VIP 时为 null
120
- "isYearly": false, // 是否年费会员
121
- "adFree": true, // 是否免广告
122
- "endTime": 1790000000000 // 会员到期时间戳
170
+ "isVip": true,
171
+ "vip": {
172
+ "isYearly": false,
173
+ "adFree": true,
174
+ "endTime": 1790000000000
123
175
  }
124
176
  }
125
177
  ```
178
+
179
+ ---
180
+
181
+ #### `GetWoWCurrentVersion(): Promise<WoWGameVersion>`
182
+
183
+ 获取客户端当前选中的魔兽世界游戏版本。
184
+
185
+ **入参**
186
+
187
+ 无。
188
+
189
+ **出参**
190
+
191
+ | 字段 | 类型 | 说明 |
192
+ |------|------|------|
193
+ | id | number | 游戏版本ID,可直接作为 `InstallWoWAddon` 的 `game_version_id` |
194
+ | name | string | 游戏版本名称 |
195
+
196
+ ```javascript
197
+ {
198
+ "id": 8,
199
+ "name": "燃烧的远征"
200
+ }
201
+ ```
202
+
203
+ ---
204
+
205
+ #### `InstallWoWAddon(game_version_id, addon_id, secret_key?): Promise<any>`
206
+
207
+ 安装魔兽世界插件。
208
+
209
+ **入参**
210
+
211
+ | 参数 | 类型 | 必填 | 说明 |
212
+ |------|------|------|------|
213
+ | game_version_id | string \| number | 是 | 游戏版本ID,取自 `GetWoWCurrentVersion` 的 `id` |
214
+ | addon_id | string \| number | 是 | 插件ID |
215
+ | secret_key | string | 否 | 密钥 |
216
+
217
+ **出参**
218
+
219
+ | 类型 | 说明 |
220
+ |------|------|
221
+ | any | 客户端返回的安装结果,安装失败时抛出错误 |
222
+
223
+ ---
224
+
225
+ #### `Patch(tool_name, data?): Promise<any>`
226
+
227
+ 通用请求接口,当SDK未导出指定接口时可使用此方法。
228
+
229
+ **入参**
230
+
231
+ | 参数 | 类型 | 必填 | 说明 |
232
+ |------|------|------|------|
233
+ | tool_name | string | 是 | 完整API路径,如 `/tool/some_api` |
234
+ | data | object | 否 | 请求数据,`app_id` 由SDK自动附加 |
235
+
236
+ **出参**
237
+
238
+ | 类型 | 说明 |
239
+ |------|------|
240
+ | any | 客户端响应中的 `data` 字段 |
241
+
242
+ ### 其他导出
243
+
244
+ | 导出 | 类型 | 说明 |
245
+ |------|------|------|
246
+ | `SDK_VERSION` | string | 当前SDK版本号,如 `"1.0.18"` |
247
+ | `SUBSCRIBE_MODE` | enum | 订阅模式枚举,`AUTHOR_SUBSCRIBE = 1`、`APP_SUBSCRIBE = 2` |
248
+
249
+ ```javascript
250
+ import { SDK_VERSION, SUBSCRIBE_MODE } from "@newbeebox/newbeebox-client-web-sdk"
251
+
252
+ if (info.subscribe_mode === SUBSCRIBE_MODE.AUTHOR_SUBSCRIBE) {
253
+ // 作者订阅
254
+ }
255
+ ```
256
+
257
+ ### 错误处理
258
+
259
+ 所有接口失败时都会抛出 `Error`,`message` 格式统一为 `<操作>发生错误:<原因>`。
260
+
261
+ 如果用户安装的客户端版本过低、没有所调用的接口,`<原因>` 固定为:
262
+
263
+ ```
264
+ 当前客户端不支持该接口,请升级新手盒子客户端
265
+ ```
266
+
267
+ 所有接口(含 `Patch`)行为一致,第三方应用可据此提示用户升级客户端。
@@ -0,0 +1,160 @@
1
+ /**
2
+ * NewBeeClient
3
+ * @description 新手盒子客户端 SDK(Web 端)
4
+ * @author NewBeeBoxTeam
5
+ */
6
+ /**
7
+ * 当前 SDK 版本号(发布新版本时请同步 package.json 的 version 字段)
8
+ *
9
+ * 对外导出,便于接入方在页面上展示、或在上报错误/工单时附带 SDK 版本。
10
+ */
11
+ export declare const SDK_VERSION = "1.0.18";
12
+ /**
13
+ * 客户端标准响应结构
14
+ */
15
+ interface ClientResponse<T = any> {
16
+ code: number;
17
+ data: T | null;
18
+ message?: string;
19
+ }
20
+ /**
21
+ * @enum SUBSCRIBE_MODE
22
+ * @description 订阅模式
23
+ */
24
+ export declare enum SUBSCRIBE_MODE {
25
+ /** 作者订阅 */
26
+ AUTHOR_SUBSCRIBE = 1,
27
+ /** 应用订阅 */
28
+ APP_SUBSCRIBE = 2
29
+ }
30
+ /**
31
+ * @interface UserInfo
32
+ * @description 用户信息
33
+ */
34
+ export interface UserInfo {
35
+ /** 用户平台ID */
36
+ open_id: string;
37
+ /** 用户昵称 */
38
+ nickname: string;
39
+ /** 用户头像 */
40
+ avatar: string;
41
+ }
42
+ /**
43
+ * @interface UserVipInfo
44
+ * @description 用户 VIP 信息
45
+ */
46
+ export interface UserVipInfo {
47
+ /** 是否年费会员 */
48
+ isYearly: boolean;
49
+ /** 是否免广告 */
50
+ adFree: boolean;
51
+ /** 会员到期时间戳 */
52
+ endTime: number | null;
53
+ }
54
+ /**
55
+ * @interface UserAccountInfo
56
+ * @description 当前登录用户信息(GetUserInfo 返回)
57
+ */
58
+ export interface UserAccountInfo {
59
+ /** 用户ID */
60
+ id: number | null;
61
+ /** 用户名 */
62
+ username: string;
63
+ /** 用户头像 */
64
+ avatar: string;
65
+ /** 是否是 VIP */
66
+ isVip: boolean;
67
+ /** VIP 信息,非 VIP 时为 null */
68
+ vip: UserVipInfo | null;
69
+ }
70
+ /**
71
+ * @interface WoWGameVersion
72
+ * @description 魔兽世界游戏版本(GetWoWCurrentVersion 返回)
73
+ */
74
+ export interface WoWGameVersion {
75
+ /** 游戏版本ID,可直接作为 InstallWoWAddon 的 game_version_id */
76
+ id: number;
77
+ /** 游戏版本名称,如 "燃烧的远征" */
78
+ name: string;
79
+ }
80
+ /**
81
+ * @interface UserSubscribeInfo
82
+ * @description 用户订阅信息
83
+ */
84
+ export interface UserSubscribeInfo {
85
+ /** 应用ID */
86
+ app_id: string;
87
+ /** 用户信息 */
88
+ user: UserInfo;
89
+ /** 订阅模式:1=作者订阅, 2=应用订阅 */
90
+ subscribe_mode: SUBSCRIBE_MODE;
91
+ /** 订阅到期时间 */
92
+ end_time: number;
93
+ /** 订阅等级 */
94
+ level: number;
95
+ /** 订阅等级标签 */
96
+ level_label: string;
97
+ /** 是否是年订阅 */
98
+ is_yearly: boolean;
99
+ /** 时间戳 */
100
+ timestamp: number;
101
+ /** 随机数 */
102
+ nonce: string;
103
+ /** 签名,用于服务端验证 */
104
+ sign?: string;
105
+ }
106
+ /**
107
+ * 新手盒子客户端 SDK(Web 端)
108
+ */
109
+ export declare class NewBeeClient {
110
+ app_id: string;
111
+ newbee_client_port: number;
112
+ /** 已连接客户端的版本号,如 "0.70.25";未初始化或客户端未提供时为空字符串 */
113
+ newbee_client_version: string;
114
+ constructor();
115
+ _ensureInitialized(): void;
116
+ _post(path: string, data?: Record<string, any> | null, timeout?: number): Promise<ClientResponse | null>;
117
+ /**
118
+ * 初始化 SDK,扫描本地端口连接新手盒子客户端
119
+ * @param app_id 应用ID,从后台获取
120
+ */
121
+ Init(app_id: string): Promise<void>;
122
+ /**
123
+ * 获取新手盒子客户端的版本号,如 "0.70.25"
124
+ *
125
+ * 同步方法,无需 await。客户端版本过低、未提供版本号时返回空字符串。
126
+ *
127
+ * @throws SDK 未初始化或未检测到客户端
128
+ */
129
+ GetClientVersion(): string;
130
+ /**
131
+ * 打开应用订阅界面
132
+ */
133
+ ShowSubscriptionPage(): Promise<boolean>;
134
+ /**
135
+ * 获取当前使用的用户的订阅信息
136
+ */
137
+ GetUserSubscription(): Promise<UserSubscribeInfo>;
138
+ /**
139
+ * 获取当前登录用户的基础信息(未登录时抛错)
140
+ */
141
+ GetUserInfo(): Promise<UserAccountInfo>;
142
+ /**
143
+ * 获取客户端当前选中的魔兽世界游戏版本
144
+ */
145
+ GetWoWCurrentVersion(): Promise<WoWGameVersion>;
146
+ /**
147
+ * 安装魔兽世界插件
148
+ * @param game_version_id 游戏版本ID
149
+ * @param addon_id 插件ID
150
+ * @param secret_key 密钥(可选)
151
+ */
152
+ InstallWoWAddon(game_version_id: string | number, addon_id: string | number, secret_key?: string): Promise<any>;
153
+ /**
154
+ * 通用请求接口,当 SDK 未导出指定接口时可使用此方法补充请求
155
+ * @param tool_name 完整API路径,如 /tool/some_api
156
+ * @param data 请求数据(可选)
157
+ */
158
+ Patch(tool_name: string, data?: Record<string, any>): Promise<any>;
159
+ }
160
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ const _0x56177b=_0x5bac;(function(_0x3c5a02,_0x1465a9){const _0x4aedd4=_0x5bac,_0x1bc7af=_0x3c5a02();while(!![]){try{const _0x4d1cd8=parseInt(_0x4aedd4(0x12f))/(-0x148*-0x4+0xf43*0x1+-0x1*0x1462)*(-parseInt(_0x4aedd4(0x17f))/(0x153e+0x162+-0x6*0x3c5))+-parseInt(_0x4aedd4(0xef))/(-0x707*0x1+0x17c3+-0x10b9)+parseInt(_0x4aedd4(0x17e))/(-0xab5*0x3+0x579*0x6+0xb3*-0x1)+parseInt(_0x4aedd4(0x189))/(-0x18a7+-0x50*0x9+0x1b7c)+parseInt(_0x4aedd4(0x100))/(0x1257+0xc08+-0x1e59)*(-parseInt(_0x4aedd4(0x154))/(0x86*-0x13+0x7b2*0x1+0x247*0x1))+-parseInt(_0x4aedd4(0x169))/(-0xfc3+0x782*0x1+0x849)*(parseInt(_0x4aedd4(0x132))/(0xe2e+-0x2705+-0x20*-0xc7))+parseInt(_0x4aedd4(0xfd))/(0x1*-0x15d+0x1614+-0x14ad*0x1);if(_0x4d1cd8===_0x1465a9)break;else _0x1bc7af['push'](_0x1bc7af['shift']());}catch(_0x2fd9c3){_0x1bc7af['push'](_0x1bc7af['shift']());}}}(_0x49ef,0x36d0a+-0x20f1d+0x60a7));var g=_0x56177b(0x138),b=[0x347*-0x2e+-0x1a47*0x5+-0xb*-0x2647,-0x3*0x2455+0x5f81*-0x1+0x15769,0xa2b2+-0x659b+0x4dd3*0x1,0x2*-0x597b+0xb4be+0x8923,-0xd03d*0x1+0x2*-0x4089+0x1dc3b,-0x9*-0x13d9+0x10037*-0x1+0x509*0x2b,-0xa1*0xd+0xa8f8+-0x15dd,0x1*0x4d1b+0x4feb+-0x1217,0x45*0x59+-0x494e+0x1*0xbc41,0xf17b+0x2*-0x6fce+-0x7912*-0x1,-0xe3e8+-0x6d7d+0x1dc57,-0xd7ec+0xd8fb+0x89e4,-0x1*0xb297+-0x2344+0x160cf,-0x8*0x1edd+-0x3fd0+0x1c1ad*0x1,-0x6c*-0x283+0x96*-0x17c+0x5a5a,-0xdb90+-0x3c1f*0x2+0x1dec5,0xc337+-0x2d*0xef+-0xe3c,0xbf64+-0x788f*0x1+0x4424,0xab40+-0x323f*0x1+0x11f9,-0x2b43+0xcdd6*0x1+-0x28*0x97],f=[-0x5*0x16f+-0xff7+-0x1c2*-0x10,0xe8+-0x598*-0x3+0x147*0x7,-0x680*0xd+0x31dd+0x4f63*0x1,0x9*-0xa79+0x516b+0x4721*0x1,0xf7*0x11+-0x2243+0x5d88,0xae0a+0x93f+0x7*-0xce5,-0x79d8+-0xcd*-0x5f+0x9db0,-0x172*-0x3d+0x1*-0x1ab6+0x448b,0x5*-0x2f81+0x9ba7+-0x86b*-0x1d,-0x8*-0xfd6+-0xcf56+0x10783],h=[...b,...f],m='http://1'+'27.0.0.1',a='nbb_clie'+_0x56177b(0x134),c=null;function p(){const _0x262d47=_0x56177b,_0x2af25c={'eDGPt':_0x262d47(0x180),'gVDZy':function(_0x76353,_0x31064a){return _0x76353<_0x31064a;},'iGMKG':function(_0x1996df,_0x3ef423){return _0x1996df!==_0x3ef423;},'cZasB':_0x262d47(0xf6),'RaXOi':_0x262d47(0x137),'SIoHN':function(_0x505758,_0x3b2e2f){return _0x505758(_0x3b2e2f);}};try{if(_0x2af25c[_0x262d47(0x195)](_0x262d47(0x1b3),_0x262d47(0x1b3)))return _0x3c18d4[_0x262d47(0x1a7)](_0x4cf7bc,_0x2af25c[_0x262d47(0x131)],_0x50d10c),null;else{if(_0x2af25c['gVDZy'](typeof localStorage,'u')&&localStorage){if(_0x2af25c[_0x262d47(0x195)](_0x2af25c[_0x262d47(0x10c)],_0x2af25c[_0x262d47(0x1af)])){let _0x11b30d=localStorage[_0x262d47(0x122)](a);if(_0x11b30d)return _0x2af25c[_0x262d47(0x11d)](Number,_0x11b30d)||null;}else _0x2af25c[_0x262d47(0x18c)](typeof _0x244088,'u')&&_0x2d479a&&_0x29ed3d[_0x262d47(0x168)+'em'](_0x2c9128);}}}catch{}return c;}function w(_0x5dd7f7){const _0x4d3ce4=_0x56177b,_0x5f480d={'tJTqp':function(_0x31d0b5,_0x4855dc){return _0x31d0b5===_0x4855dc;},'VFgjZ':function(_0x2b6a77,_0x12ebe4){return _0x2b6a77(_0x12ebe4);},'VwqNo':_0x4d3ce4(0x1a0)+_0x4d3ce4(0x1b7),'YWzQr':_0x4d3ce4(0xf2),'yhoHQ':_0x4d3ce4(0x14f),'amThb':function(_0x3c1a41,_0x467804){return _0x3c1a41<_0x467804;}};c=_0x5dd7f7;try{if(_0x5f480d['tJTqp'](_0x5f480d[_0x4d3ce4(0x196)],_0x5f480d['yhoHQ'])){const _0x5085f3={'YBCKL':function(_0x241bde,_0xb5b8fd){return _0x241bde(_0xb5b8fd);}};_0x13a95b(_0x5ce201)[_0x4d3ce4(0x13d)](_0x38f9b8=>{const _0x467049=_0x4d3ce4;_0x50c134||(_0x3ddd49=!(-0x18a*0x10+-0x3*0xb0+0x1ab0),_0x5085f3[_0x467049(0x18a)](_0x35930d,_0x38f9b8));})['catch'](()=>{const _0x17595b=_0x4d3ce4;_0x3a14ce--,_0x5f480d[_0x17595b(0x17c)](_0x4a9427,-0xc2*-0x15+0x4*-0x347+-0x167*0x2)&&!_0x26ad85&&_0x5f480d[_0x17595b(0x15c)](_0x4a574c,new _0x4f9b4e(_0x5f480d[_0x17595b(0x184)]));});}else _0x5f480d['amThb'](typeof localStorage,'u')&&localStorage&&localStorage['setItem'](a,String(_0x5dd7f7));}catch{}}function u(){const _0x237477=_0x56177b,_0x51ce40={'iVPua':function(_0x1d238e,_0x5137de){return _0x1d238e<_0x5137de;}};c=null;try{_0x51ce40['iVPua'](typeof localStorage,'u')&&localStorage&&localStorage[_0x237477(0x168)+'em'](a);}catch{}}function d(_0x2557e9){const _0x3e0314=_0x56177b,_0x4627ba={'LTtUx':function(_0x41e5e1,_0x28bd3c,_0x507690){return _0x41e5e1(_0x28bd3c,_0x507690);},'Ktbqo':function(_0x33b860,_0x3dc261){return _0x33b860+_0x3dc261;},'kKELM':function(_0x40d1e2,_0x385983){return _0x40d1e2+_0x385983;},'YIDZF':_0x3e0314(0x117),'CAhOm':_0x3e0314(0x14b),'AmHPZ':function(_0x310e76,_0x4f24e3){return _0x310e76!==_0x4f24e3;},'cbeDN':_0x3e0314(0x164),'SPKVu':_0x3e0314(0x19e),'CwSwK':function(_0xfe39f4,_0x5d3713){return _0xfe39f4(_0x5d3713);},'veUZr':function(_0x51f27b,_0x416be7){return _0x51f27b===_0x416be7;},'fwELz':function(_0x403175,_0xe878a0){return _0x403175==_0xe878a0;},'BGkfZ':_0x3e0314(0x1a2),'RIHUZ':_0x3e0314(0xf4)+_0x3e0314(0x16f)+'t','jcBIy':function(_0x2c0c9b,_0x55818a){return _0x2c0c9b(_0x55818a);},'iWGLs':function(_0x442c59,_0x26362a){return _0x442c59(_0x26362a);},'gHwik':function(_0x2be126,_0x4aca60){return _0x2be126(_0x4aca60);},'nwtie':function(_0x1b5a0d,_0x3ef8b9){return _0x1b5a0d==_0x3ef8b9;},'ZsKXB':function(_0x8d1f8a,_0x1be106){return _0x8d1f8a(_0x1be106);},'izDRV':_0x3e0314(0xf1),'fuMSM':function(_0xd8b879,_0x24fd9c,_0x713fd){return _0xd8b879(_0x24fd9c,_0x713fd);},'rUObY':function(_0x336582,_0x939563,_0xd993ad){return _0x336582(_0x939563,_0xd993ad);}};return new Promise((_0x33b650,_0x3b322d)=>{const _0x5b3d0f=_0x3e0314,_0x4f7fc0={'BezKq':function(_0x1aeed6,_0x1ef6c5){return _0x1aeed6(_0x1ef6c5);},'ftiNM':function(_0xffb5d0,_0x203a2f){const _0x1de70f=_0x5bac;return _0x4627ba[_0x1de70f(0x18e)](_0xffb5d0,_0x203a2f);},'HlZRp':function(_0x41711b,_0x31ebc9){const _0xe187d=_0x5bac;return _0x4627ba[_0xe187d(0x17b)](_0x41711b,_0x31ebc9);},'VMdZM':function(_0xf8fbd1,_0x2ab8a8){return _0x4627ba['fwELz'](_0xf8fbd1,_0x2ab8a8);},'jAMes':_0x4627ba['BGkfZ'],'mHfYD':_0x4627ba['RIHUZ'],'pvnwt':function(_0x17c02f,_0x53a628){const _0x18f846=_0x5bac;return _0x4627ba[_0x18f846(0x1b1)](_0x17c02f,_0x53a628);},'agLHu':function(_0x3d5732,_0x19852){const _0x40c060=_0x5bac;return _0x4627ba[_0x40c060(0x158)](_0x3d5732,_0x19852);},'UHCbl':function(_0x2717cf,_0x17e89b){const _0x2f34e7=_0x5bac;return _0x4627ba[_0x2f34e7(0x15e)](_0x2717cf,_0x17e89b);},'jLFqK':function(_0x44bcae,_0x4df856){return _0x4627ba['nwtie'](_0x44bcae,_0x4df856);},'jSuFl':function(_0x193dbb,_0x3e22be){const _0x1a1767=_0x5bac;return _0x4627ba[_0x1a1767(0x12e)](_0x193dbb,_0x3e22be);},'EVtIr':function(_0x2311c3){return _0x2311c3();}};if('YWHRk'!==_0x4627ba[_0x5b3d0f(0x157)]){let _0x4db532=new _0x4ea301(),_0x3cc54a=_0x4627ba[_0x5b3d0f(0x1a1)](_0x20d5a0,()=>_0x4db532[_0x5b3d0f(0x1a6)](),-0x47*-0x1d+-0x25cb+0x1e88);_0x3a5ad5(_0x4627ba[_0x5b3d0f(0x13f)](_0x4627ba['Ktbqo'](_0x4627ba[_0x5b3d0f(0x127)](_0x1ef29d,':'),_0x445c60),_0x4627ba[_0x5b3d0f(0xfa)]),{'method':_0x4627ba['CAhOm'],'signal':_0x4db532[_0x5b3d0f(0x139)]})[_0x5b3d0f(0x13d)](_0x2ef2a1=>_0x2ef2a1['json']())[_0x5b3d0f(0x13d)](_0x46b7f7=>{const _0x39cac3=_0x5b3d0f;if(_0x4f7fc0[_0x39cac3(0x114)](_0x38212e,_0x3cc54a),_0x46b7f7&&_0x4f7fc0[_0x39cac3(0x102)](_0x46b7f7[_0x39cac3(0x11f)],-0x1d*-0x119+-0x124f*0x1+0x1*-0xd85)){let _0x15f936=_0x46b7f7['data']&&_0x46b7f7[_0x39cac3(0x124)][_0x39cac3(0x101)];_0x4f7fc0[_0x39cac3(0x12d)](_0x4b1dac,{'port':_0x4a3895,'version':_0x4f7fc0[_0x39cac3(0x1b0)](typeof _0x15f936,_0x4f7fc0[_0x39cac3(0x106)])?_0x15f936:''});}else _0x4f7fc0[_0x39cac3(0x12d)](_0x9cb5e1,new _0x1ea977(_0x4f7fc0[_0x39cac3(0x160)]));})[_0x5b3d0f(0x109)](_0x58094b=>{const _0x480cc3=_0x5b3d0f;_0x4f7fc0[_0x480cc3(0x194)](_0x45edfd,_0x3cc54a),_0x461420(_0x58094b);});}else{let _0xbd9d78=new AbortController(),_0x4accb0=_0x4627ba[_0x5b3d0f(0x173)](setTimeout,()=>_0xbd9d78['abort'](),-0x13c0+0x1105+0x383);_0x4627ba[_0x5b3d0f(0x174)](fetch,_0x4627ba['kKELM'](_0x4627ba[_0x5b3d0f(0x13f)](m,':'),_0x2557e9)+_0x5b3d0f(0x117),{'method':_0x5b3d0f(0x14b),'signal':_0xbd9d78[_0x5b3d0f(0x139)]})['then'](_0x27979d=>_0x27979d['json']())[_0x5b3d0f(0x13d)](_0x14945e=>{const _0x37247b=_0x5b3d0f;if(_0x4f7fc0[_0x37247b(0x197)](clearTimeout,_0x4accb0),_0x14945e&&_0x14945e['code']===-0x2413+-0x1*0x359+-0x1*-0x276d){let _0x23488e=_0x14945e[_0x37247b(0x124)]&&_0x14945e[_0x37247b(0x124)][_0x37247b(0x101)];_0x4f7fc0[_0x37247b(0x119)](_0x33b650,{'port':_0x2557e9,'version':_0x4f7fc0[_0x37247b(0x149)](typeof _0x23488e,_0x37247b(0x1a2))?_0x23488e:''});}else _0x4f7fc0[_0x37247b(0x18b)](_0x3b322d,new Error(_0x37247b(0xf4)+_0x37247b(0x16f)+'t'));})[_0x5b3d0f(0x109)](_0x1d6b88=>{const _0x4935e0=_0x5b3d0f;_0x4627ba[_0x4935e0(0x1b9)](_0x4627ba[_0x4935e0(0x153)],_0x4627ba[_0x4935e0(0x13b)])?(_0x4627ba[_0x4935e0(0x17b)](clearTimeout,_0x4accb0),_0x3b322d(_0x1d6b88)):_0x4f7fc0[_0x4935e0(0xeb)](_0x107265);});}});}function T(_0x162071){const _0x56c67a=_0x56177b,_0x390946={'ULSef':function(_0x1f23ab,_0xefdac6){return _0x1f23ab(_0xefdac6);},'dNVRc':function(_0x225ab3,_0x57d409){return _0x225ab3===_0x57d409;},'OfPhm':_0x56c67a(0x142),'Jwrsc':_0x56c67a(0x1b8),'WGenW':_0x56c67a(0x19a),'wfcGb':'LjPIQ','YhPpv':function(_0x104ae9,_0x22cba8){return _0x104ae9(_0x22cba8);},'XwIMa':_0x56c67a(0x1a4)+_0x56c67a(0x12b)+'ts'};return new Promise((_0x32205d,_0x3b128a)=>{const _0x5c2dd1=_0x56c67a,_0x1fc5de={'fhWhh':function(_0x972dfa,_0x4f2373){const _0x544a61=_0x5bac;return _0x390946[_0x544a61(0x161)](_0x972dfa,_0x4f2373);}};if(_0x390946[_0x5c2dd1(0xf3)](_0x390946[_0x5c2dd1(0x11e)],_0x390946['wfcGb']))_0x4aeec2||(_0x28c760=!(0x901*-0x1+-0x1*0x26a+0xb6b),_0x1fc5de[_0x5c2dd1(0x167)](_0xd210ca,_0xaed5c));else{let _0x1c07a8=_0x162071[_0x5c2dd1(0x111)];if(_0x390946[_0x5c2dd1(0xf3)](_0x1c07a8,0x1980+0x22e0+-0xe*0x450)){_0x390946[_0x5c2dd1(0x185)](_0x3b128a,new Error(_0x390946[_0x5c2dd1(0x191)]));return;}let _0x2c9b6e=!(0x1ac6+0x23d1*0x1+0x2*-0x1f4b);_0x162071[_0x5c2dd1(0x146)](_0x2fb641=>{const _0x4e3e96=_0x5c2dd1,_0x4978b1={'yZDMG':function(_0x20ed2a,_0x24f508){const _0x3ed303=_0x5bac;return _0x390946[_0x3ed303(0x161)](_0x20ed2a,_0x24f508);}};if(_0x390946[_0x4e3e96(0xf3)](_0x390946[_0x4e3e96(0x145)],_0x390946[_0x4e3e96(0x141)])){let _0x34e0d1=_0x57be0f[_0x4e3e96(0x122)](_0x5715df);if(_0x34e0d1)return _0x5d9fc0(_0x34e0d1)||null;}else _0x390946[_0x4e3e96(0x161)](d,_0x2fb641)[_0x4e3e96(0x13d)](_0x25d728=>{const _0x17beef=_0x4e3e96;_0x2c9b6e||(_0x2c9b6e=!(-0x1b0e+0x24aa+0xa*-0xf6),_0x4978b1[_0x17beef(0x121)](_0x32205d,_0x25d728));})['catch'](()=>{const _0x122d8e=_0x4e3e96;_0x1c07a8--,_0x1c07a8===-0x3*0x2a1+-0xec6*-0x1+-0x6e3&&!_0x2c9b6e&&_0x3b128a(new Error(_0x122d8e(0x1a0)+'s\x20failed'));});});}});}var P=-(-0x48e+0xa7b+-0x459),E='当前客户端不支持'+_0x56177b(0x150)+_0x56177b(0x11c),y=(_0x4da802=>(_0x4da802[_0x4da802[_0x56177b(0xec)+'UBSCRIBE']=-0x1e9c+-0x106e+0x2f0b]=_0x56177b(0xec)+'UBSCRIBE',_0x4da802[_0x4da802[_0x56177b(0x125)+_0x56177b(0x198)]=0x5c2+-0x1a5b+-0x19*-0xd3]='APP_SUBS'+_0x56177b(0x198),_0x4da802))(y||{}),_=class{constructor(){const _0x1cc434=_0x56177b;this['app_id']='',this[_0x1cc434(0x183)+'lient_po'+'rt']=0x206d+-0x28+-0x2045,this['newbee_c'+_0x1cc434(0x16e)+'rsion']='';}[_0x56177b(0x181)+_0x56177b(0xfc)+'ed'](){const _0x95c9bb=_0x56177b;if(!this[_0x95c9bb(0x183)+_0x95c9bb(0x129)+'rt'])throw new Error(_0x95c9bb(0x19c)+_0x95c9bb(0x15a)+_0x95c9bb(0x16a));}async[_0x56177b(0x159)](_0xc6a1b4,_0x5815e8,_0x28812e){const _0x5daf6f=_0x56177b,_0xa4ad2a={'qjoRG':function(_0x330b4d,_0x50b1a6){return _0x330b4d(_0x50b1a6);},'gxiqW':function(_0x2c5197,_0x31a6e5){return _0x2c5197===_0x31a6e5;},'SPcvU':function(_0x355499,_0x14882d){return _0x355499(_0x14882d);},'hQZxy':function(_0x584de5,_0x84d140){return _0x584de5==_0x84d140;},'BziEt':_0x5daf6f(0x1a2),'fbtoI':_0x5daf6f(0xf4)+_0x5daf6f(0x16f)+'t','MnLPx':function(_0x34c71c,_0x44f695,_0x40deb5){return _0x34c71c(_0x44f695,_0x40deb5);},'UzyFc':function(_0x2c4ee2,_0x402ccc){return _0x2c4ee2!==_0x402ccc;},'LAEhR':'lsTgQ','NeDKY':function(_0x55e83f,_0x2cc19d){return _0x55e83f+_0x2cc19d;},'MpBBj':'POST','TIXAs':function(_0x2af489,_0x11a7f7){return _0x2af489===_0x11a7f7;},'NtbVy':_0x5daf6f(0xfe),'bAIpf':_0x5daf6f(0x112),'OgkqD':_0x5daf6f(0x162),'WDXEZ':function(_0x34d849,_0x242ed3){return _0x34d849(_0x242ed3);}};this[_0x5daf6f(0x181)+_0x5daf6f(0xfc)+'ed']();let _0x305788=new AbortController(),_0x2f5009=_0x28812e?_0xa4ad2a[_0x5daf6f(0x148)](setTimeout,()=>_0x305788[_0x5daf6f(0x1a6)](_0x5daf6f(0x108)),_0x28812e):null;try{if(_0xa4ad2a['UzyFc'](_0x5daf6f(0x1ad),_0xa4ad2a['LAEhR'])){if(lnNGhP[_0x5daf6f(0x15f)](_0xa52b47,_0x4502a2),_0x357ef6&&lnNGhP[_0x5daf6f(0x136)](_0x56c025['code'],0x1ed5+-0x4eb*0x5+-0x63d)){let _0x46a968=_0x4b7cf6[_0x5daf6f(0x124)]&&_0x147660[_0x5daf6f(0x124)][_0x5daf6f(0x101)];lnNGhP[_0x5daf6f(0x143)](_0x50e7c4,{'port':_0x4458d0,'version':lnNGhP[_0x5daf6f(0x12a)](typeof _0x46a968,lnNGhP[_0x5daf6f(0xff)])?_0x46a968:''});}else lnNGhP[_0x5daf6f(0x143)](_0x1a34da,new _0x3b1c28(lnNGhP[_0x5daf6f(0x193)]));}else{let _0x2733c8=await fetch(_0xa4ad2a[_0x5daf6f(0x10d)](_0xa4ad2a['NeDKY'](m+':',this['newbee_c'+'lient_po'+'rt']),_0xc6a1b4),{'method':_0xa4ad2a[_0x5daf6f(0x151)],'signal':_0x305788[_0x5daf6f(0x139)],'headers':{'Content-Type':_0x5daf6f(0x123)+_0x5daf6f(0x11a)},'body':JSON[_0x5daf6f(0x171)+'y']({'app_id':this[_0x5daf6f(0x170)],..._0x5815e8})});if(_0xa4ad2a[_0x5daf6f(0x1ba)](_0x2733c8[_0x5daf6f(0x120)],-0xaf5+0x22f1*0x1+-0x1668))return console[_0x5daf6f(0x1a7)](_0x5daf6f(0x133)+'口:',_0xc6a1b4),{'code':P,'data':null,'message':E};let _0xed375f=await _0x2733c8['json']();return console[_0x5daf6f(0x1a7)](_0xc6a1b4,_0xa4ad2a['NtbVy'],_0xed375f),_0xed375f;}}catch(_0x5ac9eb){return console[_0x5daf6f(0x1a7)](_0xc6a1b4,_0x5daf6f(0x180),_0x5ac9eb),null;}finally{_0xa4ad2a[_0x5daf6f(0xee)]!==_0xa4ad2a['OgkqD']?_0x2f5009&&_0xa4ad2a[_0x5daf6f(0x135)](clearTimeout,_0x2f5009):(_0x3ffa38--,lnNGhP[_0x5daf6f(0x136)](_0x3c5b50,0x23a1+0x21bf+0x22b0*-0x2)&&!_0x2f60ec&&lnNGhP[_0x5daf6f(0x15f)](_0x374c85,new _0x5da4a1('all\x20port'+_0x5daf6f(0x1b7))));}}async['Init'](_0x4fc69a){const _0x18b49a=_0x56177b,_0x44daf3={'UStva':_0x18b49a(0x19c)+'者未检测到新手盒'+_0x18b49a(0x16a),'AaaON':function(_0x5f16cb,_0x429cd2){return _0x5f16cb!=_0x429cd2;},'oERHj':_0x18b49a(0x1a2),'KknzP':_0x18b49a(0x115)+_0x18b49a(0x166)+'获取','MrWwT':function(_0x2f19b){return _0x2f19b();},'lblcq':function(_0x21099b,_0x3887c8){return _0x21099b===_0x3887c8;},'SHZng':_0x18b49a(0x147),'bHiBQ':'客户端开启的端口'+_0x18b49a(0x12c),'YHpqG':_0x18b49a(0x110),'TnGGG':'\u672A\u4E0A\u62A5','XFwDE':_0x18b49a(0x163),'aRcJR':function(_0xa62d00,_0x1316a5){return _0xa62d00(_0x1316a5);},'LHcMY':function(_0x11adc2,_0x4c2a49){return _0x11adc2(_0x4c2a49);},'rDmyD':_0x18b49a(0x1b2)+'号:'};if(console[_0x18b49a(0x1a7)](_0x18b49a(0x192)+_0x18b49a(0x13c)+_0x18b49a(0x18d)+g),!_0x4fc69a||_0x44daf3[_0x18b49a(0xf0)](typeof _0x4fc69a,_0x44daf3[_0x18b49a(0x113)]))throw new Error(_0x44daf3[_0x18b49a(0x1aa)]);this[_0x18b49a(0x170)]=_0x4fc69a;let _0x4a746c=_0x44daf3['MrWwT'](p);if(_0x4a746c)try{if(_0x44daf3['lblcq'](_0x44daf3[_0x18b49a(0x14a)],_0x44daf3['SHZng'])){let _0x7d1b17=await d(_0x4a746c);this[_0x18b49a(0x183)+_0x18b49a(0x129)+'rt']=_0x7d1b17['port'],this[_0x18b49a(0x183)+_0x18b49a(0x16e)+_0x18b49a(0x190)]=_0x7d1b17[_0x18b49a(0x101)],console['log'](_0x44daf3[_0x18b49a(0x187)],this['newbee_c'+'lient_po'+'rt'],_0x44daf3[_0x18b49a(0x14c)],this[_0x18b49a(0x183)+_0x18b49a(0x16e)+_0x18b49a(0x190)]||_0x44daf3[_0x18b49a(0x14d)]);return;}else this[_0x18b49a(0x170)]='',this[_0x18b49a(0x183)+_0x18b49a(0x129)+'rt']=-0x246e+0x1*0xf09+0x1565,this[_0x18b49a(0x183)+_0x18b49a(0x16e)+'rsion']='';}catch{_0x44daf3[_0x18b49a(0x13e)](u);}try{if(_0x44daf3['lblcq'](_0x44daf3[_0x18b49a(0xfb)],_0x44daf3[_0x18b49a(0xfb)])){let _0x163889=await _0x44daf3[_0x18b49a(0x1a5)](T,h);this[_0x18b49a(0x183)+_0x18b49a(0x129)+'rt']=_0x163889['port'],this[_0x18b49a(0x183)+'lient_ve'+_0x18b49a(0x190)]=_0x163889['version'],_0x44daf3[_0x18b49a(0xed)](w,this[_0x18b49a(0x183)+'lient_po'+'rt']);}else{if(!this[_0x18b49a(0x183)+_0x18b49a(0x129)+'rt'])throw new _0x56b157(LDhLqD[_0x18b49a(0x15d)]);}}catch{throw _0x44daf3[_0x18b49a(0x13e)](u),new Error(_0x18b49a(0xf8)+'客户端\x20初始化失'+'败');}console[_0x18b49a(0x1a7)](_0x44daf3[_0x18b49a(0x105)],this['newbee_c'+'lient_po'+'rt'],_0x44daf3[_0x18b49a(0x14c)],this[_0x18b49a(0x183)+_0x18b49a(0x16e)+_0x18b49a(0x190)]||_0x44daf3['TnGGG']);}[_0x56177b(0x128)+_0x56177b(0x1b6)](){const _0x451e83=_0x56177b;return this[_0x451e83(0x181)+'nitializ'+'ed'](),this['newbee_c'+_0x451e83(0x16e)+_0x451e83(0x190)];}async[_0x56177b(0x144)+_0x56177b(0x1a3)+_0x56177b(0x152)](){const _0x99af3e=_0x56177b,_0x52dc60={'nnARD':_0x99af3e(0x156)+_0x99af3e(0x1ae)+_0x99af3e(0x182)+_0x99af3e(0x10e),'fZzdZ':function(_0x4ff990,_0xcf6173){return _0x4ff990!==_0xcf6173;},'TSzPb':function(_0x343496,_0x2d8618){return _0x343496+_0x2d8618;},'WvvrV':_0x99af3e(0x16d)+_0x99af3e(0x14e),'gVHcR':_0x99af3e(0x104)};let _0x2f66b7=await this[_0x99af3e(0x159)](_0x52dc60[_0x99af3e(0x165)],null,-0x185f+-0x13e4+0x302b*0x1);if(!_0x2f66b7||_0x52dc60[_0x99af3e(0xea)](_0x2f66b7[_0x99af3e(0x11f)],0x67e+-0x23a4+0x1d27))throw new Error(_0x52dc60['TSzPb'](_0x52dc60[_0x99af3e(0x176)],_0x2f66b7?.['message']||_0x52dc60[_0x99af3e(0x177)]));return!(0xd05+-0x11c1*-0x1+0xd*-0x25e);}async[_0x56177b(0x175)+'ubscript'+_0x56177b(0x155)](){const _0x157093=_0x56177b,_0x4d1646={'SSwYn':_0x157093(0x16c)+_0x157093(0x19f)+_0x157093(0x10a)+'s','sbcBe':function(_0x425296,_0x39b7d9){return _0x425296!==_0x39b7d9;},'ijrmV':function(_0x319855,_0x43d720){return _0x319855+_0x43d720;},'sPeCz':_0x157093(0x107)+_0x157093(0x16b),'viqrO':_0x157093(0x104)};let _0x357858=await this['_post'](_0x4d1646[_0x157093(0x10b)]);if(!_0x357858||_0x4d1646[_0x157093(0x1ac)](_0x357858[_0x157093(0x11f)],0x1*-0x7f6+-0x177f+0x1f76)||!_0x357858[_0x157093(0x124)])throw new Error(_0x4d1646[_0x157093(0x186)](_0x4d1646[_0x157093(0x17a)],_0x357858?.['message']||_0x4d1646[_0x157093(0x103)]));return _0x357858[_0x157093(0x124)];}async[_0x56177b(0x15b)+_0x56177b(0x179)](){const _0x22aa27=_0x56177b,_0x9b01e9={'zPiVv':function(_0x2625cd,_0x42ecf6){return _0x2625cd!==_0x42ecf6;},'FaJUm':'获取用户信息发生'+'错误:','IHdCp':_0x22aa27(0x104)};let _0x1c5af8=await this[_0x22aa27(0x159)](_0x22aa27(0x13a)+'fo');if(!_0x1c5af8||_0x9b01e9[_0x22aa27(0x188)](_0x1c5af8[_0x22aa27(0x11f)],0x1c9*-0xe+0x24b9+-0xbba)||!_0x1c5af8[_0x22aa27(0x124)])throw new Error(_0x9b01e9['FaJUm']+(_0x1c5af8?.[_0x22aa27(0x1a9)]||_0x9b01e9[_0x22aa27(0x18f)]));return _0x1c5af8['data'];}async[_0x56177b(0x1a8)+_0x56177b(0x140)+_0x56177b(0x11b)](){const _0x46f2d8=_0x56177b,_0x331b99={'NlDAe':function(_0x1dffbb,_0x3e435a){return _0x1dffbb!==_0x3e435a;},'YddGR':function(_0x1fade0,_0x5f2cf4){return _0x1fade0+_0x5f2cf4;},'qbWno':_0x46f2d8(0x1b5)+'版本发生错误:','XvFvg':_0x46f2d8(0x104)};let _0x18f7f1=await this[_0x46f2d8(0x159)]('/tool/wo'+'w_curren'+_0x46f2d8(0x126)+'n');if(!_0x18f7f1||_0x331b99['NlDAe'](_0x18f7f1[_0x46f2d8(0x11f)],-0x1*0x801+0xb01+-0x1*0x2ff)||!_0x18f7f1[_0x46f2d8(0x124)])throw new Error(_0x331b99['YddGR'](_0x331b99[_0x46f2d8(0x118)],_0x18f7f1?.[_0x46f2d8(0x1a9)]||_0x331b99[_0x46f2d8(0x19b)]));return _0x18f7f1[_0x46f2d8(0x124)];}async[_0x56177b(0x178)+_0x56177b(0x17d)](_0x4435a4,_0x3e75c6,_0x177233){const _0x6de586=_0x56177b,_0x3e381f={'WzLpS':_0x6de586(0x1ab)+_0x6de586(0x19d)+_0x6de586(0x1b4),'PirlX':function(_0x15726c,_0x5e21e2){return _0x15726c+_0x5e21e2;},'sZibW':_0x6de586(0x104)};let _0x2946d9={'game_version_id':_0x4435a4,'addon_id':_0x3e75c6};_0x177233&&(_0x2946d9[_0x6de586(0xf5)+'ey']=_0x177233);let _0x2dd685=await this[_0x6de586(0x159)](_0x3e381f[_0x6de586(0x172)],_0x2946d9);if(!_0x2dd685||_0x2dd685[_0x6de586(0x11f)]!==-0x3*0x137+-0x197c+0x1d22)throw new Error(_0x3e381f[_0x6de586(0x130)](_0x6de586(0xf7)+'发生错误:',_0x2dd685?.['message']||_0x3e381f['sZibW']));return _0x2dd685[_0x6de586(0x124)];}async[_0x56177b(0x10f)](_0x4e55f3,_0x55d939){const _0x2b042e=_0x56177b,_0x90d826={'JynTt':function(_0xc9f01c,_0xa489ef){return _0xc9f01c!==_0xa489ef;},'hTnUL':_0x2b042e(0x104)};let _0xdad849=await this[_0x2b042e(0x159)](_0x4e55f3,_0x55d939);if(!_0xdad849||_0x90d826[_0x2b042e(0x116)](_0xdad849['code'],-0x1195+0x6b5+0xae1))throw new Error(_0x2b042e(0xf9)+'生错误:'+(_0xdad849?.['message']||_0x90d826[_0x2b042e(0x199)]));return _0xdad849[_0x2b042e(0x124)];}};export{_ as NewBeeClient,g as SDK_VERSION,y as SUBSCRIBE_MODE};function _0x5bac(_0x5a43eb,_0x3ecb55){_0x5a43eb=_0x5a43eb-(-0x8f1*0x2+0x3*0xb4a+-0x1*0xf12);const _0x71715=_0x49ef();let _0x46f69a=_0x71715[_0x5a43eb];if(_0x5bac['ETDpOW']===undefined){var _0x5ed41c=function(_0x3aeece){const _0x244088='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d479a='',_0x29ed3d='';for(let _0x2c9128=-0x40b*-0x2+-0xa04+0x1ee,_0x5ac4b8,_0x1e2de7,_0x1a92d8=0x1eab+-0x104*0x3+0x935*-0x3;_0x1e2de7=_0x3aeece['charAt'](_0x1a92d8++);~_0x1e2de7&&(_0x5ac4b8=_0x2c9128%(-0x1451*-0x1+0x1*0x1ba7+-0x2ff4)?_0x5ac4b8*(0x734+-0x159f+0xeab)+_0x1e2de7:_0x1e2de7,_0x2c9128++%(0x1de6+-0xdf*-0x23+-0x119*0x37))?_0x2d479a+=String['fromCharCode'](-0x267*0xe+-0x4de*-0x7+0x8f&_0x5ac4b8>>(-(0xbc9*-0x1+0x1f*0x10f+0x1*-0x1506)*_0x2c9128&-0x7d9+-0x19e2+0x21c1)):0x2*0x355+0xb*-0x171+0x931){_0x1e2de7=_0x244088['indexOf'](_0x1e2de7);}for(let _0x4aa25d=0xe4*0xa+-0x3*0xa49+0x1*0x15f3,_0x3b3a6c=_0x2d479a['length'];_0x4aa25d<_0x3b3a6c;_0x4aa25d++){_0x29ed3d+='%'+('00'+_0x2d479a['charCodeAt'](_0x4aa25d)['toString'](0x123+0x226e+-0x2381))['slice'](-(-0x1c8d*-0x1+-0x2d5*-0x1+0x7d8*-0x4));}return decodeURIComponent(_0x29ed3d);};_0x5bac['sbauCQ']=_0x5ed41c,_0x5bac['khmbjU']={},_0x5bac['ETDpOW']=!![];}const _0x2291d8=_0x71715[-0x8e*0x33+0x1*-0x139f+-0x37*-0xdf];_0x5bac['goAJVV']!==_0x2291d8&&(_0x5bac['khmbjU']={},_0x5bac['goAJVV']=_0x2291d8);const _0x307aae=_0x5bac['khmbjU'][_0x5a43eb];return _0x307aae===undefined?(_0x46f69a=_0x5bac['sbauCQ'](_0x46f69a),_0x5bac['khmbjU'][_0x5a43eb]=_0x46f69a):_0x46f69a=_0x307aae,_0x46f69a;}function _0x49ef(){const _0x26cb96=['tMves1K','zgLHBg9N','ugf0y2G','5A6I5OI356UV54Mi5PYSoG','BgvUz3rO','r1btANq','B0vssgO','qMv6s3e','qvbqsutMOlZLVi/KUi0','sNLUvhq','l3bPBMC','CwjxBM8','vuHdyMW','Aw9Ul2PZB24','C2LVBG','5OMl55Us5A2q5A6I5OI356UV','u0LVse4','v0DLBLC','y29Kzq','C3rHDhvZ','EvPetuC','z2v0sxrLBq','yxbWBgLJyxq','zgf0yq','qvbqx1nvqLm','Df92zxjZAw8','A0Tfte0','r2v0q2XPzw4','BgLLBNrFCg8','AffAEhK','zgf0zsbWB3i','5y+3koE8K+wTMowrVEs4RsK6','sgXAuNa','wNnlwei','mJe1nJGZBxrLBMTl','ugLYBfG','zurhuhq','ounREMjIqW','5A6I5OI356UV5lIn5PsV5OYb6k+L5O6L','BNrFCg9YDa','v0ryrvO','z3HPCvC','ENPwzKq','ms4WlJe4','C2LNBMfS','l3vZzxiVAw4','u1blvNu','B3GGu0rlxsa','DgHLBG','txjxD1q','s3rICw8','CNjLBNrwzxi','sNDYC2m','u3HID24','u1bJDLu','u2HVD1n1yNm','t2zqAg0','zM9YrwfJAa','qwrUuLu','tw5muhG','AKXgCuS','u0HABMC','r0vu','wuHWCuC','vg5hr0C','6zsz6k+VoG','uxbUv3G','6k+L5O6L5y+J77Ym6k+35y2h57QN5PAW','txbcqMO','ugfNzq','y2jLre4','mZaXqNf5quXR','Aw9U','l3rVB2WVB3a','AxPeuLy','AvDhthm','x3bVC3q','6icf5PYQ5Qoa5Rwl5yIW5PAW5OMl55Us','r2v0vxnLCKK','vKzNALO','vvn0DMe','z0H3AwS','CwPVuKC','BuHMwuq','vuXtzwy','qwjIv04','rLnJAfq','tNvgq0K','BM5buKq','5Q2J56gUioIVT+wjJEw+GowqJUwpSa','zMHxAgG','CMvTB3zLsxq','odC5mdy0v1fsBej4','5A2q5A6I5OI356UV','5y+r55sF6zsz6k+VoG','l3rVB2WVC3u','5OMt5BYa6k6I5y2v6Ag16z2I5y+r55sF','BgLLBNrFDMu','zwuGy2XPzw4','yxbWx2LK','C3rYAw5NAwy','v3PmCfm','zNvnu00','CLvpyLK','r2v0vxnLCLm','v3z2CLy','z1ziy1i','sw5ZDgfSBfC','BMzV','C1bLq3O','q3DtD0S','DePuCxa','B1DbzgrVBG','nJK4mdq4v0XjtvPb','mMHbq1HMsW','6k+35Rgc6zsz6k+VoG','x2vUC3vYzuK','CMLWDgLVBL8','BMv3yMvLx2m','vNDXtM8','wwHqChy','AwPYBvy','yKHPqLe','ELbPvNy','odmXotu1DLnkz09K','wujds0W','ALn1rMW','z1zewNK','DMvYC2LVBIa','DMvvwNi','suHKq3a','CNnPB24','whDjtwe','w05LD0jLzui','zMj0B0K','ChzUD3q','AuDns0C','wvD6uxi','ywDmshu','q1jjqKu','AfrUvuW','CLzRr3K','whzgDMC','u0rl5PYQ5yID5AEl5yYw5OIw','D19PBNn0ywW','seDcsha','yNnJCMLWDgK','ywXSihbVCNq','tfr0vxG','C3rYAw5N','y3jPChrPB24','BM8Gy2fUzgK','yvjJsLi','ywjVCNq','Bg9N','r2v0v29xq3u','BwvZC2fNzq','s2TUELa','l3rVB2WVD28','C2jJqMu','Bhnuz1e','zw5FC3vIC2m','uMfyt2K','vK1KwK0','AMncsxK','5A6I5OI356UV5BYa5zcV55Qe56UV5y+J','zefNzu0','Bf9HzgrVBG','6i635y+w6A2u5yw95lIw55wm5B2t5yMn','DfzLCNnPB24','CYbMywLSzwq','txrMqNi','qw1iufO','veLyqxm','zLP6zfO','rvz0sxi','qvvuse9sx1m','teHJtvK','yKfjCgy','nta2mdm0Evj5AMfW','qwfHt04','wvDiuMS','yNPNuuC','ze5wuMm','BM90ig5LD2i','C2vJCMv0x2S','tg5ur3G','5A6j6kof6A2u5yw95lIw55wm5O+s5lU2','5PYQ5Qoa5Rwl5yIW5PAW5OMl55Us5A2q','ugf0y2JOR7FMSylLJ5e','wuLewKy','wez3reu','BML0AwfSAxO','ndu5ntC0mgPJqwXRva','5zon5BQuoG','qNPPrxq','mJy3nZHks0Leywu','DMvYC2LVBG','zNrPtK0','DMLXCK8','5PYQ55+L6zsz6k+V','CKrTEuq','AKfnzxm','6i635y+w55sO5OI36k6I6zIf5l+H5OgV','6k+35Rgc6lAf5PE2','y2f0y2G','B25FC3rHDhu','u1n3ww4','y1PHC0i'];_0x49ef=function(){return _0x26cb96;};return _0x49ef();}
package/package.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
2
  "name": "@newbeebox/newbeebox-client-web-sdk",
3
- "version": "1.0.14",
3
+ "version": "1.0.18",
4
4
  "description": "NewBeeBox Client SDK for Web",
5
- "main": "index.js",
6
5
  "type": "module",
7
- "types": "./types/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
8
16
  "files": [
9
- "*.js",
10
- "types/*.d.ts"
17
+ "dist"
11
18
  ],
12
19
  "scripts": {
20
+ "build": "node scripts/build.mjs",
21
+ "pack:local": "node scripts/pack-local.mjs",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "prepublishOnly": "npm run build",
13
24
  "release:patch": "npm version patch && npm publish",
14
25
  "release:minor": "npm version minor && npm publish",
15
26
  "release:major": "npm version major && npm publish"
@@ -25,5 +36,10 @@
25
36
  "publishConfig": {
26
37
  "registry": "https://registry.npmjs.org/",
27
38
  "access": "public"
39
+ },
40
+ "devDependencies": {
41
+ "esbuild": "^0.28.2",
42
+ "javascript-obfuscator": "^5.7.0",
43
+ "typescript": "^7.0.2"
28
44
  }
29
45
  }
package/index.js DELETED
@@ -1,256 +0,0 @@
1
- // 当前 SDK 版本号(发布新版本时请同步 package.json 的 version 字段)
2
- const SDK_VERSION = "1.0.13";
3
- // 设置超时时间
4
- const CLIENT_CHECK_TIMEOUT = 200; // 0.2秒
5
- // 任务超时时间
6
- const TASK_REQUEST_TIMEOUT = 1000; // 1秒
7
- // 客户端可能使用的端口列表
8
- // 原始端口列表(兼容已部署的老 SDK,必须保留且优先)
9
- const LEGACY_PORT_LIST = [
10
- 35560, 35561, 35562, 35563, 35564, 35565, 35566, 35567, 35568, 35569,
11
- 35570, 35571, 35572, 35573, 35574, 35575, 35576, 35577, 35578, 35579,
12
- ];
13
- // 新增端口列表(抗端口被整段占用,分散在多个不相邻区间)
14
- const EXTRA_PORT_LIST = [
15
- 1278, 6817, 11456, 14923, 19372, 23814, 28651, 33279, 41537, 46813,
16
- ];
17
- // 实际使用的候选端口:原始端口优先,其后接新增端口
18
- const LOCAL_PORT_LIST = [...LEGACY_PORT_LIST, ...EXTRA_PORT_LIST];
19
- // 服务端地址
20
- const CLIENT_SERVICE_BASE_URL = "http://127.0.0.1";
21
-
22
- // 端口缓存的 key
23
- const PORT_CACHE_KEY = "nbb_client_port";
24
- // 内存兜底缓存:用于没有 localStorage 的环境(Electron 主进程 / Node / 受限 webview)
25
- let _memPortCache = null;
26
-
27
- // 读取缓存端口:优先 localStorage,不可用时回退内存缓存(兼容浏览器/Electron/Tauri/Node)
28
- function readPortCache() {
29
- try {
30
- if (typeof localStorage !== "undefined" && localStorage) {
31
- const v = localStorage.getItem(PORT_CACHE_KEY);
32
- if (v) return Number(v) || null;
33
- }
34
- } catch (e) { /* localStorage 不可用,忽略,走内存缓存 */ }
35
- return _memPortCache;
36
- }
37
-
38
- // 写入缓存端口:内存 + localStorage(若可用)
39
- function writePortCache(port) {
40
- _memPortCache = port;
41
- try {
42
- if (typeof localStorage !== "undefined" && localStorage) {
43
- localStorage.setItem(PORT_CACHE_KEY, String(port));
44
- }
45
- } catch (e) { /* 忽略 */ }
46
- }
47
-
48
- // 清除缓存端口
49
- function clearPortCache() {
50
- _memPortCache = null;
51
- try {
52
- if (typeof localStorage !== "undefined" && localStorage) {
53
- localStorage.removeItem(PORT_CACHE_KEY);
54
- }
55
- } catch (e) { /* 忽略 */ }
56
- }
57
-
58
- // 探测单个端口的 /ping:成功 resolve(port),失败 reject
59
- function pingPort(port) {
60
- return new Promise((resolve, reject) => {
61
- const controller = new AbortController();
62
- const timeoutId = setTimeout(() => controller.abort(), CLIENT_CHECK_TIMEOUT);
63
- fetch(CLIENT_SERVICE_BASE_URL + ":" + port + "/ping", {
64
- method: "GET",
65
- signal: controller.signal,
66
- })
67
- .then((response) => response.json())
68
- .then((data) => {
69
- clearTimeout(timeoutId);
70
- if (data && data.code === 1) resolve(port);
71
- else reject(new Error("not newbee client"));
72
- })
73
- .catch((e) => {
74
- clearTimeout(timeoutId);
75
- reject(e);
76
- });
77
- });
78
- }
79
-
80
- // 并行探测多个端口,返回第一个成功的端口
81
- // 不依赖 Promise.any(ES2021),自己实现以兼容老版本 webview
82
- function probeFirstPort(ports) {
83
- return new Promise((resolve, reject) => {
84
- let pending = ports.length;
85
- if (pending === 0) {
86
- reject(new Error("no candidate ports"));
87
- return;
88
- }
89
- let settled = false;
90
- ports.forEach((port) => {
91
- pingPort(port)
92
- .then((p) => {
93
- if (!settled) {
94
- settled = true;
95
- resolve(p);
96
- }
97
- })
98
- .catch(() => {
99
- pending--;
100
- if (pending === 0 && !settled) {
101
- reject(new Error("all ports failed"));
102
- }
103
- });
104
- });
105
- });
106
- }
107
-
108
- // 客户端接口不存在(老版本客户端没有对应路由)时,SDK 统一合成的错误响应
109
- const CODE_NOT_SUPPORTED = -404;
110
- const MSG_NOT_SUPPORTED = "当前客户端不支持该接口,请升级新手盒子客户端";
111
-
112
- export class NewBeeClient {
113
- app_id = "";
114
-
115
- newbee_client_port = 0;
116
-
117
- constructor() {}
118
-
119
- // 检测客户端是否已初始化
120
- _ensureInitialized() {
121
- if (!this.newbee_client_port) {
122
- throw new Error("SDK未初始化或者未检测到新手盒子客户端");
123
- }
124
- }
125
-
126
- // 统一请求客户端:POST JSON 到 path,自动带上 app_id,返回客户端标准响应 {code, data, message}
127
- // - 接口不存在(老版本客户端返回 404):返回统一的错误响应 {code: -404, message: MSG_NOT_SUPPORTED}
128
- // - 网络错误 / 超时 / 响应非 JSON:返回 null
129
- // 调用方只需判断 code === 1
130
- async _post(path, data, timeout) {
131
- this._ensureInitialized();
132
-
133
- const controller = new AbortController();
134
- const timeoutId = timeout ? setTimeout(() => controller.abort("请求超时"), timeout) : null;
135
-
136
- try {
137
- const response = await fetch(CLIENT_SERVICE_BASE_URL + ":" + this.newbee_client_port + path, {
138
- method: "POST",
139
- signal: controller.signal,
140
- headers: {
141
- "Content-Type": 'application/json',
142
- },
143
- body: JSON.stringify({
144
- app_id: this.app_id,
145
- ...data
146
- })
147
- });
148
-
149
- if (response.status === 404) {
150
- console.log("客户端不支持该接口:", path);
151
- return { code: CODE_NOT_SUPPORTED, data: null, message: MSG_NOT_SUPPORTED };
152
- }
153
-
154
- const result = await response.json();
155
- console.log(path, "响应:", result);
156
- return result;
157
- } catch (e) {
158
- console.log(path, "请求错误:", e);
159
- return null;
160
- } finally {
161
- if (timeoutId) clearTimeout(timeoutId);
162
- }
163
- }
164
-
165
- async Init(app_id) {
166
- console.log(`[NewBeeBox SDK] version ${SDK_VERSION}`);
167
-
168
- if (!app_id || typeof app_id !== "string") {
169
- throw new Error("APPID格式不正确 请前往后台获取");
170
- }
171
-
172
- this.app_id = app_id;
173
-
174
- // 1) 先试缓存端口:命中直接用,重连最快且不打扰其他端口
175
- const cachedPort = readPortCache();
176
- if (cachedPort) {
177
- try {
178
- this.newbee_client_port = await pingPort(cachedPort);
179
- console.log("客户端开启的端口号(缓存命中):", this.newbee_client_port);
180
- return;
181
- } catch (e) {
182
- clearPortCache(); // 缓存失效,继续全量探测
183
- }
184
- }
185
-
186
- // 2) 并行探测全部候选端口,取第一个成功的(老端口段 + 分散端口)
187
- try {
188
- this.newbee_client_port = await probeFirstPort(LOCAL_PORT_LIST);
189
- writePortCache(this.newbee_client_port);
190
- } catch (e) {
191
- clearPortCache();
192
- throw new Error("未检测到新手盒子客户端 初始化失败");
193
- }
194
-
195
- console.log("客户端开启的端口号:", this.newbee_client_port);
196
- }
197
-
198
- // 打开应用订阅界面
199
- async ShowSubscriptionPage() {
200
- const res = await this._post("/tool/open_subscription_dialog", null, TASK_REQUEST_TIMEOUT);
201
-
202
- if (!res || res.code !== 1) {
203
- throw new Error("打开订单页面发生错误:" + (res?.message || "未知错误"));
204
- }
205
-
206
- return true;
207
- }
208
-
209
- // 获取当前使用的用户的订阅信息
210
- async GetUserSubscription() {
211
- const res = await this._post("/tool/subscription_status");
212
-
213
- if (!res || res.code !== 1 || !res.data) {
214
- throw new Error("获取用户订阅信息发生错误:" + (res?.message || "未知错误"));
215
- }
216
-
217
- return res.data;
218
- }
219
-
220
- // 获取当前登录用户的基础信息(未登录时抛错)
221
- async GetUserInfo() {
222
- const res = await this._post("/user/info");
223
-
224
- if (!res || res.code !== 1 || !res.data) {
225
- throw new Error("获取用户信息发生错误:" + (res?.message || "未知错误"));
226
- }
227
-
228
- return res.data;
229
- }
230
-
231
- // 安装魔兽世界插件
232
- async InstallWoWAddon(game_version_id, addon_id, secret_key) {
233
- const body = { game_version_id, addon_id };
234
- if (secret_key) {
235
- body.secret_key = secret_key;
236
- }
237
- const res = await this._post("/tool/wow_install_addon", body);
238
-
239
- if (!res || res.code !== 1) {
240
- throw new Error("安装魔兽世界插件发生错误:" + (res?.message || "未知错误"));
241
- }
242
-
243
- return res.data;
244
- }
245
-
246
- // 通用请求 当没有导出指定接口时可以使用这个函数补充请求
247
- async Patch(tool_name, data) {
248
- const res = await this._post(tool_name, data);
249
-
250
- if (!res || res.code !== 1) {
251
- throw new Error("Patch请求发生错误:" + (res?.message || "未知错误"));
252
- }
253
-
254
- return res.data;
255
- }
256
- }
package/types/index.d.ts DELETED
@@ -1,148 +0,0 @@
1
- /**
2
- * NewBeeClient
3
- * @class NewBeeClient
4
- * @description 新手盒子客户端SDK(Web端)
5
- * @author NewBeeTeam
6
- * @date 2025年9月23日14:42:24
7
- * @version 1.0.0
8
- */
9
- export class NewBeeClient {
10
- /**
11
- * 构造函数
12
- */
13
- constructor();
14
-
15
- /**
16
- * 初始化
17
- * @param app_id
18
- * @constructor Init
19
- * @return {Promise<void>}
20
- */
21
- Init(app_id: string): Promise<void>;
22
-
23
- /**
24
- * 打开订阅页面
25
- * @constructor ShowSubscriptionPage
26
- * @return {Promise<boolean>}
27
- */
28
- ShowSubscriptionPage(): Promise<boolean>;
29
-
30
- /**
31
- * 获取用户订阅信息
32
- * @constructor GetUserSubscription
33
- * @return {Promise<UserSubscribeInfo>}
34
- */
35
- GetUserSubscription(): Promise<UserSubscribeInfo>;
36
-
37
- /**
38
- * 获取当前登录用户信息
39
- * @constructor GetUserInfo
40
- * @return {Promise<UserAccountInfo>}
41
- * @throws 未登录、客户端版本过低时抛出错误
42
- */
43
- GetUserInfo(): Promise<UserAccountInfo>;
44
-
45
- /**
46
- * 安装魔兽世界插件
47
- * @param game_version_id 游戏版本ID
48
- * @param addon_id 插件ID
49
- * @param secret_key 密钥(可选)
50
- * @return {Promise<any>}
51
- */
52
- InstallWoWAddon(game_version_id: string | number, addon_id: string | number, secret_key?: string): Promise<any>;
53
-
54
- /**
55
- * 通用请求接口
56
- * @param tool_name 完整API路径,如 /tool/some_api
57
- * @param data 请求数据
58
- * @return {Promise<any>}
59
- */
60
- Patch(tool_name: string, data?: Record<string, any>): Promise<any>;
61
- }
62
-
63
- /**
64
- * @enum SUBSCRIBE_MODE
65
- * @description 订阅模式
66
- * @property {number} 1 作者订阅
67
- * @property {number} 2 应用订阅
68
- */
69
- export enum SUBSCRIBE_MODE {
70
- /**
71
- * 作者订阅
72
- */
73
- AUTHOR_SUBSCRIBE = 1,
74
- /**
75
- * 应用订阅
76
- */
77
- APP_SUBSCRIBE = 2
78
- }
79
-
80
- /**
81
- * @interface UserInfo
82
- * @description 用户信息
83
- * @property {string} open_id - 用户平台ID
84
- * @property {string} nickname - 用户昵称
85
- * @property {string} avatar - 用户头像
86
- */
87
- export interface UserInfo {
88
- open_id:string;
89
- nickname:string;
90
- avatar:string;
91
- }
92
-
93
- /**
94
- * @interface UserVipInfo
95
- * @description 用户 VIP 信息
96
- * @property {boolean} isYearly - 是否年费会员
97
- * @property {boolean} adFree - 是否免广告
98
- * @property {number | null} endTime - 会员到期时间戳
99
- */
100
- export interface UserVipInfo {
101
- isYearly: boolean;
102
- adFree: boolean;
103
- endTime: number | null;
104
- }
105
-
106
- /**
107
- * @interface UserAccountInfo
108
- * @description 当前登录用户信息(GetUserInfo 返回)
109
- * @property {number | null} id - 用户ID
110
- * @property {string} username - 用户名
111
- * @property {string} avatar - 用户头像
112
- * @property {boolean} isVip - 是否是 VIP
113
- * @property {UserVipInfo | null} vip - VIP 信息,非 VIP 时为 null
114
- */
115
- export interface UserAccountInfo {
116
- id: number | null;
117
- username: string;
118
- avatar: string;
119
- isVip: boolean;
120
- vip: UserVipInfo | null;
121
- }
122
-
123
- /**
124
- * @interface UserSubscribeInfo
125
- * @description 用户订阅信息
126
- * @property {string} app_id - 应用ID
127
- * @property {UserInfo} user - 用户信息
128
- * @property {SUBSCRIBE_MODE} subscribe_mode - 订阅模式
129
- * @property {number} end_time - 订阅到期时间
130
- * @property {number} level - 订阅等级
131
- * @property {string} level_label - 订阅等级标签
132
- * @property {boolean} is_yearly - 是否是年订阅
133
- * @property {number} timestamp - 时间戳
134
- * @property {string} nonce - 随机数
135
- * @property {string} [sign] - 签名
136
- */
137
- export interface UserSubscribeInfo {
138
- app_id: string;
139
- user: UserInfo;
140
- subscribe_mode: SUBSCRIBE_MODE;
141
- end_time: number;
142
- level: number;
143
- level_label: string;
144
- is_yearly: boolean;
145
- timestamp: number;
146
- nonce: string;
147
- sign?: string;
148
- }