node-easywechat 2.8.3 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -4
- package/dist/Core/Http/Request.js +2 -2
- package/dist/Core/ServerGuard.d.ts +2 -2
- package/dist/Core/Types.d.ts +34 -4
- package/dist/OpenPlatform/Application.js +2 -2
- package/dist/OpenWork/Application.d.ts +37 -0
- package/dist/OpenWork/Application.js +128 -0
- package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +8 -0
- package/dist/OpenWork/Auth/ProviderAccessToken.js +33 -0
- package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +8 -0
- package/dist/OpenWork/Auth/SuiteAccessToken.js +34 -0
- package/dist/OpenWork/Auth/SuiteTicket.d.ts +8 -0
- package/dist/OpenWork/Auth/SuiteTicket.js +40 -0
- package/dist/OpenWork/Corp/CorpClient.d.ts +72 -0
- package/dist/OpenWork/Corp/CorpClient.js +150 -0
- package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +5 -0
- package/dist/OpenWork/MiniProgram/MiniProgramClient.js +18 -0
- package/dist/OpenWork/Provider/ProviderClient.d.ts +81 -0
- package/dist/OpenWork/Provider/ProviderClient.js +172 -0
- package/dist/OpenWork/Server/OpenWorkGuard.d.ts +13 -0
- package/dist/OpenWork/Server/OpenWorkGuard.js +51 -0
- package/dist/OpenWork/Work/Application.d.ts +5 -0
- package/dist/OpenWork/Work/Application.js +22 -0
- package/dist/OpenWork/Work/Auth/AccessToken.d.ts +12 -0
- package/dist/OpenWork/Work/Auth/AccessToken.js +44 -0
- package/dist/Work/Server/Guard.d.ts +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +8 -6
- package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +1 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
[](https://app.travis-ci.com/hpyer/node-easywechat) [](https://www.npmjs.com/package/node-easywechat) [](LICENSE)
|
|
5
5
|
|
|
6
|
-
**注:2.x分支针对 EasyWechat 的 5.x版本(由于4.x与5.x的结构基本一致,就不升级大版本了)
|
|
6
|
+
**注:2.x分支针对 EasyWechat 的 5.x版本(由于4.x与5.x的结构基本一致,就不升级大版本了)。**
|
|
7
7
|
|
|
8
|
-
[
|
|
8
|
+
~~若您需要 EasyWechat 的 3.x版本,请切换到 [1.x](https://github.com/hpyer/node-easywechat/tree/1.x) 分支。~~ **1.0版本已废弃**
|
|
9
|
+
|
|
10
|
+
[EasyWechat](https://github.com/w7corp/easywechat) 是一个由 `安正超` 大神用 PHP 开发的开源的微信非官方 SDK(现由微擎团队团队维护)。其功能强大,使用方便,个人一直很喜欢,所以近日将其在 Node.js 上实现。本人会尽量还原其配置项以及接口的调用方式,但毕竟语言环境不同,具体的实现方式会有些许差别,还请各位开发者见谅。
|
|
9
11
|
|
|
10
12
|
> 注:虽然也使用了 EasyWechat 这个名称,但是和 `安正超` 大神没有任何关系,请各位开发者不要因使用本包产生的疑惑而去打扰大神,如有疑问请在本项目中提 issue,谢谢~
|
|
11
13
|
|
|
@@ -36,7 +38,7 @@ let payment = new EasyWechat.Factory.Payment({
|
|
|
36
38
|
// ...
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
//
|
|
41
|
+
// 开放平台
|
|
40
42
|
let openPlatform = new EasyWechat.Factory.OpenPlatform({
|
|
41
43
|
// ...
|
|
42
44
|
});
|
|
@@ -51,6 +53,11 @@ let microMerchant = new EasyWechat.Factory.MicroMerchant({
|
|
|
51
53
|
// ...
|
|
52
54
|
});
|
|
53
55
|
|
|
56
|
+
// 企业微信开放平台
|
|
57
|
+
let openWork = new EasyWechat.Factory.OpenWork({
|
|
58
|
+
// ...
|
|
59
|
+
});
|
|
60
|
+
|
|
54
61
|
// 通用方式
|
|
55
62
|
let app = EasyWechat.Factory.getInstance('OficialAccount', {
|
|
56
63
|
// ...
|
|
@@ -147,6 +154,46 @@ let app = EasyWechat.Factory.getInstance('OficialAccount', {
|
|
|
147
154
|
}
|
|
148
155
|
```
|
|
149
156
|
|
|
157
|
+
``` js
|
|
158
|
+
// 开放平台
|
|
159
|
+
{
|
|
160
|
+
// 开放平台APPID
|
|
161
|
+
app_id: 'your-app-id',
|
|
162
|
+
// 开放平台Secret
|
|
163
|
+
secret: 'your-secret',
|
|
164
|
+
// 开放平台Token
|
|
165
|
+
token: 'your-token',
|
|
166
|
+
// 开放平台AES KEY
|
|
167
|
+
aes_key: 'your-aes_key',
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
``` js
|
|
172
|
+
// 企业微信开放平台
|
|
173
|
+
{
|
|
174
|
+
// 服务商的corpid
|
|
175
|
+
corp_id: 'your-corp_id',
|
|
176
|
+
// 服务商的secret
|
|
177
|
+
secret: 'your-secret',
|
|
178
|
+
// 应用id
|
|
179
|
+
suite_id: 'your-suite_id',
|
|
180
|
+
// 应用secret
|
|
181
|
+
suite_secret: 'your-suite_secret',
|
|
182
|
+
// 应用Token
|
|
183
|
+
token: 'your-token',
|
|
184
|
+
// 应用AESKey
|
|
185
|
+
aes_key: 'your-aes_key',
|
|
186
|
+
// 注册定制化模板ID
|
|
187
|
+
reg_template_id: 'your-tpl_id',
|
|
188
|
+
// 安装应用的回调url(可选)
|
|
189
|
+
redirect_uri_install: 'your-uri_install',
|
|
190
|
+
// 单点登录回调url(可选)
|
|
191
|
+
redirect_uri_single: 'your-uri_single',
|
|
192
|
+
// 网页授权第三方回调url(可选)
|
|
193
|
+
redirect_uri_oauth: 'your-uri_oauth',
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
150
197
|
### 模块支持情况
|
|
151
198
|
|
|
152
199
|
- [x] 公众号模块
|
|
@@ -154,7 +201,7 @@ let app = EasyWechat.Factory.getInstance('OficialAccount', {
|
|
|
154
201
|
- [x] 小程序
|
|
155
202
|
- [x] 开放平台
|
|
156
203
|
- [x] 企业微信
|
|
157
|
-
- [
|
|
204
|
+
- [x] 企业微信开放平台
|
|
158
205
|
- [x] 小微商户
|
|
159
206
|
- [x] 自定义
|
|
160
207
|
|
|
@@ -110,7 +110,7 @@ class Request {
|
|
|
110
110
|
get(key) {
|
|
111
111
|
if (!this.isValid)
|
|
112
112
|
throw new Error('Please set request first. app.rebind(\'request\', new EasyWechat.Request(ctx.req));');
|
|
113
|
-
if (this._get[key])
|
|
113
|
+
if (this._get[key] != undefined)
|
|
114
114
|
return this._get[key];
|
|
115
115
|
return this.post(key);
|
|
116
116
|
}
|
|
@@ -135,7 +135,7 @@ class Request {
|
|
|
135
135
|
this._post = (0, Utils_1.parseQueryString)(this._content.toString());
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
return this._post && this._post[key] ? this._post[key] : null;
|
|
138
|
+
return this._post && this._post[key] != undefined ? this._post[key] : null;
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
getAllGet() {
|
|
@@ -35,8 +35,8 @@ export default class ServerGuard {
|
|
|
35
35
|
* 处理消息
|
|
36
36
|
*/
|
|
37
37
|
serve(): Promise<Response>;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
validate(): Promise<this>;
|
|
39
|
+
forceValidate(): this;
|
|
40
40
|
protected resolve(): Promise<Response>;
|
|
41
41
|
protected shouldReturnRawResponse(): Promise<boolean>;
|
|
42
42
|
protected buildResponse(to: string, from: string, message: any): Promise<string>;
|
package/dist/Core/Types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare interface EasyWechatConfig {
|
|
|
49
49
|
app_id?: string;
|
|
50
50
|
/**
|
|
51
51
|
* 应用 secret
|
|
52
|
-
* @scope BaseService | OfficialAccount | MiniProgram | Work
|
|
52
|
+
* @scope BaseService | OfficialAccount | MiniProgram | Work | OpenWork
|
|
53
53
|
*/
|
|
54
54
|
secret?: string;
|
|
55
55
|
/**
|
|
@@ -64,12 +64,12 @@ export declare interface EasyWechatConfig {
|
|
|
64
64
|
file_cache?: EasyWechatConfigCacheFile;
|
|
65
65
|
/**
|
|
66
66
|
* 服务端接口验证 token
|
|
67
|
-
* @scope OfficialAccount | MiniProgram | OpenPlatform
|
|
67
|
+
* @scope OfficialAccount | MiniProgram | OpenPlatform | OpenWork
|
|
68
68
|
*/
|
|
69
69
|
token?: string;
|
|
70
70
|
/**
|
|
71
71
|
* 服务端消息加解密密钥 aes_key
|
|
72
|
-
* @scope OfficialAccount | MiniProgram | OpenPlatform
|
|
72
|
+
* @scope OfficialAccount | MiniProgram | OpenPlatform | OpenWork
|
|
73
73
|
*/
|
|
74
74
|
aes_key?: string;
|
|
75
75
|
/**
|
|
@@ -154,7 +154,7 @@ export declare interface EasyWechatConfig {
|
|
|
154
154
|
device_type?: string;
|
|
155
155
|
/**
|
|
156
156
|
* 企业id
|
|
157
|
-
* @scope Work
|
|
157
|
+
* @scope Work | OpenWork
|
|
158
158
|
*/
|
|
159
159
|
corp_id?: string;
|
|
160
160
|
/**
|
|
@@ -162,6 +162,36 @@ export declare interface EasyWechatConfig {
|
|
|
162
162
|
* @scope Work
|
|
163
163
|
*/
|
|
164
164
|
agent_id?: string;
|
|
165
|
+
/**
|
|
166
|
+
* 应用id
|
|
167
|
+
* @scope OpenWork
|
|
168
|
+
*/
|
|
169
|
+
suite_id?: string;
|
|
170
|
+
/**
|
|
171
|
+
* 应用secret
|
|
172
|
+
* @scope OpenWork
|
|
173
|
+
*/
|
|
174
|
+
suite_secret?: string;
|
|
175
|
+
/**
|
|
176
|
+
* 注册定制化模板ID
|
|
177
|
+
* @scope OpenWork
|
|
178
|
+
*/
|
|
179
|
+
reg_template_id?: string;
|
|
180
|
+
/**
|
|
181
|
+
* 安装应用的回调url(可选)
|
|
182
|
+
* @scope OpenWork
|
|
183
|
+
*/
|
|
184
|
+
redirect_uri_install?: string;
|
|
185
|
+
/**
|
|
186
|
+
* 单点登录回调url(可选)
|
|
187
|
+
* @scope OpenWork
|
|
188
|
+
*/
|
|
189
|
+
redirect_uri_single?: string;
|
|
190
|
+
/**
|
|
191
|
+
* 网页授权第三方回调url(可选)
|
|
192
|
+
* @scope OpenWork
|
|
193
|
+
*/
|
|
194
|
+
redirect_uri_oauth?: string;
|
|
165
195
|
}
|
|
166
196
|
/**
|
|
167
197
|
* 服务端通知处理回调函数
|
|
@@ -97,9 +97,9 @@ class OpenPlatform extends BaseApplication_1.default {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
optional['pre_auth_code'] = yield this.createPreAuthorizationCode()['pre_auth_code'];
|
|
100
|
+
optional['pre_auth_code'] = (yield this.createPreAuthorizationCode())['pre_auth_code'];
|
|
101
101
|
}
|
|
102
|
-
return 'https://mp.weixin.qq.com/safe/bindcomponent?' + (0, Utils_1.buildQueryString)((0, Utils_1.merge)(optional, {
|
|
102
|
+
return 'https://mp.weixin.qq.com/safe/bindcomponent?' + (0, Utils_1.buildQueryString)((0, Utils_1.merge)((0, Utils_1.merge)({}, optional), {
|
|
103
103
|
component_appid: this.config['app_id'],
|
|
104
104
|
redirect_uri: callbackUrl,
|
|
105
105
|
action: 'bindcomponent',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import BaseApplication from '../Core/BaseApplication';
|
|
2
|
+
import MiniProgram from '../Work/MiniProgram/Application';
|
|
3
|
+
import Work from './Work/Application';
|
|
4
|
+
import ProviderAccessToken from './Auth/ProviderAccessToken';
|
|
5
|
+
import SuiteAccessToken from './Auth/SuiteAccessToken';
|
|
6
|
+
import SuiteTicket from './Auth/SuiteTicket';
|
|
7
|
+
import CorpClient from './Corp/CorpClient';
|
|
8
|
+
import MiniProgramClient from './MiniProgram/MiniProgramClient';
|
|
9
|
+
import ProviderClient from './Provider/ProviderClient';
|
|
10
|
+
import Encryptor from '../Core/Encryptor';
|
|
11
|
+
import OpenWorkGuard from './Server/OpenWorkGuard';
|
|
12
|
+
import { EasyWechatConfig } from '../Core/Types';
|
|
13
|
+
export default class OpenWork extends BaseApplication {
|
|
14
|
+
protected defaultConfig: EasyWechatConfig;
|
|
15
|
+
provider_access_token: ProviderAccessToken;
|
|
16
|
+
suite_access_token: SuiteAccessToken;
|
|
17
|
+
suite_ticket: SuiteTicket;
|
|
18
|
+
corp: CorpClient;
|
|
19
|
+
mini_program: MiniProgramClient;
|
|
20
|
+
provider: ProviderClient;
|
|
21
|
+
encryptor_corp: Encryptor;
|
|
22
|
+
encryptor: Encryptor;
|
|
23
|
+
server: OpenWorkGuard;
|
|
24
|
+
constructor(config?: EasyWechatConfig, prepends?: Object, id?: String);
|
|
25
|
+
registerProviders(): void;
|
|
26
|
+
/**
|
|
27
|
+
* 代理小程序实现业务,返回SDK实例
|
|
28
|
+
*/
|
|
29
|
+
miniProgram(): MiniProgram;
|
|
30
|
+
/**
|
|
31
|
+
* 代理企业微信实现业务,返回SDK实例
|
|
32
|
+
* @param authCorpId 企业 corp_id
|
|
33
|
+
* @param permanentCode 企业永久授权码
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
work(authCorpId: string, permanentCode: string): Work;
|
|
37
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseApplication_1 = __importDefault(require("../Core/BaseApplication"));
|
|
16
|
+
const Application_1 = __importDefault(require("../Work/MiniProgram/Application"));
|
|
17
|
+
const Application_2 = __importDefault(require("./Work/Application"));
|
|
18
|
+
const ProviderAccessToken_1 = __importDefault(require("./Auth/ProviderAccessToken"));
|
|
19
|
+
const SuiteAccessToken_1 = __importDefault(require("./Auth/SuiteAccessToken"));
|
|
20
|
+
const SuiteTicket_1 = __importDefault(require("./Auth/SuiteTicket"));
|
|
21
|
+
const CorpClient_1 = __importDefault(require("./Corp/CorpClient"));
|
|
22
|
+
const MiniProgramClient_1 = __importDefault(require("./MiniProgram/MiniProgramClient"));
|
|
23
|
+
const ProviderClient_1 = __importDefault(require("./Provider/ProviderClient"));
|
|
24
|
+
const Encryptor_1 = __importDefault(require("../Core/Encryptor"));
|
|
25
|
+
const OpenWorkGuard_1 = __importDefault(require("./Server/OpenWorkGuard"));
|
|
26
|
+
const FinallResult_1 = __importDefault(require("../Core/Decorators/FinallResult"));
|
|
27
|
+
class OpenWork extends BaseApplication_1.default {
|
|
28
|
+
constructor(config = {}, prepends = {}, id = null) {
|
|
29
|
+
super(config, prepends, id);
|
|
30
|
+
this.defaultConfig = {
|
|
31
|
+
// 必要配置
|
|
32
|
+
app_id: '',
|
|
33
|
+
key: '',
|
|
34
|
+
http: {
|
|
35
|
+
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
this.provider_access_token = null;
|
|
39
|
+
this.suite_access_token = null;
|
|
40
|
+
this.suite_ticket = null;
|
|
41
|
+
this.corp = null;
|
|
42
|
+
this.mini_program = null;
|
|
43
|
+
this.provider = null;
|
|
44
|
+
this.encryptor_corp = null;
|
|
45
|
+
this.encryptor = null;
|
|
46
|
+
this.server = null;
|
|
47
|
+
this.registerProviders();
|
|
48
|
+
}
|
|
49
|
+
registerProviders() {
|
|
50
|
+
super.registerCommonProviders();
|
|
51
|
+
if (!this.provider_access_token) {
|
|
52
|
+
this.offsetSet('provider_access_token', function (app) {
|
|
53
|
+
return new ProviderAccessToken_1.default(app);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
this.offsetSet('suite_ticket', function (app) {
|
|
57
|
+
return new SuiteTicket_1.default(app);
|
|
58
|
+
});
|
|
59
|
+
if (!this.suite_access_token) {
|
|
60
|
+
this.offsetSet('suite_access_token', function (app) {
|
|
61
|
+
return new SuiteAccessToken_1.default(app);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (!this.corp) {
|
|
65
|
+
this.offsetSet('corp', function (app) {
|
|
66
|
+
return new CorpClient_1.default(app);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (!this.mini_program) {
|
|
70
|
+
this.offsetSet('mini_program', function (app) {
|
|
71
|
+
return new MiniProgramClient_1.default(app);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!this.provider) {
|
|
75
|
+
this.offsetSet('provider', function (app) {
|
|
76
|
+
return new ProviderClient_1.default(app);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (!this.encryptor_corp) {
|
|
80
|
+
this.offsetSet('encryptor_corp', function (app) {
|
|
81
|
+
return new Encryptor_1.default(app.config['corp_id'], app.config['token'], app.config['aes_key']);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (!this.encryptor) {
|
|
85
|
+
this.offsetSet('encryptor', function (app) {
|
|
86
|
+
return new Encryptor_1.default(app.config['suite_id'], app.config['token'], app.config['aes_key']);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!this.server) {
|
|
90
|
+
this.offsetSet('server', function (app) {
|
|
91
|
+
let guard = new OpenWorkGuard_1.default(app);
|
|
92
|
+
guard.push(function (payload) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
let decrypted = yield this.app.request.get('echostr');
|
|
95
|
+
if (decrypted) {
|
|
96
|
+
let str = this.app.encryptor_corp.decrypt(decrypted, this.app.request.get('msg_signature'), this.app.request.get('nonce'), this.app.request.get('timestamp'));
|
|
97
|
+
return new FinallResult_1.default(str);
|
|
98
|
+
}
|
|
99
|
+
// 缓存SuiteTicket
|
|
100
|
+
if (typeof payload['SuiteTicket'] != 'undefined') {
|
|
101
|
+
yield this.app.suite_ticket.setTicket(payload['SuiteTicket']);
|
|
102
|
+
return new FinallResult_1.default('success');
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
return guard;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 代理小程序实现业务,返回SDK实例
|
|
113
|
+
*/
|
|
114
|
+
miniProgram() {
|
|
115
|
+
return new Application_1.default(this.getConfig());
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 代理企业微信实现业务,返回SDK实例
|
|
119
|
+
* @param authCorpId 企业 corp_id
|
|
120
|
+
* @param permanentCode 企业永久授权码
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
work(authCorpId, permanentCode) {
|
|
124
|
+
return new Application_2.default(authCorpId, permanentCode, this);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.default = OpenWork;
|
|
128
|
+
;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseAccessToken from '../../Core/BaseAccessToken';
|
|
2
|
+
export default class ProviderAccessToken extends BaseAccessToken {
|
|
3
|
+
protected requestMethod: string;
|
|
4
|
+
protected tokenKey: string;
|
|
5
|
+
protected endpointToGetToken: string;
|
|
6
|
+
protected cachePrefix: string;
|
|
7
|
+
protected getCredentials(): Promise<object>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseAccessToken_1 = __importDefault(require("../../Core/BaseAccessToken"));
|
|
16
|
+
class ProviderAccessToken extends BaseAccessToken_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.requestMethod = 'POST';
|
|
20
|
+
this.tokenKey = 'provider_access_token';
|
|
21
|
+
this.endpointToGetToken = 'cgi-bin/service/get_provider_token';
|
|
22
|
+
this.cachePrefix = 'easywechat.kernel.provider_access_token.';
|
|
23
|
+
}
|
|
24
|
+
getCredentials() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return {
|
|
27
|
+
corpid: this.app.config.corp_id,
|
|
28
|
+
provider_secret: this.app.config.secret,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = ProviderAccessToken;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseAccessToken from '../../Core/BaseAccessToken';
|
|
2
|
+
export default class SuiteAccessToken extends BaseAccessToken {
|
|
3
|
+
protected requestMethod: string;
|
|
4
|
+
protected tokenKey: string;
|
|
5
|
+
protected endpointToGetToken: string;
|
|
6
|
+
protected cachePrefix: string;
|
|
7
|
+
protected getCredentials(): Promise<object>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseAccessToken_1 = __importDefault(require("../../Core/BaseAccessToken"));
|
|
16
|
+
class SuiteAccessToken extends BaseAccessToken_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.requestMethod = 'POST';
|
|
20
|
+
this.tokenKey = 'suite_access_token';
|
|
21
|
+
this.endpointToGetToken = 'cgi-bin/service/get_suite_token';
|
|
22
|
+
this.cachePrefix = 'easywechat.kernel.suite_access_token.';
|
|
23
|
+
}
|
|
24
|
+
getCredentials() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return {
|
|
27
|
+
suite_id: this.app.config.suite_id,
|
|
28
|
+
suite_secret: this.app.config.suite_secret,
|
|
29
|
+
suite_ticket: yield this.app['suite_ticket'].getTicket(),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = SuiteAccessToken;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseApplication from '../../Core/BaseApplication';
|
|
2
|
+
export default class SuiteTicket {
|
|
3
|
+
protected app: BaseApplication;
|
|
4
|
+
constructor(app: BaseApplication);
|
|
5
|
+
setTicket(ticket: string): Promise<this>;
|
|
6
|
+
getTicket(): Promise<string>;
|
|
7
|
+
protected getCacheKey(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
class SuiteTicket {
|
|
13
|
+
constructor(app) {
|
|
14
|
+
this.app = null;
|
|
15
|
+
this.app = app;
|
|
16
|
+
}
|
|
17
|
+
setTicket(ticket) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
let cacher = this.app.getCache();
|
|
20
|
+
yield cacher.set(this.getCacheKey(), ticket, 3600);
|
|
21
|
+
if (!(yield cacher.has(this.getCacheKey()))) {
|
|
22
|
+
throw new Error('Failed to cache suite ticket.');
|
|
23
|
+
}
|
|
24
|
+
return this;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getTicket() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
let cached = yield this.app.getCache().get(this.getCacheKey());
|
|
30
|
+
if (cached) {
|
|
31
|
+
return cached;
|
|
32
|
+
}
|
|
33
|
+
throw new Error('Credential "suite_ticket" does not exist in cache.');
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getCacheKey() {
|
|
37
|
+
return 'easywechat.open_work.suite_ticket.' + this.app.config.suite_id;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = SuiteTicket;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class CorpClient extends BaseClient {
|
|
3
|
+
constructor(app: any);
|
|
4
|
+
/**
|
|
5
|
+
* 企业授权应用
|
|
6
|
+
* @see https://developer.work.weixin.qq.com/document/path/90597
|
|
7
|
+
* @param preAuthCode
|
|
8
|
+
* @param redirectUri
|
|
9
|
+
* @param state
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
getPreAuthorizationUrl(preAuthCode?: string, redirectUri?: string, state?: string): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* 获取预授权码
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getPreAuthCode(): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* 设置授权配置
|
|
20
|
+
* @see https://developer.work.weixin.qq.com/document/path/90602
|
|
21
|
+
* @param preAuthCode
|
|
22
|
+
* @param sessionInfo
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
setSession(preAuthCode: string, sessionInfo: object): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* 获取企业永久授权码
|
|
28
|
+
* @see https://developer.work.weixin.qq.com/document/path/90603
|
|
29
|
+
* @param authCode
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
getPermanentByCode(authCode: string): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* 获取企业授权信息
|
|
35
|
+
* @see https://developer.work.weixin.qq.com/document/path/90604
|
|
36
|
+
* @param authCorpId
|
|
37
|
+
* @param permanentCode
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
getAuthorization(authCorpId: string, permanentCode: string): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* 获取应用的管理员列表
|
|
43
|
+
* @see https://developer.work.weixin.qq.com/document/path/90606
|
|
44
|
+
* @param authCorpId
|
|
45
|
+
* @param agentId
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getManagers(authCorpId: string, agentId: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* 构造第三方应用oauth2链接
|
|
51
|
+
* @see https://developer.work.weixin.qq.com/document/path/91120
|
|
52
|
+
* @param redirectUri
|
|
53
|
+
* @param scope
|
|
54
|
+
* @param state
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
getOAuthRedirectUrl(redirectUri?: string, scope?: string, state?: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* 获取访问用户身份
|
|
60
|
+
* @see https://developer.work.weixin.qq.com/document/path/91121
|
|
61
|
+
* @param code
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
getUserByCode(code: string): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取访问用户敏感信息
|
|
67
|
+
* @see https://developer.work.weixin.qq.com/document/path/91122
|
|
68
|
+
* @param userTicket
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
getUserByTicket(userTicket: string): Promise<any>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
16
|
+
const Utils_1 = require("../../Core/Utils");
|
|
17
|
+
class CorpClient extends BaseClient_1.default {
|
|
18
|
+
constructor(app) {
|
|
19
|
+
super(app, app['suite_access_token']);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 企业授权应用
|
|
23
|
+
* @see https://developer.work.weixin.qq.com/document/path/90597
|
|
24
|
+
* @param preAuthCode
|
|
25
|
+
* @param redirectUri
|
|
26
|
+
* @param state
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
getPreAuthorizationUrl(preAuthCode = '', redirectUri = '', state = '') {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!redirectUri)
|
|
32
|
+
redirectUri = this.app.config.redirect_uri_install;
|
|
33
|
+
if (!preAuthCode) {
|
|
34
|
+
let res = yield this.getPreAuthCode();
|
|
35
|
+
preAuthCode = res['pre_auth_code'];
|
|
36
|
+
}
|
|
37
|
+
if (!state)
|
|
38
|
+
state = (0, Utils_1.randomString)(32);
|
|
39
|
+
let params = {
|
|
40
|
+
suite_id: this.app.config.suite_id,
|
|
41
|
+
redirect_uri: redirectUri,
|
|
42
|
+
pre_auth_code: preAuthCode,
|
|
43
|
+
state,
|
|
44
|
+
};
|
|
45
|
+
return 'https://open.work.weixin.qq.com/3rdapp/install?' + (0, Utils_1.buildQueryString)(params);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 获取预授权码
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
getPreAuthCode() {
|
|
53
|
+
return this.httpGet('cgi-bin/service/get_pre_auth_code');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 设置授权配置
|
|
57
|
+
* @see https://developer.work.weixin.qq.com/document/path/90602
|
|
58
|
+
* @param preAuthCode
|
|
59
|
+
* @param sessionInfo
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
setSession(preAuthCode, sessionInfo) {
|
|
63
|
+
return this.httpPostJson('cgi-bin/service/set_session_info', {
|
|
64
|
+
pre_auth_code: preAuthCode,
|
|
65
|
+
session_info: sessionInfo,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 获取企业永久授权码
|
|
70
|
+
* @see https://developer.work.weixin.qq.com/document/path/90603
|
|
71
|
+
* @param authCode
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
getPermanentByCode(authCode) {
|
|
75
|
+
return this.httpPostJson('cgi-bin/service/get_permanent_code', {
|
|
76
|
+
auth_code: authCode,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 获取企业授权信息
|
|
81
|
+
* @see https://developer.work.weixin.qq.com/document/path/90604
|
|
82
|
+
* @param authCorpId
|
|
83
|
+
* @param permanentCode
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
getAuthorization(authCorpId, permanentCode) {
|
|
87
|
+
return this.httpPostJson('cgi-bin/service/get_auth_info', {
|
|
88
|
+
auth_corpid: authCorpId,
|
|
89
|
+
permanent_code: permanentCode,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 获取应用的管理员列表
|
|
94
|
+
* @see https://developer.work.weixin.qq.com/document/path/90606
|
|
95
|
+
* @param authCorpId
|
|
96
|
+
* @param agentId
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
getManagers(authCorpId, agentId) {
|
|
100
|
+
return this.httpPostJson('cgi-bin/service/get_admin_list', {
|
|
101
|
+
auth_corpid: authCorpId,
|
|
102
|
+
agentid: agentId,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 构造第三方应用oauth2链接
|
|
107
|
+
* @see https://developer.work.weixin.qq.com/document/path/91120
|
|
108
|
+
* @param redirectUri
|
|
109
|
+
* @param scope
|
|
110
|
+
* @param state
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
getOAuthRedirectUrl(redirectUri = '', scope = 'snsapi_userinfo', state = '') {
|
|
114
|
+
if (!redirectUri)
|
|
115
|
+
redirectUri = this.app.config.redirect_uri_oauth;
|
|
116
|
+
if (!state)
|
|
117
|
+
state = (0, Utils_1.randomString)(32);
|
|
118
|
+
let params = {
|
|
119
|
+
appid: this.app.config.suite_id,
|
|
120
|
+
redirect_uri: redirectUri,
|
|
121
|
+
response_type: 'code',
|
|
122
|
+
scope,
|
|
123
|
+
state,
|
|
124
|
+
};
|
|
125
|
+
return 'https://open.weixin.qq.com/connect/oauth2/authorize?' + (0, Utils_1.buildQueryString)(params);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 获取访问用户身份
|
|
129
|
+
* @see https://developer.work.weixin.qq.com/document/path/91121
|
|
130
|
+
* @param code
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
getUserByCode(code) {
|
|
134
|
+
return this.httpGet('cgi-bin/service/getuserinfo3rd', {
|
|
135
|
+
code,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 获取访问用户敏感信息
|
|
140
|
+
* @see https://developer.work.weixin.qq.com/document/path/91122
|
|
141
|
+
* @param userTicket
|
|
142
|
+
* @returns
|
|
143
|
+
*/
|
|
144
|
+
getUserByTicket(userTicket) {
|
|
145
|
+
return this.httpPostJson('cgi-bin/service/getuserdetail3rd', {
|
|
146
|
+
user_ticket: userTicket,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.default = CorpClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class MiniProgramClient extends BaseClient_1.default {
|
|
8
|
+
constructor(app) {
|
|
9
|
+
super(app, app['suite_access_token']);
|
|
10
|
+
}
|
|
11
|
+
session(code) {
|
|
12
|
+
return this.httpGet('cgi-bin/service/miniprogram/jscode2session', {
|
|
13
|
+
js_code: code,
|
|
14
|
+
grant_type: 'authorization_code',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = MiniProgramClient;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class ProviderClient extends BaseClient {
|
|
3
|
+
constructor(app: any);
|
|
4
|
+
/**
|
|
5
|
+
* 扫码授权登录 - 获取登录的地址
|
|
6
|
+
* @see https://developer.work.weixin.qq.com/document/path/91124
|
|
7
|
+
* @param redirectUri
|
|
8
|
+
* @param userType
|
|
9
|
+
* @param state
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
getLoginUrl(redirectUri?: string, userType?: string, state?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* 扫码授权登录 - 获取登录用户信息
|
|
15
|
+
* @param authCode
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
getLoginInfo(authCode: string): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取注册定制化URL - 推广二维码
|
|
21
|
+
* @see https://developer.work.weixin.qq.com/document/path/90578
|
|
22
|
+
* @param registerCode
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
getRegisterUri(registerCode?: string): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* 获取注册码 - 推广二维码
|
|
28
|
+
* @see https://developer.work.weixin.qq.com/document/path/90581
|
|
29
|
+
* @param corpName
|
|
30
|
+
* @param adminName
|
|
31
|
+
* @param adminMobile
|
|
32
|
+
* @param state
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
getRegisterCode(corpName?: string, adminName?: string, adminMobile?: string, state?: string): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* 查询注册状态
|
|
38
|
+
* @see https://developer.work.weixin.qq.com/document/path/90582
|
|
39
|
+
* @param registerCode
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
getRegisterInfo(registerCode: string): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* 设置授权应用可见范围
|
|
45
|
+
* @see https://developer.work.weixin.qq.com/document/path/90583
|
|
46
|
+
* @param accessToken
|
|
47
|
+
* @param agentId
|
|
48
|
+
* @param allowUser
|
|
49
|
+
* @param allowParty
|
|
50
|
+
* @param allowTag
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
setAgentScope(accessToken: string, agentId: string, allowUser?: string[], allowParty?: Array<string | number>, allowTag?: Array<string | number>): Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* 设置通讯录同步完成
|
|
56
|
+
* @see https://developer.work.weixin.qq.com/document/path/90584
|
|
57
|
+
* @param accessToken
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
contactSyncSuccess(accessToken: string): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* 通讯录单个搜索
|
|
63
|
+
* @see https://developer.work.weixin.qq.com/document/path/91844
|
|
64
|
+
* @param corpId
|
|
65
|
+
* @param queryWord
|
|
66
|
+
* @param agentId
|
|
67
|
+
* @param offset
|
|
68
|
+
* @param limit
|
|
69
|
+
* @param queryType
|
|
70
|
+
* @param fullMatchField
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
searchContact(corpId: string, queryWord: string, agentId: string | number, offset?: number, limit?: number, queryType?: number, fullMatchField?: number): Promise<any>;
|
|
74
|
+
/**
|
|
75
|
+
* 获取带参授权链接
|
|
76
|
+
* @see https://developer.work.weixin.qq.com/document/path/95436
|
|
77
|
+
* @param params
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
getCustomizedAuthUrl(params: object): Promise<any>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
16
|
+
const Utils_1 = require("../../Core/Utils");
|
|
17
|
+
class ProviderClient extends BaseClient_1.default {
|
|
18
|
+
constructor(app) {
|
|
19
|
+
super(app, app['provider_access_token']);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 扫码授权登录 - 获取登录的地址
|
|
23
|
+
* @see https://developer.work.weixin.qq.com/document/path/91124
|
|
24
|
+
* @param redirectUri
|
|
25
|
+
* @param userType
|
|
26
|
+
* @param state
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
getLoginUrl(redirectUri = '', userType = 'admin', state = '') {
|
|
30
|
+
if (!redirectUri)
|
|
31
|
+
redirectUri = this.app.config.redirect_uri_install;
|
|
32
|
+
if (!state)
|
|
33
|
+
state = (0, Utils_1.randomString)(32);
|
|
34
|
+
let params = {
|
|
35
|
+
appid: this.app.config.corp_id,
|
|
36
|
+
redirect_uri: redirectUri,
|
|
37
|
+
usertype: userType,
|
|
38
|
+
state,
|
|
39
|
+
};
|
|
40
|
+
return 'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?' + (0, Utils_1.buildQueryString)(params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 扫码授权登录 - 获取登录用户信息
|
|
44
|
+
* @param authCode
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
getLoginInfo(authCode) {
|
|
48
|
+
return this.httpPostJson('cgi-bin/service/get_login_info', {
|
|
49
|
+
auth_code: authCode,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 获取注册定制化URL - 推广二维码
|
|
54
|
+
* @see https://developer.work.weixin.qq.com/document/path/90578
|
|
55
|
+
* @param registerCode
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
getRegisterUri(registerCode = '') {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (!registerCode) {
|
|
61
|
+
let response = yield this.getRegisterCode();
|
|
62
|
+
if (!response || response.errcode || !response['register_code']) {
|
|
63
|
+
throw new Error('Fail to get register code');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let params = {
|
|
67
|
+
register_code: registerCode,
|
|
68
|
+
};
|
|
69
|
+
return 'https://open.work.weixin.qq.com/3rdservice/wework/register?' + (0, Utils_1.buildQueryString)(params);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 获取注册码 - 推广二维码
|
|
74
|
+
* @see https://developer.work.weixin.qq.com/document/path/90581
|
|
75
|
+
* @param corpName
|
|
76
|
+
* @param adminName
|
|
77
|
+
* @param adminMobile
|
|
78
|
+
* @param state
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
getRegisterCode(corpName = '', adminName = '', adminMobile = '', state = '') {
|
|
82
|
+
let params = {
|
|
83
|
+
template_id: this.app.config.reg_template_id,
|
|
84
|
+
};
|
|
85
|
+
if (corpName)
|
|
86
|
+
params['corp_name'] = corpName;
|
|
87
|
+
if (adminName)
|
|
88
|
+
params['admin_name'] = adminName;
|
|
89
|
+
if (adminMobile)
|
|
90
|
+
params['admin_mobile'] = adminMobile;
|
|
91
|
+
if (state)
|
|
92
|
+
params['state'] = state;
|
|
93
|
+
return this.httpPostJson('cgi-bin/service/get_register_code', params);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 查询注册状态
|
|
97
|
+
* @see https://developer.work.weixin.qq.com/document/path/90582
|
|
98
|
+
* @param registerCode
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
getRegisterInfo(registerCode) {
|
|
102
|
+
return this.httpPostJson('cgi-bin/service/get_register_info', {
|
|
103
|
+
register_code: registerCode,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 设置授权应用可见范围
|
|
108
|
+
* @see https://developer.work.weixin.qq.com/document/path/90583
|
|
109
|
+
* @param accessToken
|
|
110
|
+
* @param agentId
|
|
111
|
+
* @param allowUser
|
|
112
|
+
* @param allowParty
|
|
113
|
+
* @param allowTag
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
setAgentScope(accessToken, agentId, allowUser = [], allowParty = [], allowTag = []) {
|
|
117
|
+
return this.httpGet('cgi-bin/agent/set_scope', {
|
|
118
|
+
access_token: accessToken,
|
|
119
|
+
agentid: agentId,
|
|
120
|
+
allow_user: allowUser,
|
|
121
|
+
allow_party: allowParty,
|
|
122
|
+
allow_tag: allowTag,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 设置通讯录同步完成
|
|
127
|
+
* @see https://developer.work.weixin.qq.com/document/path/90584
|
|
128
|
+
* @param accessToken
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
contactSyncSuccess(accessToken) {
|
|
132
|
+
return this.httpGet('cgi-bin/sync/contact_sync_success', {
|
|
133
|
+
access_token: accessToken,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 通讯录单个搜索
|
|
138
|
+
* @see https://developer.work.weixin.qq.com/document/path/91844
|
|
139
|
+
* @param corpId
|
|
140
|
+
* @param queryWord
|
|
141
|
+
* @param agentId
|
|
142
|
+
* @param offset
|
|
143
|
+
* @param limit
|
|
144
|
+
* @param queryType
|
|
145
|
+
* @param fullMatchField
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
searchContact(corpId, queryWord, agentId, offset = 0, limit = 50, queryType = 0, fullMatchField = null) {
|
|
149
|
+
let params = {
|
|
150
|
+
auth_corpid: corpId,
|
|
151
|
+
query_word: queryWord,
|
|
152
|
+
agentid: agentId,
|
|
153
|
+
offset: offset,
|
|
154
|
+
limit: limit,
|
|
155
|
+
query_type: queryType,
|
|
156
|
+
};
|
|
157
|
+
if (fullMatchField != null) {
|
|
158
|
+
params['full_match_field'] = fullMatchField;
|
|
159
|
+
}
|
|
160
|
+
return this.httpGet('cgi-bin/service/contact/search', params);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 获取带参授权链接
|
|
164
|
+
* @see https://developer.work.weixin.qq.com/document/path/95436
|
|
165
|
+
* @param params
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
getCustomizedAuthUrl(params) {
|
|
169
|
+
return this.httpPostJson('cgi-bin/service/get_customized_auth_url', params);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.default = ProviderClient;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ServerGuard from '../../Core/ServerGuard';
|
|
2
|
+
export declare const EVENT_AUTHORIZED = "authorized";
|
|
3
|
+
export declare const EVENT_UNAUTHORIZED = "unauthorized";
|
|
4
|
+
export declare const EVENT_UPDATE_AUTHORIZED = "updateauthorized";
|
|
5
|
+
export declare const EVENT_COMPONENT_VERIFY_TICKET = "component_verify_ticket";
|
|
6
|
+
export declare const EVENT_THIRD_FAST_REGISTERED = "notify_third_fasteregister";
|
|
7
|
+
export default class OpenWorkGuard extends ServerGuard {
|
|
8
|
+
protected alwaysValidate: boolean;
|
|
9
|
+
validate(): Promise<this>;
|
|
10
|
+
protected shouldReturnRawResponse(): Promise<boolean>;
|
|
11
|
+
protected isSafeMode(): Promise<boolean>;
|
|
12
|
+
protected decryptMessage(message: object): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EVENT_THIRD_FAST_REGISTERED = exports.EVENT_COMPONENT_VERIFY_TICKET = exports.EVENT_UPDATE_AUTHORIZED = exports.EVENT_UNAUTHORIZED = exports.EVENT_AUTHORIZED = void 0;
|
|
16
|
+
const ServerGuard_1 = __importDefault(require("../../Core/ServerGuard"));
|
|
17
|
+
const Encryptor_1 = __importDefault(require("../../Core/Encryptor"));
|
|
18
|
+
exports.EVENT_AUTHORIZED = 'authorized';
|
|
19
|
+
exports.EVENT_UNAUTHORIZED = 'unauthorized';
|
|
20
|
+
exports.EVENT_UPDATE_AUTHORIZED = 'updateauthorized';
|
|
21
|
+
exports.EVENT_COMPONENT_VERIFY_TICKET = 'component_verify_ticket';
|
|
22
|
+
exports.EVENT_THIRD_FAST_REGISTERED = 'notify_third_fasteregister';
|
|
23
|
+
class OpenWorkGuard extends ServerGuard_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.alwaysValidate = true;
|
|
27
|
+
}
|
|
28
|
+
validate() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return this;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
shouldReturnRawResponse() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return (yield this.app['request'].get('echostr')) != null;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
isSafeMode() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
decryptMessage(message) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let encryptor = new Encryptor_1.default(message['ToUserName'], this.app.config.token, this.app.config.aes_key);
|
|
46
|
+
return encryptor.decrypt(message['Encrypt'], yield this.app['request'].get('msg_signature'), yield this.app['request'].get('nonce'), yield this.app['request'].get('timestamp'));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = OpenWorkGuard;
|
|
51
|
+
;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import OpenWorkApplication from '../Application';
|
|
2
|
+
import BaseApplication from '../../Work/Application';
|
|
3
|
+
export default class Work extends BaseApplication {
|
|
4
|
+
constructor(authCorpId: string, permanentCode: string, component: OpenWorkApplication, prepends?: Object);
|
|
5
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Application_1 = __importDefault(require("../../Work/Application"));
|
|
7
|
+
const AccessToken_1 = __importDefault(require("./Auth/AccessToken"));
|
|
8
|
+
const Utils_1 = require("../../Core/Utils");
|
|
9
|
+
class Work extends Application_1.default {
|
|
10
|
+
constructor(authCorpId, permanentCode, component, prepends = {}) {
|
|
11
|
+
let config = (0, Utils_1.merge)((0, Utils_1.merge)({}, component.getConfig()), {
|
|
12
|
+
corp_id: authCorpId,
|
|
13
|
+
});
|
|
14
|
+
super(config, (0, Utils_1.merge)((0, Utils_1.merge)({}, prepends), {
|
|
15
|
+
access_token: function (app) {
|
|
16
|
+
return new AccessToken_1.default(app, authCorpId, permanentCode, component);
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = Work;
|
|
22
|
+
;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseAccessToken from '../../../Core/BaseAccessToken';
|
|
2
|
+
import OpenWorkApplication from '../../Application';
|
|
3
|
+
import BaseApplicatioin from '../../../Core/BaseApplication';
|
|
4
|
+
export default class AccessToken extends BaseAccessToken {
|
|
5
|
+
protected requestMethod: string;
|
|
6
|
+
protected authCorpId: string;
|
|
7
|
+
protected permanentCode: string;
|
|
8
|
+
protected component: OpenWorkApplication;
|
|
9
|
+
constructor(app: BaseApplicatioin, authCorpId: string, permanentCode: string, component: OpenWorkApplication);
|
|
10
|
+
protected getCredentials(): Promise<object>;
|
|
11
|
+
getEndpoint(): Promise<string>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseAccessToken_1 = __importDefault(require("../../../Core/BaseAccessToken"));
|
|
16
|
+
const Utils_1 = require("../../../Core/Utils");
|
|
17
|
+
class AccessToken extends BaseAccessToken_1.default {
|
|
18
|
+
constructor(app, authCorpId, permanentCode, component) {
|
|
19
|
+
super(app);
|
|
20
|
+
this.requestMethod = 'POST';
|
|
21
|
+
this.authCorpId = '';
|
|
22
|
+
this.permanentCode = '';
|
|
23
|
+
this.component = null;
|
|
24
|
+
this.authCorpId = authCorpId;
|
|
25
|
+
this.permanentCode = permanentCode;
|
|
26
|
+
this.component = component;
|
|
27
|
+
}
|
|
28
|
+
getCredentials() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return {
|
|
31
|
+
auth_corpid: this.authCorpId,
|
|
32
|
+
permanent_code: this.permanentCode,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getEndpoint() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return 'cgi-bin/service/get_corp_token?' + (0, Utils_1.buildQueryString)({
|
|
39
|
+
suite_access_token: (yield this.component['suite_access_token'].getToken())['suite_access_token'],
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = AccessToken;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ServerGuard from '../../Core/ServerGuard';
|
|
2
2
|
export default class Guard extends ServerGuard {
|
|
3
|
-
|
|
3
|
+
validate(): Promise<this>;
|
|
4
4
|
protected isSafeMode(): Promise<boolean>;
|
|
5
5
|
protected shouldReturnRawResponse(): Promise<boolean>;
|
|
6
6
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import OfficialAccount from './OfficialAccount/Application';
|
|
|
2
2
|
import BaseService from './BaseService/Application';
|
|
3
3
|
import MiniProgram from './MiniProgram/Application';
|
|
4
4
|
import OpenPlatform from './OpenPlatform/Application';
|
|
5
|
+
import OpenWork from './OpenWork/Application';
|
|
5
6
|
import Payment from './Payment/Application';
|
|
6
7
|
import Work from './Work/Application';
|
|
7
8
|
import MicroMerchant from './MicroMerchant/Application';
|
|
@@ -15,13 +16,14 @@ import * as Messages from './Core/Messages';
|
|
|
15
16
|
import { EasyWechatConfig } from './Core/Types';
|
|
16
17
|
/**
|
|
17
18
|
* 通用获取实例方法
|
|
18
|
-
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'Payment'
|
|
19
|
+
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'OpenWork' | 'Payment' | 'Work'
|
|
19
20
|
* @param config 对应的配置参数
|
|
20
21
|
*/
|
|
21
22
|
declare function getInstance(service: 'OfficialAccount', config?: EasyWechatConfig): OfficialAccount;
|
|
22
23
|
declare function getInstance(service: 'BaseService', config?: EasyWechatConfig): BaseService;
|
|
23
24
|
declare function getInstance(service: 'MiniProgram', config?: EasyWechatConfig): MiniProgram;
|
|
24
25
|
declare function getInstance(service: 'OpenPlatform', config?: EasyWechatConfig): OpenPlatform;
|
|
26
|
+
declare function getInstance(service: 'OpenWork', config?: EasyWechatConfig): OpenWork;
|
|
25
27
|
declare function getInstance(service: 'Payment', config?: EasyWechatConfig): Payment;
|
|
26
28
|
declare function getInstance(service: 'Work', config?: EasyWechatConfig): Work;
|
|
27
29
|
declare function getInstance(service: 'MicroMerchant', config?: EasyWechatConfig): MicroMerchant;
|
|
@@ -46,6 +48,10 @@ declare class EasyWechat {
|
|
|
46
48
|
* 开放平台类
|
|
47
49
|
*/
|
|
48
50
|
OpenPlatform: typeof OpenPlatform;
|
|
51
|
+
/**
|
|
52
|
+
* 企业微信开放平台类
|
|
53
|
+
*/
|
|
54
|
+
OpenWork: typeof OpenWork;
|
|
49
55
|
/**
|
|
50
56
|
* 支付类
|
|
51
57
|
*/
|
|
@@ -60,7 +66,7 @@ declare class EasyWechat {
|
|
|
60
66
|
MicroMerchant: typeof MicroMerchant;
|
|
61
67
|
/**
|
|
62
68
|
* 通用获取实例方法
|
|
63
|
-
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'Payment'
|
|
69
|
+
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'OpenWork' | 'Payment' | 'Work'
|
|
64
70
|
* @param config 对应的配置参数
|
|
65
71
|
*/
|
|
66
72
|
getInstance: typeof getInstance;
|
package/dist/index.js
CHANGED
|
@@ -26,9 +26,10 @@ const Application_1 = __importDefault(require("./OfficialAccount/Application"));
|
|
|
26
26
|
const Application_2 = __importDefault(require("./BaseService/Application"));
|
|
27
27
|
const Application_3 = __importDefault(require("./MiniProgram/Application"));
|
|
28
28
|
const Application_4 = __importDefault(require("./OpenPlatform/Application"));
|
|
29
|
-
const Application_5 = __importDefault(require("./
|
|
30
|
-
const Application_6 = __importDefault(require("./
|
|
31
|
-
const Application_7 = __importDefault(require("./
|
|
29
|
+
const Application_5 = __importDefault(require("./OpenWork/Application"));
|
|
30
|
+
const Application_6 = __importDefault(require("./Payment/Application"));
|
|
31
|
+
const Application_7 = __importDefault(require("./Work/Application"));
|
|
32
|
+
const Application_8 = __importDefault(require("./MicroMerchant/Application"));
|
|
32
33
|
const CacheInterface_1 = __importDefault(require("./Core/Contracts/CacheInterface"));
|
|
33
34
|
const FinallResult_1 = __importDefault(require("./Core/Decorators/FinallResult"));
|
|
34
35
|
const TerminateResult_1 = __importDefault(require("./Core/Decorators/TerminateResult"));
|
|
@@ -62,9 +63,10 @@ class EasyWechat {
|
|
|
62
63
|
BaseService: Application_2.default,
|
|
63
64
|
MiniProgram: Application_3.default,
|
|
64
65
|
OpenPlatform: Application_4.default,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
OpenWork: Application_5.default,
|
|
67
|
+
Payment: Application_6.default,
|
|
68
|
+
Work: Application_7.default,
|
|
69
|
+
MicroMerchant: Application_8.default,
|
|
68
70
|
getInstance: getInstance,
|
|
69
71
|
};
|
|
70
72
|
this.CacheInterface = CacheInterface_1.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok","access_token":"moke-token","expires_in":7200},"lifeTime":
|
|
1
|
+
{"data":{"errcode":0,"errmsg":"ok","access_token":"moke-token","expires_in":7200},"lifeTime":1643310403}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok"},"lifeTime":
|
|
1
|
+
{"data":{"errcode":0,"errmsg":"ok"},"lifeTime":1643310403}
|