@newbeebox/newbeebox-client-web-sdk 1.0.13 → 1.0.17
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 +79 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +1 -0
- package/package.json +21 -5
- package/index.js +0 -297
- package/types/index.d.ts +0 -110
package/README.md
CHANGED
|
@@ -25,6 +25,18 @@ await client.ShowSubscriptionPage();
|
|
|
25
25
|
// 获取当前用户订阅信息
|
|
26
26
|
let info = await client.GetUserSubscription();
|
|
27
27
|
console.log(info);
|
|
28
|
+
|
|
29
|
+
// 获取当前登录用户信息
|
|
30
|
+
let user = await client.GetUserInfo();
|
|
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.25",空串表示客户端版本过低不上报
|
|
28
40
|
```
|
|
29
41
|
|
|
30
42
|
### API
|
|
@@ -45,6 +57,35 @@ console.log(info);
|
|
|
45
57
|
|
|
46
58
|
获取当前用户的订阅信息。
|
|
47
59
|
|
|
60
|
+
#### `GetUserInfo(): Promise<UserAccountInfo>`
|
|
61
|
+
|
|
62
|
+
获取当前登录用户的基础信息。用户未登录时抛出错误。
|
|
63
|
+
|
|
64
|
+
#### `GetWoWCurrentVersion(): Promise<WoWGameVersion>`
|
|
65
|
+
|
|
66
|
+
获取客户端当前选中的魔兽世界游戏版本。返回的 `id` 可直接作为 `InstallWoWAddon` 的 `game_version_id`。
|
|
67
|
+
|
|
68
|
+
#### `GetClientVersion(): string`
|
|
69
|
+
|
|
70
|
+
获取新手盒子客户端的版本号,如 `"0.70.25"`。
|
|
71
|
+
|
|
72
|
+
**这是同步方法,不发请求。** 版本号在 `Init()` 的端口探测(`GET /ping`)过程中已经
|
|
73
|
+
顺路取回并缓存,所以调用它没有任何网络开销。未初始化时抛错。
|
|
74
|
+
|
|
75
|
+
返回**空串**表示客户端版本过低、还不具备上报版本的能力 —— 这不是错误。
|
|
76
|
+
按版本开关功能时,应把空串当成"低于所有已知版本"处理:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
const v = client.GetClientVersion();
|
|
80
|
+
if (!v) {
|
|
81
|
+
// 老客户端,连版本都不上报,一律按最低能力处理
|
|
82
|
+
console.log("请升级新手盒子客户端");
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
注意版本号是 `主.次.修订` 形式的字符串,**不要直接用字符串或 parseFloat 比较**
|
|
87
|
+
(`"0.70.25" < "0.9"` 为真,`parseFloat("0.70.25")` 得 0.7),要按段拆成数字比。
|
|
88
|
+
|
|
48
89
|
#### `InstallWoWAddon(game_version_id, addon_id, secret_key?): Promise<any>`
|
|
49
90
|
|
|
50
91
|
安装魔兽世界插件。
|
|
@@ -64,6 +105,18 @@ console.log(info);
|
|
|
64
105
|
| tool_name | string | 完整API路径,如 `/tool/some_api` |
|
|
65
106
|
| data | object | 请求数据(可选) |
|
|
66
107
|
|
|
108
|
+
### 错误处理
|
|
109
|
+
|
|
110
|
+
所有接口失败时都会抛出 `Error`,`message` 格式统一为 `<操作>发生错误:<原因>`。
|
|
111
|
+
|
|
112
|
+
如果用户安装的客户端版本过低、没有所调用的接口,`<原因>` 固定为:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
当前客户端不支持该接口,请升级新手盒子客户端
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
所有接口(含 `Patch`)行为一致,第三方应用可据此提示用户升级客户端。
|
|
119
|
+
|
|
67
120
|
---
|
|
68
121
|
|
|
69
122
|
**订阅信息返回结构**:
|
|
@@ -86,3 +139,29 @@ console.log(info);
|
|
|
86
139
|
"sign": "485d82860578ff..." // 签名,用于服务端验证
|
|
87
140
|
}
|
|
88
141
|
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
**用户信息返回结构**:
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
{
|
|
148
|
+
"id": 10001, // 用户ID
|
|
149
|
+
"username": "Kyuu", // 用户名
|
|
150
|
+
"avatar": "https://cdn8.newbeebox.com/....",
|
|
151
|
+
"isVip": true, // 是否是 VIP
|
|
152
|
+
"vip": { // 非 VIP 时为 null
|
|
153
|
+
"isYearly": false, // 是否年费会员
|
|
154
|
+
"adFree": true, // 是否免广告
|
|
155
|
+
"endTime": 1790000000000 // 会员到期时间戳
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**魔兽世界当前版本返回结构**:
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
{
|
|
164
|
+
"id": 8, // 游戏版本ID
|
|
165
|
+
"name": "燃烧的远征" // 游戏版本名称
|
|
166
|
+
}
|
|
167
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
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.17";
|
|
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
|
+
/**
|
|
113
|
+
* 已连接客户端的版本号(如 "0.70.25")。Init() 时由 /ping 顺路取回。
|
|
114
|
+
* 空串 = 未初始化,或客户端版本过低不上报版本。
|
|
115
|
+
*/
|
|
116
|
+
newbee_client_version: string;
|
|
117
|
+
constructor();
|
|
118
|
+
_ensureInitialized(): void;
|
|
119
|
+
_post(path: string, data?: Record<string, any> | null, timeout?: number): Promise<ClientResponse | null>;
|
|
120
|
+
/**
|
|
121
|
+
* 初始化 SDK,扫描本地端口连接新手盒子客户端
|
|
122
|
+
* @param app_id 应用ID,从后台获取
|
|
123
|
+
*/
|
|
124
|
+
Init(app_id: string): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* 获取新手盒子客户端的版本号,如 "0.70.25"
|
|
127
|
+
*
|
|
128
|
+
* 版本号在 Init() 的端口探测里已经顺路取回并缓存,**本方法不发请求,是同步的**。
|
|
129
|
+
*
|
|
130
|
+
* 返回空串表示客户端版本过低、还不具备上报版本的能力(**不是出错**)。
|
|
131
|
+
* 接入方若要按版本开关功能,应把空串当成"低于所有已知版本"处理。
|
|
132
|
+
*
|
|
133
|
+
* @throws SDK 未初始化 / 未检测到客户端时抛错
|
|
134
|
+
*/
|
|
135
|
+
GetClientVersion(): string;
|
|
136
|
+
/**
|
|
137
|
+
* 打开应用订阅界面
|
|
138
|
+
*/
|
|
139
|
+
ShowSubscriptionPage(): Promise<boolean>;
|
|
140
|
+
/**
|
|
141
|
+
* 获取当前使用的用户的订阅信息
|
|
142
|
+
*/
|
|
143
|
+
GetUserSubscription(): Promise<UserSubscribeInfo>;
|
|
144
|
+
/**
|
|
145
|
+
* 获取当前登录用户的基础信息(未登录时抛错)
|
|
146
|
+
*/
|
|
147
|
+
GetUserInfo(): Promise<UserAccountInfo>;
|
|
148
|
+
/**
|
|
149
|
+
* 获取客户端当前选中的魔兽世界游戏版本
|
|
150
|
+
*/
|
|
151
|
+
GetWoWCurrentVersion(): Promise<WoWGameVersion>;
|
|
152
|
+
/**
|
|
153
|
+
* 安装魔兽世界插件
|
|
154
|
+
* @param game_version_id 游戏版本ID
|
|
155
|
+
* @param addon_id 插件ID
|
|
156
|
+
* @param secret_key 密钥(可选)
|
|
157
|
+
*/
|
|
158
|
+
InstallWoWAddon(game_version_id: string | number, addon_id: string | number, secret_key?: string): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* 通用请求接口,当 SDK 未导出指定接口时可使用此方法补充请求
|
|
161
|
+
* @param tool_name 完整API路径,如 /tool/some_api
|
|
162
|
+
* @param data 请求数据(可选)
|
|
163
|
+
*/
|
|
164
|
+
Patch(tool_name: string, data?: Record<string, any>): Promise<any>;
|
|
165
|
+
}
|
|
166
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x542c6d=_0x22ad;(function(_0x30a538,_0x55f46c){const _0x28d8e8=_0x22ad,_0x957b89=_0x30a538();while(!![]){try{const _0x5ce81c=parseInt(_0x28d8e8(0x1d6))/(-0x11bd+-0x43d+0x1*0x15fb)+-parseInt(_0x28d8e8(0x1e7))/(0x14bf+0x5cb+0x3*-0x8d8)*(-parseInt(_0x28d8e8(0x208))/(0x1075+-0x500+-0xb72))+-parseInt(_0x28d8e8(0x187))/(-0x204b+0x1588+-0x1f*-0x59)+-parseInt(_0x28d8e8(0x1ba))/(-0x17b*-0x12+0x32*-0x1b+-0x155b)+parseInt(_0x28d8e8(0x1d8))/(-0x281+0xae2+0x17*-0x5d)+-parseInt(_0x28d8e8(0x1ed))/(-0x13*-0x32+-0x1428+-0x1*-0x1079)+parseInt(_0x28d8e8(0x1f2))/(0x11fd+-0x1*-0x20b3+-0x32a8)*(parseInt(_0x28d8e8(0x1e0))/(0x1aae+0x7*-0x34f+-0x37c));if(_0x5ce81c===_0x55f46c)break;else _0x957b89['push'](_0x957b89['shift']());}catch(_0x24d87a){_0x957b89['push'](_0x957b89['shift']());}}}(_0x195f,-0x81972+-0x1132f9+0x24d9c1));var g='1.0.17',b=[-0x9453+-0x1391*-0xd+-0x20de*-0x1,-0xb34d+-0x8ded+0x1cc23,-0x5*-0x321d+0x55*0x115+-0xcba0,0xc27c+-0xa47a+0x6ce9,-0xf0d*-0x7+-0xf77c+0x1190d,0x74e2+0x2f3b*-0x1+0x4546,-0xd826+0xb314+0xb000,-0xa7b4*-0x1+-0x1*0xe40b+0xc746,-0x9d5e+0x6efc+0x3*0x3dc6,0x846e+0xdf*-0x121+0x10242,-0xe6fe+-0x1ec*-0x52+0x28*0x54f,-0xd459+0x149*0xad+0x80f7,-0x3*0x12b5+-0x12c7+-0x373*-0x3e,0x871b+-0x56f6+0x5ad0,0x1*-0xc179+-0x1421*-0xb+0x6f04,-0x3*0x2c86+0xd504+0x3b85,0x179*-0x4d+0x1d*0x991+-0x1910,-0x400f+0x4*0x1883+0x1a3f*0x4,-0x2c*0x278+-0x3a85*0x4+0x1e1ae,0x1*0xf40c+0x35*-0x2d1+0x2c34],f=[-0xaa*-0x26+0x3*0x48f+-0x21eb,-0x13*0x101+-0x9f7*-0x3+-0x13*-0xd5,0x3e95*-0x1+0x3d12*0x1+0x38f*0xd,0x2218+-0x6aab+0x82de,-0x87e7+-0x4a4f+-0x3dd*-0x4a,-0x2fd8*0x3+-0x18df*0x1+0x1056d,0xd0*0x2f+-0x185*-0x30+0xcb,-0x31*0x194+0x257a+0xa9d9*0x1,0xf*-0x1e1+-0x28b5+-0xe725*-0x1,0x6ba1+0x96c*0x8+-0xc*0x3],h=[...b,...f],m='http://1'+_0x542c6d(0x1a6),a=_0x542c6d(0x158)+_0x542c6d(0x185),c=null;function p(){const _0x445004=_0x542c6d,_0x167d1a={'stENU':function(_0x3714a6,_0x282083){return _0x3714a6<_0x282083;},'fSOYr':function(_0x4644f3,_0x1a5319){return _0x4644f3(_0x1a5319);},'pqLDW':function(_0x373697,_0xc4333d){return _0x373697(_0xc4333d);},'SJKTD':function(_0x4e8f79,_0x24a47d){return _0x4e8f79!==_0x24a47d;},'EJXoT':_0x445004(0x186),'tGhEj':function(_0xa9db2e,_0x1df37c){return _0xa9db2e<_0x1df37c;},'ZsKmh':function(_0x5276df,_0x3a4e2b){return _0x5276df!==_0x3a4e2b;},'shhaD':'Juqnp','Vamnj':'BPncC','zKMFk':function(_0x13916c,_0x5c7449){return _0x13916c(_0x5c7449);}};try{if(_0x167d1a[_0x445004(0x1bf)](_0x445004(0x186),_0x167d1a[_0x445004(0x198)])){_0x57e86f=_0x2ef752;try{_0x167d1a[_0x445004(0x1e1)](typeof _0x570b88,'u')&&_0x2bee0f&&_0x54700f[_0x445004(0x1f7)](_0x2a687a,_0x167d1a[_0x445004(0x183)](_0x4631b8,_0x397b81));}catch{}}else{if(_0x167d1a[_0x445004(0x171)](typeof localStorage,'u')&&localStorage){if(_0x167d1a[_0x445004(0x1f3)](_0x167d1a[_0x445004(0x189)],_0x167d1a[_0x445004(0x184)])){let _0x199a6e=localStorage['getItem'](a);if(_0x199a6e)return _0x167d1a['zKMFk'](Number,_0x199a6e)||null;}else _0x167d1a[_0x445004(0x1e1)](typeof _0x5a37b5,'u')&&_0x43670c&&_0x5f4a19[_0x445004(0x1f7)](_0x1073e1,_0x167d1a[_0x445004(0x1f0)](_0x3dbe9e,_0x36d44b));}}}catch{}return c;}function w(_0x3eee2c){const _0x5838ac=_0x542c6d,_0x4108b9={'SCJaT':function(_0x75913a,_0x3d31e9){return _0x75913a!==_0x3d31e9;},'XRURx':_0x5838ac(0x1ad),'hryyC':function(_0x2a3bd4,_0x117dfa){return _0x2a3bd4(_0x117dfa);}};c=_0x3eee2c;try{if(_0x4108b9[_0x5838ac(0x205)](_0x4108b9['XRURx'],_0x4108b9[_0x5838ac(0x175)]))return this['_ensureI'+_0x5838ac(0x179)+'ed'](),this[_0x5838ac(0x157)+'lient_ve'+_0x5838ac(0x18f)];else typeof localStorage<'u'&&localStorage&&localStorage[_0x5838ac(0x1f7)](a,_0x4108b9[_0x5838ac(0x159)](String,_0x3eee2c));}catch{}}function u(){const _0xd1bb3c=_0x542c6d,_0x2e219c={'ThRHR':function(_0x44d341,_0x25c362){return _0x44d341(_0x25c362);},'mpqyx':function(_0x15ea85,_0x36cc22){return _0x15ea85!==_0x36cc22;},'yWBMD':_0xd1bb3c(0x1ae)};c=null;try{if(_0x2e219c[_0xd1bb3c(0x1ff)](_0x2e219c['yWBMD'],'hMaVs'))typeof localStorage<'u'&&localStorage&&localStorage[_0xd1bb3c(0x17f)+'em'](a);else{const _0x548db5={'RoxxO':function(_0x5445da,_0x540cec){return _0x5445da(_0x540cec);},'uxhIU':function(_0x3a24be,_0x1cc6a6){return _0x3a24be===_0x1cc6a6;},'NpFrp':_0xd1bb3c(0x1eb)+_0xd1bb3c(0x16c)};_0x2e219c[_0xd1bb3c(0x204)](_0x1c0bcd,_0x7d6388)['then'](_0x1935b5=>{const _0x5b7d82=_0xd1bb3c;_0x1b9e01||(_0x2542a0=!(0x1*-0x1406+-0x1*-0x149b+-0x95),_0x548db5[_0x5b7d82(0x188)](_0x5d2df0,_0x1935b5));})['catch'](()=>{const _0xa103f4=_0xd1bb3c;_0xb2592b--,_0x548db5[_0xa103f4(0x164)](_0x56a41b,-0x1*-0x1694+0x2*-0x10ee+-0x4c*-0x26)&&!_0x350ab3&&_0x548db5[_0xa103f4(0x188)](_0x305c52,new _0x1f7358(_0x548db5[_0xa103f4(0x1bd)]));});}}catch{}}function d(_0x1eb940){const _0x436714=_0x542c6d,_0x348d66={'WgaLQ':function(_0x4e220b,_0x482018){return _0x4e220b(_0x482018);},'UTnDA':'no\x20candi'+_0x436714(0x1b1)+'ts','CWloy':_0x436714(0x1a8),'XxGBW':_0x436714(0x1f8),'EKPMb':function(_0x6e09d3,_0x5af67d){return _0x6e09d3===_0x5af67d;},'rAEoJ':'szYzW','PYWyr':function(_0x41c822,_0x5eab4b){return _0x41c822==_0x5eab4b;},'dIrQr':_0x436714(0x1c7),'jaKjJ':_0x436714(0x180)+_0x436714(0x1fc)+'t','edJjj':function(_0x33f4a4,_0x39dfe1){return _0x33f4a4!==_0x39dfe1;},'DrdTA':_0x436714(0x207),'FlORQ':_0x436714(0x1c0),'dpwkk':function(_0x2b88d0,_0x45be5c,_0x2a163f){return _0x2b88d0(_0x45be5c,_0x2a163f);},'SQJeP':function(_0x10b57d,_0x3ac59e,_0x34ac56){return _0x10b57d(_0x3ac59e,_0x34ac56);},'vQWuu':function(_0x222c12,_0x38b019){return _0x222c12+_0x38b019;},'UJBLD':'/ping'};return new Promise((_0x1a445c,_0x3de084)=>{const _0x839a31=_0x436714,_0x4f0319={'cwYtR':_0x348d66['UTnDA'],'ndQYh':_0x348d66['CWloy'],'dTkCm':_0x348d66[_0x839a31(0x1b0)],'TUOji':function(_0x1ff1fc,_0x565cc9){const _0x1b52ec=_0x839a31;return _0x348d66[_0x1b52ec(0x1e6)](_0x1ff1fc,_0x565cc9);},'jGHTJ':function(_0x1fcbc4,_0x250ff7){const _0xe1c10e=_0x839a31;return _0x348d66[_0xe1c10e(0x1ee)](_0x1fcbc4,_0x250ff7);},'mGAte':_0x348d66['rAEoJ'],'sAGVH':function(_0x2ea394,_0x464a25){const _0x2d19be=_0x839a31;return _0x348d66[_0x2d19be(0x1e6)](_0x2ea394,_0x464a25);},'SBXns':function(_0x29dbc9,_0x336cdc){const _0x2c7776=_0x839a31;return _0x348d66[_0x2c7776(0x1b9)](_0x29dbc9,_0x336cdc);},'sniOI':_0x348d66[_0x839a31(0x1f1)],'yAySe':_0x348d66[_0x839a31(0x1b3)]};if(_0x348d66[_0x839a31(0x1a2)](_0x348d66[_0x839a31(0x1b4)],_0x348d66[_0x839a31(0x1b5)])){let _0x411e91=new AbortController(),_0x3e3209=_0x348d66['dpwkk'](setTimeout,()=>_0x411e91['abort'](),-0x24*0x66+0x2326*-0x1+0x12*0x2cb);_0x348d66['SQJeP'](fetch,_0x348d66[_0x839a31(0x16f)](_0x348d66['vQWuu'](m,':'),_0x1eb940)+_0x348d66['UJBLD'],{'method':_0x839a31(0x17b),'signal':_0x411e91[_0x839a31(0x1cb)]})[_0x839a31(0x1d5)](_0x511010=>_0x511010['json']())[_0x839a31(0x1d5)](_0x207b2b=>{const _0x337ad6=_0x839a31;if(_0x4f0319['ndQYh']===_0x4f0319['dTkCm']){if(!this[_0x337ad6(0x157)+_0x337ad6(0x19a)+'rt'])throw new _0x518ff6(_0x337ad6(0x182)+_0x337ad6(0x1a5)+_0x337ad6(0x15c));}else{if(_0x4f0319['TUOji'](clearTimeout,_0x3e3209),_0x207b2b&&_0x207b2b['code']===-0x79d+-0xc1a+-0x8*-0x277){if(_0x4f0319[_0x337ad6(0x1bc)](_0x4f0319[_0x337ad6(0x1ac)],_0x4f0319['mGAte'])){let _0x442b05=_0x207b2b[_0x337ad6(0x1b7)]&&_0x207b2b['data']['version'];_0x4f0319[_0x337ad6(0x201)](_0x1a445c,{'port':_0x1eb940,'version':_0x4f0319[_0x337ad6(0x1e4)](typeof _0x442b05,_0x4f0319[_0x337ad6(0x196)])?_0x442b05:''});}else{_0x373d4e(new _0xfc77fa(_0x4f0319[_0x337ad6(0x1b2)]));return;}}else _0x3de084(new Error(_0x4f0319[_0x337ad6(0x177)]));}})[_0x839a31(0x18c)](_0x1da049=>{const _0x3c6c08=_0x839a31;_0x348d66[_0x3c6c08(0x1e6)](clearTimeout,_0x3e3209),_0x348d66[_0x3c6c08(0x1e6)](_0x3de084,_0x1da049);});}else _0x1b87e4||(_0x1f97ef=!(-0x1ddb*0x1+-0x16e0+0x34bb),_0x4a7e4c(_0x223728));});}function _0x195f(){const _0x47b9e0=['ruTqtwi','zgLHBg9N','ChfmrfC','zeLYuxi','nJeYmtGXnKXXBwjUua','wNnlBwG','6i635y+w55sO5OI36k6I6zIf5l+H5OgV','r2v0vxnLCLm','DMvYC2LVBIa','C2v0sxrLBq','s01er3y','Dw5kCva','A3PYy2G','Bf9HzgrVBG','zwuGy2XPzw4','yM1qA2O','Cw9juxG','BxbXExG','yNnJCMLWDgK','C0fhvKG','yxbWx2LK','qvbqx1nvqLm','vgHssfi','u0nkyvq','wwDVrvC','sgP6suG','mte3odG4Dhbqt25y','ugf0y2JOR7FMSylLJ5e','BM8Gy2fUzgK','D19JDxjYzw4','BMv3yMvLx2m','BMjIx2nSAwu','Ahj5Eum','r2v0q2XPzw4','s1rgzNC','5A2q5A6I5OI356UV','5PYQ55+L6zsz6k+V','5A6I5OI356UV54Mi5PYSoG','zeHkqLK','vLP1zum','5OMl55Us5A2q5A6I5OI356UV','ruzIBKO','5zon5BQuoG','DxHOsvu','54Mi5PYS5y+r55sF6zsz6k+VoG','ANnVBG','u2HVD1n1yNm','D2frEfu','y29Kzq','wvDQvgu','yxbWBgLJyxq','CYbMywLSzwq','zM9YrwfJAa','yu1duNy','DLfxDxu','l3rVB2WVD28','DeDOrwO','Bg9N','ywHQB3C','D294zLa','wfjvuNG','B1DbzgrVBG','Euf5u2u','5y+r55sF6zsz6k+VoG','BML0AwfSAxO','CMLWDgLVBL8','r0vu','DNfuqvm','5PYQ5lIk5OQL','DMTSsuy','CMvTB3zLsxq','BM90ig5LD2i','rxz1tfi','u0rl5PYQ5yID5AEl5yYw5OIw','zLnpwxi','vMfTBMO','BNrFCg9YDa','u0zIEK4','mJe3mJKWofLrDu56zW','uM94Ee8','C2HOyuq','BgvUz3rO','q1jjqKu','y2f0y2G','C3rYAw5NAwy','Cg9YDa','CNnPB24','z2v0sxrLBq','A05yyuG','yuvrzxa','t1PVALO','B25FC3rHDhu','DgLivuS','C25Pt0K','ywjVCNq','ruPyB1q','5A6I5OI356UV5lIn5PsV5OYb6k+L5O6L','BgLLBNrFCg8','CfDgvwS','5y+3koE8K+wTMowrVEs4RsK6','vLbkq3m','wKjxz0K','DwjZy3jPChq','sw5PDa','5OMt5BYa6k6I5y2v6Ag16z2I5y+r55sF','zwrkAMO','Df92zxjZAw8','t3Dtve4','6icf5PYQ5Qoa5Rwl5yIW5PAW5OMl55Us','mJCUmc4WlJe','u3rZAKu','tNnQDNG','A1z5zKS','sw5ZDgfSBfC','6zsz6k+VoG','BuDbDgu','DuTfv1i','y2fbyM4','C2vJCMv0x2S','whHhqLC','zgf0zsbWB3i','y3DzDfi','AMflAKO','rhjKvee','rMXpuLe','ugf0y2G','zgf0yq','Axb3CNu','ufLxExi','ntC4mZyYnunysvv6wa','5PYQ5Qoa5Rwl5yIW5PAW5OMl55Us5A2q','AKDiveO','tNbgCNa','6i635y+w6A2u5yw95lIw55wm5B2t5yMn','u0Plveq','DwP4Cw0','r2v0vxnLCKK','Aw9U','wfzmsue','5Q2J56gUioIVT+wjJEw+GowqJUwpSa','zw5FC3vIC2m','x3bVC3q','C3rYAw5N','l3rVB2WVB3a','DfzLCNnPB24','qvvuse9sx1m','C2LNBMfS','5A6j6kof6A2u5yw95lIw55wm5O+s5lU2','AejVqLy','u0z5tfa','BwvZC2fNzq','DMvYC2LVBG','C3rHDhvZ','5A6I5OI356UV5BYa5zcV55Qe56UV5y+J','x2vUC3vYzuK','BMzV','DgHLBG','mteWmZyXr0T4sg5X','l3vZzxiVAw4','nJG3mtu4nhvozgrWtq','6k+35Rgc6lAf5PE2','tgjPEKe','qKXhsNq','5B2t5yMn5A6I5OI356UV5lIn5PsV5OYb','A3jywM0','BgLLBNrFDMu','yMvZBgu','mJDAu2jgsgG','C3rftLu','s0rWuwq','r2XzzxC','u0jyBNm','vujtq1jjqKu','v2DHtfe','oevrrvbHza','y3jPChrPB24','ugfNzq','B3PIzfe','ywXSihbVCNq','vunAtwu','odC2mdiYmefYtLf5Ea'];_0x195f=function(){return _0x47b9e0;};return _0x195f();}function _0x22ad(_0x319ff7,_0x385131){_0x319ff7=_0x319ff7-(-0xee3+0x12cc+0x7*-0x5e);const _0x388ff1=_0x195f();let _0x33de02=_0x388ff1[_0x319ff7];if(_0x22ad['rXSlSX']===undefined){var _0x58021b=function(_0x222238){const _0x50a8a2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x17cd2f='',_0x578a73='';for(let _0x1cf707=0x1da7*-0x1+0x5d5+0x17d2,_0x72efdf,_0x5bcf2b,_0xbdb584=0xb28+0x3*-0x5ea+0x696;_0x5bcf2b=_0x222238['charAt'](_0xbdb584++);~_0x5bcf2b&&(_0x72efdf=_0x1cf707%(-0x20b+-0xfe*0x15+0x16e5)?_0x72efdf*(0x42d+-0x7*0x443+-0x19e8*-0x1)+_0x5bcf2b:_0x5bcf2b,_0x1cf707++%(-0x14a4+-0x196d+0x2e15))?_0x17cd2f+=String['fromCharCode'](-0x18*0x18b+-0x1c12+0x4219&_0x72efdf>>(-(0x22*-0x81+0x1679+-0x555)*_0x1cf707&0x1370*0x1+-0x20e2+0xd78)):-0xfd3*-0x1+-0x29*0x31+-0x7fa*0x1){_0x5bcf2b=_0x50a8a2['indexOf'](_0x5bcf2b);}for(let _0x457da3=-0x9fb+0x28c+0x76f,_0xa04464=_0x17cd2f['length'];_0x457da3<_0xa04464;_0x457da3++){_0x578a73+='%'+('00'+_0x17cd2f['charCodeAt'](_0x457da3)['toString'](-0x6d0+-0x1*-0x203f+0x3*-0x875))['slice'](-(0x1*0x1803+-0x1283+-0x57e));}return decodeURIComponent(_0x578a73);};_0x22ad['UExRgw']=_0x58021b,_0x22ad['bIhzjC']={},_0x22ad['rXSlSX']=!![];}const _0x31bc17=_0x388ff1[-0x37c*-0xa+0x1*0x1027+-0x1*0x32ff];_0x22ad['sfdjlY']!==_0x31bc17&&(_0x22ad['bIhzjC']={},_0x22ad['sfdjlY']=_0x31bc17);const _0x439b15=_0x22ad['bIhzjC'][_0x319ff7];return _0x439b15===undefined?(_0x33de02=_0x22ad['UExRgw'](_0x33de02),_0x22ad['bIhzjC'][_0x319ff7]=_0x33de02):_0x33de02=_0x439b15,_0x33de02;}function T(_0x35a0ea){const _0xfa442c=_0x542c6d,_0x12c00d={'OwSTN':function(_0x19ab66,_0xd62b5b){return _0x19ab66(_0xd62b5b);},'YgoEW':_0xfa442c(0x1eb)+_0xfa442c(0x16c),'HfWLp':function(_0x489cf5,_0x1c97c2){return _0x489cf5===_0x1c97c2;},'unJqP':_0xfa442c(0x20a)+_0xfa442c(0x1b1)+'ts'};return new Promise((_0x5eaf99,_0x5ee642)=>{const _0xa02321=_0xfa442c,_0x53ecbc={'YWjTe':function(_0x344378,_0x29a1ae){const _0x5766fd=_0x22ad;return _0x12c00d[_0x5766fd(0x1a4)](_0x344378,_0x29a1ae);},'ipwru':_0x12c00d[_0xa02321(0x206)]};let _0x352598=_0x35a0ea[_0xa02321(0x18a)];if(_0x12c00d['HfWLp'](_0x352598,0x1*0xc11+-0x65*-0x3b+-0x2358)){_0x5ee642(new Error(_0x12c00d[_0xa02321(0x1f9)]));return;}let _0x176789=!(-0x2ab*-0x7+-0x4e*0x3b+-0x1*0xb2);_0x35a0ea[_0xa02321(0x16d)](_0x380374=>{const _0x2449a6=_0xa02321,_0x475478={'krXZm':function(_0x3c5164,_0x36aa3b){return _0x3c5164===_0x36aa3b;},'aMCRv':function(_0x8f61d0,_0x3a8711){const _0x43e330=_0x22ad;return _0x53ecbc[_0x43e330(0x16a)](_0x8f61d0,_0x3a8711);},'NjFBh':_0x53ecbc[_0x2449a6(0x1b8)]};_0x53ecbc[_0x2449a6(0x16a)](d,_0x380374)[_0x2449a6(0x1d5)](_0x18cda3=>{_0x176789||(_0x176789=!(0x415*0x6+-0x2215+0x997),_0x53ecbc['YWjTe'](_0x5eaf99,_0x18cda3));})[_0x2449a6(0x18c)](()=>{const _0x5416cd=_0x2449a6;_0x352598--,_0x475478[_0x5416cd(0x1dd)](_0x352598,-0x1*0x267a+-0xfd8+0x3652)&&!_0x176789&&_0x475478[_0x5416cd(0x16e)](_0x5ee642,new Error(_0x475478['NjFBh']));});});});}var P=-(0x5*0x571+0x12*0xc5+-0x1*0x277b),E=_0x542c6d(0x1dc)+'该接口,请升级新'+_0x542c6d(0x161),y=(_0x2ba16b=>(_0x2ba16b[_0x2ba16b['AUTHOR_S'+_0x542c6d(0x1e5)]=0x2432*0x1+0x1fd2+-0x17*0x2f5]=_0x542c6d(0x1ca)+'UBSCRIBE',_0x2ba16b[_0x2ba16b[_0x542c6d(0x203)+_0x542c6d(0x18b)]=-0x1*0x17db+0x19d6+-0x65*0x5]=_0x542c6d(0x203)+_0x542c6d(0x18b),_0x2ba16b))(y||{}),_=class{constructor(){const _0xaf9c7c=_0x542c6d;this[_0xaf9c7c(0x202)]='',this[_0xaf9c7c(0x157)+_0xaf9c7c(0x19a)+'rt']=-0xb5*-0x5+0x43a*-0x6+0x15d3,this[_0xaf9c7c(0x157)+_0xaf9c7c(0x1de)+_0xaf9c7c(0x18f)]='';}[_0x542c6d(0x1d3)+_0x542c6d(0x179)+'ed'](){const _0x5a80d4=_0x542c6d,_0x4467ee={'StsjE':'SDK未初始化或'+_0x5a80d4(0x1a5)+'子客户端'};if(!this[_0x5a80d4(0x157)+'lient_po'+'rt'])throw new Error(_0x4467ee[_0x5a80d4(0x1a7)]);}async[_0x542c6d(0x1c6)](_0xda22a4,_0x2b03a0,_0x3c8ceb){const _0x3d2f68=_0x542c6d,_0x492195={'LbizA':function(_0x476ba1,_0x346c0c){return _0x476ba1(_0x346c0c);},'SFyLP':function(_0x9693f4,_0x4287c8,_0x738c7d){return _0x9693f4(_0x4287c8,_0x738c7d);},'guuqS':function(_0x430ff8,_0x110c2b){return _0x430ff8===_0x110c2b;},'UCZMe':function(_0x36a750,_0x593fea,_0x9725cc){return _0x36a750(_0x593fea,_0x9725cc);},'KDpQd':function(_0x528d62,_0x2f43be){return _0x528d62+_0x2f43be;},'besle':'POST','TQRzt':_0x3d2f68(0x16b)+'ion/json','wKnJu':function(_0x343551,_0x119226){return _0x343551===_0x119226;},'kzrch':_0x3d2f68(0x199)+'口:','VZueC':'\u8BF7\u6C42\u9519\u8BEF:'};this[_0x3d2f68(0x1d3)+'nitializ'+'ed']();let _0x11ba0b=new AbortController(),_0x2e087e=_0x3c8ceb?_0x492195[_0x3d2f68(0x1ce)](setTimeout,()=>_0x11ba0b[_0x3d2f68(0x197)](_0x3d2f68(0x1d9)),_0x3c8ceb):null;try{if(_0x492195['guuqS'](_0x3d2f68(0x191),_0x3d2f68(0x191))){let _0x33cb92=await _0x492195[_0x3d2f68(0x1ec)](fetch,_0x492195[_0x3d2f68(0x1e2)](m,':')+this[_0x3d2f68(0x157)+_0x3d2f68(0x19a)+'rt']+_0xda22a4,{'method':_0x492195[_0x3d2f68(0x1df)],'signal':_0x11ba0b[_0x3d2f68(0x1cb)],'headers':{'Content-Type':_0x492195['TQRzt']},'body':JSON[_0x3d2f68(0x18d)+'y']({'app_id':this['app_id'],..._0x2b03a0})});if(_0x492195['wKnJu'](_0x33cb92[_0x3d2f68(0x1d1)],-0x1d*0x13d+-0x170f+-0xf23*-0x4))return console[_0x3d2f68(0x172)](_0x492195[_0x3d2f68(0x1fa)],_0xda22a4),{'code':P,'data':null,'message':E};let _0x4aa6f8=await _0x33cb92[_0x3d2f68(0x166)]();return console[_0x3d2f68(0x172)](_0xda22a4,_0x3d2f68(0x163),_0x4aa6f8),_0x4aa6f8;}else{let _0x34a04f=_0x47696c[_0x3d2f68(0x190)](_0x78e022);if(_0x34a04f)return LiiZsQ[_0x3d2f68(0x1da)](_0x434e50,_0x34a04f)||null;}}catch(_0x5bfa6f){return console[_0x3d2f68(0x172)](_0xda22a4,_0x492195[_0x3d2f68(0x160)],_0x5bfa6f),null;}finally{_0x2e087e&&clearTimeout(_0x2e087e);}}async[_0x542c6d(0x1a0)](_0x1e7a12){const _0xfaeab6=_0x542c6d,_0x27a7d7={'pWFUk':function(_0x1bb200,_0x2b82f6){return _0x1bb200(_0x2b82f6);},'XVLIA':function(_0x473b3e,_0x58a5f1){return _0x473b3e!=_0x58a5f1;},'ozbdQ':_0xfaeab6(0x1c7),'vklIF':'APPID格式不'+_0xfaeab6(0x1c4)+'获取','vqTAS':function(_0x210369){return _0x210369();},'yAIll':function(_0x113dea,_0x155ddb){return _0x113dea(_0x155ddb);},'ahjow':_0xfaeab6(0x1d2)+_0xfaeab6(0x19c),'VPJCs':_0xfaeab6(0x15e),'EvuLR':_0xfaeab6(0x17d),'fMhTP':function(_0x5edaf4,_0x4c7009){return _0x5edaf4(_0x4c7009);},'KTFfw':function(_0x32aa94,_0xa9eb82){return _0x32aa94===_0xa9eb82;},'BayNQ':'OwSsj','aEQep':function(_0x3e0aed){return _0x3e0aed();},'iKgIA':'客户端开启的端口'+'号:'};if(console[_0xfaeab6(0x172)]('[NewBeeB'+'ox\x20SDK]\x20'+_0xfaeab6(0x1f6)+g),!_0x1e7a12||_0x27a7d7[_0xfaeab6(0x1c3)](typeof _0x1e7a12,_0x27a7d7[_0xfaeab6(0x1ea)]))throw new Error(_0x27a7d7[_0xfaeab6(0x17e)]);this[_0xfaeab6(0x202)]=_0x1e7a12;let _0x5aa141=_0x27a7d7[_0xfaeab6(0x17c)](p);if(_0x5aa141)try{let _0x1a3a56=await _0x27a7d7['yAIll'](d,_0x5aa141);this[_0xfaeab6(0x157)+'lient_po'+'rt']=_0x1a3a56[_0xfaeab6(0x18e)],this[_0xfaeab6(0x157)+_0xfaeab6(0x1de)+'rsion']=_0x1a3a56[_0xfaeab6(0x1d0)],console[_0xfaeab6(0x172)](_0x27a7d7[_0xfaeab6(0x173)],this[_0xfaeab6(0x157)+_0xfaeab6(0x19a)+'rt'],_0x27a7d7[_0xfaeab6(0x19d)],this[_0xfaeab6(0x157)+_0xfaeab6(0x1de)+_0xfaeab6(0x18f)]||_0x27a7d7['EvuLR']);return;}catch{u();}try{let _0x1d5c82=await _0x27a7d7['pWFUk'](T,h);this[_0xfaeab6(0x157)+_0xfaeab6(0x19a)+'rt']=_0x1d5c82[_0xfaeab6(0x18e)],this[_0xfaeab6(0x157)+_0xfaeab6(0x1de)+_0xfaeab6(0x18f)]=_0x1d5c82['version'],_0x27a7d7['fMhTP'](w,this[_0xfaeab6(0x157)+_0xfaeab6(0x19a)+'rt']);}catch{if(_0x27a7d7[_0xfaeab6(0x15b)]('OwSsj',_0x27a7d7['BayNQ']))throw _0x27a7d7[_0xfaeab6(0x192)](u),new Error(_0xfaeab6(0x1bb)+'客户端\x20初始化失'+'败');else _0x3f0491&&LEBrDs[_0xfaeab6(0x19b)](_0x2017c1,_0x36afa1);}console['log'](_0x27a7d7['iKgIA'],this['newbee_c'+'lient_po'+'rt'],_0x27a7d7[_0xfaeab6(0x19d)],this[_0xfaeab6(0x157)+_0xfaeab6(0x1de)+_0xfaeab6(0x18f)]||_0x27a7d7[_0xfaeab6(0x181)]);}[_0x542c6d(0x15a)+_0x542c6d(0x1c9)](){const _0x3d392a=_0x542c6d;return this[_0x3d392a(0x1d3)+_0x3d392a(0x179)+'ed'](),this[_0x3d392a(0x157)+_0x3d392a(0x1de)+'rsion'];}async[_0x542c6d(0x167)+_0x542c6d(0x1e8)+_0x542c6d(0x1e9)](){const _0xcc5a1c=_0x542c6d,_0x1e09d4={'bmPkj':_0xcc5a1c(0x1c8)+_0xcc5a1c(0x1c5)+_0xcc5a1c(0x17a)+_0xcc5a1c(0x1ef),'waQxU':function(_0x17bcef,_0x530b57){return _0x17bcef!==_0x530b57;},'OZojZ':function(_0x16b3fa,_0x58c986){return _0x16b3fa+_0x58c986;},'kVyfK':_0xcc5a1c(0x15d)};let _0x3dfca2=await this[_0xcc5a1c(0x1c6)](_0x1e09d4[_0xcc5a1c(0x1fd)],null,0x15*-0x1d5+-0xd*0x143+-0x39*-0x108);if(!_0x3dfca2||_0x1e09d4[_0xcc5a1c(0x168)](_0x3dfca2[_0xcc5a1c(0x169)],-0x1a76*0x1+-0x1*0x917+-0xde*-0x29))throw new Error(_0x1e09d4[_0xcc5a1c(0x193)](_0xcc5a1c(0x1a1)+_0xcc5a1c(0x1ab),_0x3dfca2?.[_0xcc5a1c(0x1cf)]||_0x1e09d4[_0xcc5a1c(0x1a9)]));return!(-0x20fb+-0x520*-0x2+0x16bb);}async[_0x542c6d(0x1f5)+_0x542c6d(0x19f)+_0x542c6d(0x1c2)](){const _0x5197e6=_0x542c6d,_0x2dec59={'hBoBV':'/tool/su'+_0x5197e6(0x200)+_0x5197e6(0x194)+'s','tiHUK':function(_0x53b415,_0x218b36){return _0x53b415!==_0x218b36;},'DbeCt':function(_0x3b98b3,_0x244d79){return _0x3b98b3+_0x244d79;},'cjJdf':_0x5197e6(0x1f4)+_0x5197e6(0x178),'sbWtD':'\u672A\u77E5\u9519\u8BEF'};let _0x29f52e=await this[_0x5197e6(0x1c6)](_0x2dec59[_0x5197e6(0x1cd)]);if(!_0x29f52e||_0x2dec59[_0x5197e6(0x195)](_0x29f52e[_0x5197e6(0x169)],0x24*-0xd3+-0x1*-0x7d7+0x15d6)||!_0x29f52e[_0x5197e6(0x1b7)])throw new Error(_0x2dec59['DbeCt'](_0x2dec59['cjJdf'],_0x29f52e?.[_0x5197e6(0x1cf)]||_0x2dec59['sbWtD']));return _0x29f52e[_0x5197e6(0x1b7)];}async[_0x542c6d(0x1c1)+_0x542c6d(0x1d4)](){const _0x482fd7=_0x542c6d,_0x4e3772={'EFbnJ':_0x482fd7(0x1d7)+'fo','qoIQx':function(_0x5778d1,_0x95e1f0){return _0x5778d1+_0x95e1f0;},'uowhv':'获取用户信息发生'+_0x482fd7(0x1ab),'BLGJt':_0x482fd7(0x15d)};let _0x167699=await this[_0x482fd7(0x1c6)](_0x4e3772[_0x482fd7(0x162)]);if(!_0x167699||_0x167699[_0x482fd7(0x169)]!==-0x1679+-0x245c+0x3ad6||!_0x167699[_0x482fd7(0x1b7)])throw new Error(_0x4e3772[_0x482fd7(0x1fe)](_0x4e3772['uowhv'],_0x167699?.[_0x482fd7(0x1cf)]||_0x4e3772[_0x482fd7(0x1db)]));return _0x167699[_0x482fd7(0x1b7)];}async['GetWoWCu'+'rrentVer'+'sion'](){const _0x4e89f9=_0x542c6d,_0x4f2b99={'dHJBY':function(_0x5873df,_0x4b0aa3){return _0x5873df!==_0x4b0aa3;},'GlYew':_0x4e89f9(0x1be)+_0x4e89f9(0x165)};let _0x256e36=await this[_0x4e89f9(0x1c6)](_0x4e89f9(0x170)+_0x4e89f9(0x20b)+_0x4e89f9(0x1a3)+'n');if(!_0x256e36||_0x4f2b99[_0x4e89f9(0x15f)](_0x256e36['code'],-0x1*0x6b5+0x40+0x676)||!_0x256e36[_0x4e89f9(0x1b7)])throw new Error(_0x4f2b99[_0x4e89f9(0x1e3)]+(_0x256e36?.[_0x4e89f9(0x1cf)]||_0x4e89f9(0x15d)));return _0x256e36[_0x4e89f9(0x1b7)];}async[_0x542c6d(0x1aa)+_0x542c6d(0x176)](_0x8c2722,_0x1fb03a,_0x4f1b46){const _0x5d7176=_0x542c6d,_0x53caa0={'VoHqZ':_0x5d7176(0x170)+'w_instal'+_0x5d7176(0x1fb),'ZBWgI':function(_0x11c7b6,_0x23e504){return _0x11c7b6!==_0x23e504;},'woxfP':_0x5d7176(0x1cc)+_0x5d7176(0x178)};let _0x4da0b9={'game_version_id':_0x8c2722,'addon_id':_0x1fb03a};_0x4f1b46&&(_0x4da0b9[_0x5d7176(0x1af)+'ey']=_0x4f1b46);let _0x44e306=await this[_0x5d7176(0x1c6)](_0x53caa0['VoHqZ'],_0x4da0b9);if(!_0x44e306||_0x53caa0[_0x5d7176(0x19e)](_0x44e306[_0x5d7176(0x169)],-0x1*0x6d1+-0x1283+0x1955))throw new Error(_0x53caa0[_0x5d7176(0x174)]+(_0x44e306?.[_0x5d7176(0x1cf)]||_0x5d7176(0x15d)));return _0x44e306[_0x5d7176(0x1b7)];}async[_0x542c6d(0x1b6)](_0x1522d1,_0x15a6d1){const _0x4be7de=_0x542c6d,_0x2c89ed={'uLGZv':function(_0x526c58,_0x248a75){return _0x526c58+_0x248a75;},'hdcuK':_0x4be7de(0x15d)};let _0xc9e183=await this[_0x4be7de(0x1c6)](_0x1522d1,_0x15a6d1);if(!_0xc9e183||_0xc9e183[_0x4be7de(0x169)]!==-0x1bd1+0x129d+-0x1*-0x935)throw new Error(_0x2c89ed['uLGZv'](_0x4be7de(0x209)+'生错误:',_0xc9e183?.[_0x4be7de(0x1cf)]||_0x2c89ed['hdcuK']));return _0xc9e183[_0x4be7de(0x1b7)];}};export{_ as NewBeeClient,g as SDK_VERSION,y as SUBSCRIBE_MODE};
|
package/package.json
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newbeebox/newbeebox-client-web-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "NewBeeBox Client SDK for Web",
|
|
5
|
-
"main": "index.js",
|
|
6
5
|
"type": "module",
|
|
7
|
-
"
|
|
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
|
-
"
|
|
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,297 +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
|
-
export class NewBeeClient {
|
|
109
|
-
app_id = "";
|
|
110
|
-
|
|
111
|
-
newbee_client_port = 0;
|
|
112
|
-
|
|
113
|
-
constructor() {}
|
|
114
|
-
|
|
115
|
-
// 检测客户端是否已初始化
|
|
116
|
-
_ensureInitialized() {
|
|
117
|
-
if (!this.newbee_client_port) {
|
|
118
|
-
throw new Error("SDK未初始化或者未检测到新手盒子客户端");
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async Init(app_id) {
|
|
123
|
-
console.log(`[NewBeeBox SDK] version ${SDK_VERSION}`);
|
|
124
|
-
|
|
125
|
-
if (!app_id || typeof app_id !== "string") {
|
|
126
|
-
throw new Error("APPID格式不正确 请前往后台获取");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
this.app_id = app_id;
|
|
130
|
-
|
|
131
|
-
// 1) 先试缓存端口:命中直接用,重连最快且不打扰其他端口
|
|
132
|
-
const cachedPort = readPortCache();
|
|
133
|
-
if (cachedPort) {
|
|
134
|
-
try {
|
|
135
|
-
this.newbee_client_port = await pingPort(cachedPort);
|
|
136
|
-
console.log("客户端开启的端口号(缓存命中):", this.newbee_client_port);
|
|
137
|
-
return;
|
|
138
|
-
} catch (e) {
|
|
139
|
-
clearPortCache(); // 缓存失效,继续全量探测
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 2) 并行探测全部候选端口,取第一个成功的(老端口段 + 分散端口)
|
|
144
|
-
try {
|
|
145
|
-
this.newbee_client_port = await probeFirstPort(LOCAL_PORT_LIST);
|
|
146
|
-
writePortCache(this.newbee_client_port);
|
|
147
|
-
} catch (e) {
|
|
148
|
-
clearPortCache();
|
|
149
|
-
throw new Error("未检测到新手盒子客户端 初始化失败");
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
console.log("客户端开启的端口号:", this.newbee_client_port);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 打开应用订阅界面
|
|
156
|
-
async ShowSubscriptionPage() {
|
|
157
|
-
this._ensureInitialized();
|
|
158
|
-
|
|
159
|
-
// 创建 AbortController 实例
|
|
160
|
-
const controller = new AbortController();
|
|
161
|
-
|
|
162
|
-
const signal = controller.signal;
|
|
163
|
-
|
|
164
|
-
const timeoutId = setTimeout(() => {
|
|
165
|
-
controller.abort("请求超时"); // 超时后取消请求
|
|
166
|
-
console.log('打开订单页面超时');
|
|
167
|
-
}, TASK_REQUEST_TIMEOUT);
|
|
168
|
-
|
|
169
|
-
let show_page_response;
|
|
170
|
-
|
|
171
|
-
try {
|
|
172
|
-
// 测试成功就请求客户端授权
|
|
173
|
-
let response = await fetch(CLIENT_SERVICE_BASE_URL + ":" + this.newbee_client_port + "/tool/open_subscription_dialog", {
|
|
174
|
-
method: "POST",
|
|
175
|
-
signal: signal,
|
|
176
|
-
headers: {
|
|
177
|
-
"Content-Type": 'application/json',
|
|
178
|
-
},
|
|
179
|
-
body: JSON.stringify({
|
|
180
|
-
app_id: this.app_id
|
|
181
|
-
})
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
clearTimeout(timeoutId);
|
|
185
|
-
|
|
186
|
-
show_page_response = await response.json();
|
|
187
|
-
|
|
188
|
-
console.log("开启页面结果:", show_page_response);
|
|
189
|
-
} catch (e) {
|
|
190
|
-
console.log("打开订单页面超时", e);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (!show_page_response || show_page_response?.code !== 1) {
|
|
194
|
-
throw new Error("打开订单页面发生错误:" + (show_page_response?.message || "未知错误"));
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// 获取当前使用的用户的订阅信息
|
|
201
|
-
async GetUserSubscription() {
|
|
202
|
-
this._ensureInitialized();
|
|
203
|
-
|
|
204
|
-
let user_subscribe_response = null;
|
|
205
|
-
try {
|
|
206
|
-
// 测试成功就请求客户端授权
|
|
207
|
-
let response = await fetch(CLIENT_SERVICE_BASE_URL + ":" + this.newbee_client_port + "/tool/subscription_status", {
|
|
208
|
-
method: "POST",
|
|
209
|
-
headers: {
|
|
210
|
-
"Content-Type": 'application/json',
|
|
211
|
-
},
|
|
212
|
-
body: JSON.stringify({
|
|
213
|
-
app_id: this.app_id
|
|
214
|
-
})
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
user_subscribe_response = await response.json();
|
|
218
|
-
|
|
219
|
-
console.log("用户订阅信息响应:", user_subscribe_response);
|
|
220
|
-
} catch (e) {
|
|
221
|
-
console.log("获取用户订阅错误:", e);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (!user_subscribe_response || user_subscribe_response?.code !== 1 || !user_subscribe_response?.data) {
|
|
225
|
-
throw new Error("获取用户订阅信息发生错误:" + (user_subscribe_response?.message || "未知错误"));
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return user_subscribe_response.data
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// 安装魔兽世界插件
|
|
232
|
-
async InstallWoWAddon(game_version_id, addon_id, secret_key) {
|
|
233
|
-
this._ensureInitialized();
|
|
234
|
-
|
|
235
|
-
let install_response = null;
|
|
236
|
-
try {
|
|
237
|
-
const body = {
|
|
238
|
-
app_id: this.app_id,
|
|
239
|
-
game_version_id: game_version_id,
|
|
240
|
-
addon_id: addon_id
|
|
241
|
-
};
|
|
242
|
-
if (secret_key) {
|
|
243
|
-
body.secret_key = secret_key;
|
|
244
|
-
}
|
|
245
|
-
let response = await fetch(CLIENT_SERVICE_BASE_URL + ":" + this.newbee_client_port + "/tool/wow_install_addon", {
|
|
246
|
-
method: "POST",
|
|
247
|
-
headers: {
|
|
248
|
-
"Content-Type": 'application/json',
|
|
249
|
-
},
|
|
250
|
-
body: JSON.stringify(body)
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
install_response = await response.json();
|
|
254
|
-
|
|
255
|
-
console.log("安装插件响应:", install_response);
|
|
256
|
-
} catch (e) {
|
|
257
|
-
console.log("安装插件错误:", e);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (!install_response || install_response?.code !== 1) {
|
|
261
|
-
throw new Error("安装魔兽世界插件发生错误:" + (install_response?.message || "未知错误"));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return install_response.data;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// 通用请求 当没有导出指定接口时可以使用这个函数补充请求
|
|
268
|
-
async Patch(tool_name, data) {
|
|
269
|
-
this._ensureInitialized();
|
|
270
|
-
|
|
271
|
-
let patch_response = null;
|
|
272
|
-
try {
|
|
273
|
-
let response = await fetch(CLIENT_SERVICE_BASE_URL + ":" + this.newbee_client_port + tool_name, {
|
|
274
|
-
method: "POST",
|
|
275
|
-
headers: {
|
|
276
|
-
"Content-Type": 'application/json',
|
|
277
|
-
},
|
|
278
|
-
body: JSON.stringify({
|
|
279
|
-
app_id: this.app_id,
|
|
280
|
-
...data
|
|
281
|
-
})
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
patch_response = await response.json();
|
|
285
|
-
|
|
286
|
-
console.log("Patch响应:", patch_response);
|
|
287
|
-
} catch (e) {
|
|
288
|
-
console.log("Patch请求错误:", e);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!patch_response || patch_response?.code !== 1) {
|
|
292
|
-
throw new Error("Patch请求发生错误:" + (patch_response?.message || "未知错误"));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return patch_response.data;
|
|
296
|
-
}
|
|
297
|
-
}
|
package/types/index.d.ts
DELETED
|
@@ -1,110 +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
|
-
* @param game_version_id 游戏版本ID
|
|
40
|
-
* @param addon_id 插件ID
|
|
41
|
-
* @param secret_key 密钥(可选)
|
|
42
|
-
* @return {Promise<any>}
|
|
43
|
-
*/
|
|
44
|
-
InstallWoWAddon(game_version_id: string | number, addon_id: string | number, secret_key?: string): Promise<any>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 通用请求接口
|
|
48
|
-
* @param tool_name 完整API路径,如 /tool/some_api
|
|
49
|
-
* @param data 请求数据
|
|
50
|
-
* @return {Promise<any>}
|
|
51
|
-
*/
|
|
52
|
-
Patch(tool_name: string, data?: Record<string, any>): Promise<any>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @enum SUBSCRIBE_MODE
|
|
57
|
-
* @description 订阅模式
|
|
58
|
-
* @property {number} 1 作者订阅
|
|
59
|
-
* @property {number} 2 应用订阅
|
|
60
|
-
*/
|
|
61
|
-
export enum SUBSCRIBE_MODE {
|
|
62
|
-
/**
|
|
63
|
-
* 作者订阅
|
|
64
|
-
*/
|
|
65
|
-
AUTHOR_SUBSCRIBE = 1,
|
|
66
|
-
/**
|
|
67
|
-
* 应用订阅
|
|
68
|
-
*/
|
|
69
|
-
APP_SUBSCRIBE = 2
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @interface UserInfo
|
|
74
|
-
* @description 用户信息
|
|
75
|
-
* @property {string} open_id - 用户平台ID
|
|
76
|
-
* @property {string} nickname - 用户昵称
|
|
77
|
-
* @property {string} avatar - 用户头像
|
|
78
|
-
*/
|
|
79
|
-
export interface UserInfo {
|
|
80
|
-
open_id:string;
|
|
81
|
-
nickname:string;
|
|
82
|
-
avatar:string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @interface UserSubscribeInfo
|
|
87
|
-
* @description 用户订阅信息
|
|
88
|
-
* @property {string} app_id - 应用ID
|
|
89
|
-
* @property {UserInfo} user - 用户信息
|
|
90
|
-
* @property {SUBSCRIBE_MODE} subscribe_mode - 订阅模式
|
|
91
|
-
* @property {number} end_time - 订阅到期时间
|
|
92
|
-
* @property {number} level - 订阅等级
|
|
93
|
-
* @property {string} level_label - 订阅等级标签
|
|
94
|
-
* @property {boolean} is_yearly - 是否是年订阅
|
|
95
|
-
* @property {number} timestamp - 时间戳
|
|
96
|
-
* @property {string} nonce - 随机数
|
|
97
|
-
* @property {string} [sign] - 签名
|
|
98
|
-
*/
|
|
99
|
-
export interface UserSubscribeInfo {
|
|
100
|
-
app_id: string;
|
|
101
|
-
user: UserInfo;
|
|
102
|
-
subscribe_mode: SUBSCRIBE_MODE;
|
|
103
|
-
end_time: number;
|
|
104
|
-
level: number;
|
|
105
|
-
level_label: string;
|
|
106
|
-
is_yearly: boolean;
|
|
107
|
-
timestamp: number;
|
|
108
|
-
nonce: string;
|
|
109
|
-
sign?: string;
|
|
110
|
-
}
|