node-easywechat 2.9.7 → 2.10.2
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/CHANGELOG.md +18 -1
- package/dist/BaseService/Application.js +0 -5
- package/dist/Core/Http/Request.d.ts +2 -1
- package/dist/Core/Http/Request.js +30 -33
- package/dist/Core/Utils.js +1 -1
- package/dist/MicroMerchant/Application.js +0 -6
- package/dist/MiniProgram/Application.js +0 -38
- package/dist/OfficialAccount/Application.js +0 -29
- package/dist/OpenPlatform/Application.js +0 -7
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.d.ts +6 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.js +12 -5
- package/dist/OpenPlatform/Authorizer/MiniProgram/Material/MaterialClient.d.ts +8 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Material/MaterialClient.js +45 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Privacy/PrivacyClient.d.ts +22 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Privacy/PrivacyClient.js +37 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Security/SecurityClient.d.ts +14 -0
- package/dist/OpenPlatform/Authorizer/MiniProgram/Security/SecurityClient.js +24 -0
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.js +0 -1
- package/dist/OpenWork/Application.js +0 -9
- package/dist/OpenWork/Corp/CorpClient.d.ts +9 -0
- package/dist/OpenWork/Corp/CorpClient.js +15 -0
- package/dist/Payment/Application.js +0 -15
- package/dist/Payment/Order/OrderClient.js +3 -1
- package/dist/Work/Application.d.ts +4 -0
- package/dist/Work/Application.js +8 -35
- package/dist/Work/ExternalContact/Client.d.ts +1 -0
- package/dist/Work/ExternalContact/Client.js +1 -0
- package/dist/Work/ExternalContact/InterceptClient.d.ts +30 -0
- package/dist/Work/ExternalContact/InterceptClient.js +48 -0
- package/dist/Work/ExternalContact/ProductClient.d.ts +39 -0
- package/dist/Work/ExternalContact/ProductClient.js +62 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## v2.10.2 (2022-05-25)
|
|
5
|
+
|
|
6
|
+
- Fix: 修复Http/Request对象传入xml时解析异常导致无法获取请求参数的问题(#27)
|
|
7
|
+
|
|
8
|
+
## v2.10.1 (2022-05-21)
|
|
9
|
+
|
|
10
|
+
## v2.10.0 (2022-05-18)
|
|
11
|
+
|
|
12
|
+
- Feat: 开放平台代理小程序新增申请隐私接口相关接口
|
|
13
|
+
- Feat: 开放平台代理小程序新增小程序用户隐私保护指引相关接口
|
|
14
|
+
- Feat: 开放平台代理小程序新增获取永久素材接口
|
|
15
|
+
- Feat: 企业微信新增商品图册相关接口
|
|
16
|
+
- Feat: 企业微信新增敏感词相关接口
|
|
17
|
+
- Feat: 新增新版企业微信开发平台根据unionid查询external_userid方法
|
|
18
|
+
|
|
19
|
+
- Fix: 企业微信注册敏感词管理、产品图册管理两个模块
|
|
20
|
+
|
|
4
21
|
## v2.9.7 (2022-05-16)
|
|
5
22
|
|
|
6
23
|
- Fix: 修复开放平台代理的小程序、公众号实例中没有开放平台专属API的问题 (#22)
|
|
7
24
|
|
|
8
|
-
## v2.9.6
|
|
25
|
+
## v2.9.6 (2022-05-16)
|
|
9
26
|
|
|
10
27
|
- Fix: 修复第三方平台获取代理的小程序、公众号实例后,无对应方法和token的 (#22)
|
|
11
28
|
|
|
@@ -16,11 +16,6 @@ class BaseService extends BaseApplication_1.default {
|
|
|
16
16
|
app_id: '',
|
|
17
17
|
secret: '',
|
|
18
18
|
};
|
|
19
|
-
this.jssdk = null;
|
|
20
|
-
this.media = null;
|
|
21
|
-
this.qrcode = null;
|
|
22
|
-
this.url = null;
|
|
23
|
-
this.content_security = null;
|
|
24
19
|
this.registerProviders();
|
|
25
20
|
}
|
|
26
21
|
registerProviders() {
|
|
@@ -17,7 +17,8 @@ export default class Request implements RequestInterface {
|
|
|
17
17
|
get(key: string): Promise<any>;
|
|
18
18
|
post(key: string): Promise<any>;
|
|
19
19
|
getAllGet(): object;
|
|
20
|
-
getAllPost(): object
|
|
20
|
+
getAllPost(): Promise<object>;
|
|
21
|
+
private _parseContent;
|
|
21
22
|
getContent(): Promise<Buffer>;
|
|
22
23
|
getUri(): string;
|
|
23
24
|
getContentType(): string;
|
|
@@ -42,22 +42,6 @@ class Request {
|
|
|
42
42
|
this._contentType = 'application/json';
|
|
43
43
|
}
|
|
44
44
|
else if (typeof content === 'string') {
|
|
45
|
-
try {
|
|
46
|
-
this._post = JSON.parse(content);
|
|
47
|
-
this._contentType = 'application/json';
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
if (content.substr(0, 1) === '<') {
|
|
51
|
-
(0, Utils_1.parseXml)(content).then(res => {
|
|
52
|
-
this._post = res;
|
|
53
|
-
this._contentType = 'text/xml';
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this._post = (0, Utils_1.parseQueryString)(content);
|
|
58
|
-
this._contentType = 'application/x-www-form-urlencoded';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
45
|
this._content = Buffer.from(content);
|
|
62
46
|
}
|
|
63
47
|
}
|
|
@@ -120,20 +104,8 @@ class Request {
|
|
|
120
104
|
throw new Error('Please set request first. app.rebind(\'request\', new EasyWechat.Request(ctx.req));');
|
|
121
105
|
if (this._method !== 'POST')
|
|
122
106
|
return null;
|
|
123
|
-
if (!this.
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
if (!this._post && this._content) {
|
|
127
|
-
let contentType = this._contentType.toLowerCase();
|
|
128
|
-
if (contentType.indexOf('application/json') > -1) {
|
|
129
|
-
try {
|
|
130
|
-
this._post = JSON.parse(this._content.toString());
|
|
131
|
-
}
|
|
132
|
-
catch (e) { }
|
|
133
|
-
}
|
|
134
|
-
else if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
135
|
-
this._post = (0, Utils_1.parseQueryString)(this._content.toString());
|
|
136
|
-
}
|
|
107
|
+
if (!this._post) {
|
|
108
|
+
yield this._parseContent();
|
|
137
109
|
}
|
|
138
110
|
return this._post && this._post[key] != undefined ? this._post[key] : null;
|
|
139
111
|
});
|
|
@@ -144,9 +116,34 @@ class Request {
|
|
|
144
116
|
return this._get;
|
|
145
117
|
}
|
|
146
118
|
getAllPost() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
if (!this.isValid)
|
|
121
|
+
throw new Error('Please set request first. app.rebind(\'request\', new EasyWechat.Request(ctx.req));');
|
|
122
|
+
if (!this._post) {
|
|
123
|
+
yield this._parseContent();
|
|
124
|
+
}
|
|
125
|
+
return this._post;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
_parseContent() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
let content = (yield this.getContent()).toString();
|
|
131
|
+
try {
|
|
132
|
+
this._post = JSON.parse(content);
|
|
133
|
+
this._contentType = 'application/json';
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
if ((content).substring(0, 1) === '<') {
|
|
137
|
+
let res = yield (0, Utils_1.parseXml)(content);
|
|
138
|
+
this._post = res;
|
|
139
|
+
this._contentType = 'text/xml';
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this._post = (0, Utils_1.parseQueryString)(content);
|
|
143
|
+
this._contentType = 'application/x-www-form-urlencoded';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
150
147
|
}
|
|
151
148
|
getContent() {
|
|
152
149
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/Core/Utils.js
CHANGED
|
@@ -23,12 +23,6 @@ class MicroMerchant extends BaseApplication_1.default {
|
|
|
23
23
|
baseURL: 'https://api.mch.weixin.qq.com/',
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
this.base = null;
|
|
27
|
-
this.certficates = null;
|
|
28
|
-
this.media = null;
|
|
29
|
-
this.merchantConfig = null;
|
|
30
|
-
this.material = null;
|
|
31
|
-
this.withdraw = null;
|
|
32
26
|
this.registerProviders();
|
|
33
27
|
}
|
|
34
28
|
registerProviders() {
|
|
@@ -54,44 +54,6 @@ const UnionClient_1 = __importDefault(require("./Union/UnionClient"));
|
|
|
54
54
|
class MiniProgram extends BaseApplication_1.default {
|
|
55
55
|
constructor(config = {}, prepends = {}, id = null) {
|
|
56
56
|
super(config, prepends, id);
|
|
57
|
-
this.access_token = null;
|
|
58
|
-
this.auth = null;
|
|
59
|
-
this.encryptor = null;
|
|
60
|
-
this.server = null;
|
|
61
|
-
this.data_cube = null;
|
|
62
|
-
this.app_code = null;
|
|
63
|
-
this.template_message = null;
|
|
64
|
-
this.customer_service = null;
|
|
65
|
-
this.uniform_message = null;
|
|
66
|
-
this.activity_message = null;
|
|
67
|
-
this.open_data = null;
|
|
68
|
-
this.phone_number = null;
|
|
69
|
-
this.plugin = null;
|
|
70
|
-
this.plugin_dev = null;
|
|
71
|
-
this.base = null;
|
|
72
|
-
this.express = null;
|
|
73
|
-
this.nearby_poi = null;
|
|
74
|
-
this.ocr = null;
|
|
75
|
-
this.soter = null;
|
|
76
|
-
this.subscribe_message = null;
|
|
77
|
-
this.realtime_log = null;
|
|
78
|
-
this.search = null;
|
|
79
|
-
this.shop_account = null;
|
|
80
|
-
this.shop_aftersale = null;
|
|
81
|
-
this.shop_basic = null;
|
|
82
|
-
this.shop_delivery = null;
|
|
83
|
-
this.shop_order = null;
|
|
84
|
-
this.shop_register = null;
|
|
85
|
-
this.shop_spu = null;
|
|
86
|
-
this.short_link = null;
|
|
87
|
-
this.media = null;
|
|
88
|
-
this.content_security = null;
|
|
89
|
-
this.url_link = null;
|
|
90
|
-
this.url_scheme = null;
|
|
91
|
-
this.risk_control = null;
|
|
92
|
-
this.live = null;
|
|
93
|
-
this.broadcast = null;
|
|
94
|
-
this.union = null;
|
|
95
57
|
this.registerProviders();
|
|
96
58
|
}
|
|
97
59
|
registerProviders() {
|
|
@@ -54,35 +54,6 @@ class OfficialAccount extends BaseApplication_1.default {
|
|
|
54
54
|
callback: '',
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
this.access_token = null;
|
|
58
|
-
this.encryptor = null;
|
|
59
|
-
this.server = null;
|
|
60
|
-
this.user = null;
|
|
61
|
-
this.user_tag = null;
|
|
62
|
-
this.oauth = null;
|
|
63
|
-
this.menu = null;
|
|
64
|
-
this.template_message = null;
|
|
65
|
-
this.subscribe_message = null;
|
|
66
|
-
this.material = null;
|
|
67
|
-
this.customer_service = null;
|
|
68
|
-
this.customer_service_session = null;
|
|
69
|
-
this.semantic = null;
|
|
70
|
-
this.data_cube = null;
|
|
71
|
-
this.poi = null;
|
|
72
|
-
this.auto_reply = null;
|
|
73
|
-
this.broadcasting = null;
|
|
74
|
-
this.card = null;
|
|
75
|
-
this.device = null;
|
|
76
|
-
this.shake_around = null;
|
|
77
|
-
this.store = null;
|
|
78
|
-
this.comment = null;
|
|
79
|
-
this.base = null;
|
|
80
|
-
this.ocr = null;
|
|
81
|
-
this.goods = null;
|
|
82
|
-
this.jssdk = null;
|
|
83
|
-
this.media = null;
|
|
84
|
-
this.qrcode = null;
|
|
85
|
-
this.url = null;
|
|
86
57
|
this.registerProviders();
|
|
87
58
|
}
|
|
88
59
|
registerProviders() {
|
|
@@ -30,13 +30,6 @@ const ComponentClient_1 = __importDefault(require("./Component/ComponentClient")
|
|
|
30
30
|
class OpenPlatform extends BaseApplication_1.default {
|
|
31
31
|
constructor(config = {}, prepends = {}, id = null) {
|
|
32
32
|
super(config, prepends, id);
|
|
33
|
-
this.verify_ticket = null;
|
|
34
|
-
this.access_token = null;
|
|
35
|
-
this.base = null;
|
|
36
|
-
this.encryptor = null;
|
|
37
|
-
this.server = null;
|
|
38
|
-
this.code_template = null;
|
|
39
|
-
this.component = null;
|
|
40
33
|
this.registerProviders();
|
|
41
34
|
}
|
|
42
35
|
registerProviders() {
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import BaseApplication from '../../../MiniProgram/Application';
|
|
2
2
|
import CodeClient from './Code/CodeClient';
|
|
3
3
|
import DomainClient from './Domain/DomainClient';
|
|
4
|
+
import MaterialClient from './Material/MaterialClient';
|
|
5
|
+
import PrivacyClient from './Privacy/PrivacyClient';
|
|
6
|
+
import SecurityClient from './Security/SecurityClient';
|
|
4
7
|
import AccountClient from './Account/AccountClient';
|
|
5
8
|
import SettingClient from './Setting/SettingClient';
|
|
6
9
|
import TesterClient from './Tester/TesterClient';
|
|
7
10
|
export default class MiniProgram extends BaseApplication {
|
|
8
11
|
code: CodeClient;
|
|
9
12
|
domain: DomainClient;
|
|
13
|
+
material: MaterialClient;
|
|
14
|
+
privacy: PrivacyClient;
|
|
15
|
+
security: SecurityClient;
|
|
10
16
|
account: AccountClient;
|
|
11
17
|
setting: SettingClient;
|
|
12
18
|
tester: TesterClient;
|
|
@@ -6,17 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const Application_1 = __importDefault(require("../../../MiniProgram/Application"));
|
|
7
7
|
const CodeClient_1 = __importDefault(require("./Code/CodeClient"));
|
|
8
8
|
const DomainClient_1 = __importDefault(require("./Domain/DomainClient"));
|
|
9
|
+
const MaterialClient_1 = __importDefault(require("./Material/MaterialClient"));
|
|
10
|
+
const PrivacyClient_1 = __importDefault(require("./Privacy/PrivacyClient"));
|
|
11
|
+
const SecurityClient_1 = __importDefault(require("./Security/SecurityClient"));
|
|
9
12
|
const AccountClient_1 = __importDefault(require("./Account/AccountClient"));
|
|
10
13
|
const SettingClient_1 = __importDefault(require("./Setting/SettingClient"));
|
|
11
14
|
const TesterClient_1 = __importDefault(require("./Tester/TesterClient"));
|
|
12
15
|
class MiniProgram extends Application_1.default {
|
|
13
16
|
constructor(config = {}, prepends = {}, id = null) {
|
|
14
17
|
super(config, prepends, id);
|
|
15
|
-
this.code = null;
|
|
16
|
-
this.domain = null;
|
|
17
|
-
this.account = null;
|
|
18
|
-
this.setting = null;
|
|
19
|
-
this.tester = null;
|
|
20
18
|
this.registerExtraProviders();
|
|
21
19
|
}
|
|
22
20
|
registerExtraProviders() {
|
|
@@ -26,6 +24,15 @@ class MiniProgram extends Application_1.default {
|
|
|
26
24
|
this.offsetSet('domain', function (app) {
|
|
27
25
|
return new DomainClient_1.default(app);
|
|
28
26
|
});
|
|
27
|
+
this.offsetSet('material', function (app) {
|
|
28
|
+
return new MaterialClient_1.default(app);
|
|
29
|
+
});
|
|
30
|
+
this.offsetSet('privacy', function (app) {
|
|
31
|
+
return new PrivacyClient_1.default(app);
|
|
32
|
+
});
|
|
33
|
+
this.offsetSet('security', function (app) {
|
|
34
|
+
return new SecurityClient_1.default(app);
|
|
35
|
+
});
|
|
29
36
|
this.offsetSet('account', function (app) {
|
|
30
37
|
return new AccountClient_1.default(app);
|
|
31
38
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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 StreamResponse_1 = __importDefault(require("../../../../Core/Http/StreamResponse"));
|
|
17
|
+
class MaterialClient extends BaseClient_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* 获取永久素材
|
|
20
|
+
* @param media_id 素材media_id
|
|
21
|
+
*/
|
|
22
|
+
get(media_id) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let res = yield this.requestRaw({
|
|
25
|
+
url: 'cgi-bin/material/get_material',
|
|
26
|
+
method: 'POST',
|
|
27
|
+
data: {
|
|
28
|
+
media_id,
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (res.getHeader('content-disposition').indexOf('attachment') > -1) {
|
|
32
|
+
return StreamResponse_1.default.buildFromResponse(res);
|
|
33
|
+
}
|
|
34
|
+
let content = res.getContent();
|
|
35
|
+
if (typeof content === 'string') {
|
|
36
|
+
try {
|
|
37
|
+
content = JSON.parse(content);
|
|
38
|
+
}
|
|
39
|
+
catch (e) { }
|
|
40
|
+
}
|
|
41
|
+
return content;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = MaterialClient;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import BaseClient from '../../../../Core/BaseClient';
|
|
3
|
+
import Stream from 'stream';
|
|
4
|
+
export default class PrivacyClient extends BaseClient {
|
|
5
|
+
/**
|
|
6
|
+
* 查询小程序用户隐私保护指引
|
|
7
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html
|
|
8
|
+
*/
|
|
9
|
+
get(): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 配置小程序用户隐私保护指引
|
|
12
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
|
|
13
|
+
* @param params
|
|
14
|
+
*/
|
|
15
|
+
set(params: object): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 上传小程序用户隐私保护指引
|
|
18
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html
|
|
19
|
+
* @param file 文件路径或可读stream
|
|
20
|
+
*/
|
|
21
|
+
upload(file: string | Stream.Readable): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 PrivacyClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 查询小程序用户隐私保护指引
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html
|
|
11
|
+
*/
|
|
12
|
+
get() {
|
|
13
|
+
return this.httpPostJson('cgi-bin/component/getprivacysetting');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 配置小程序用户隐私保护指引
|
|
17
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
set(params) {
|
|
21
|
+
return this.httpPostJson('wxa/setwebviewdomain', params);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 上传小程序用户隐私保护指引
|
|
25
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html
|
|
26
|
+
* @param file 文件路径或可读stream
|
|
27
|
+
*/
|
|
28
|
+
upload(file) {
|
|
29
|
+
if (!file) {
|
|
30
|
+
throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
|
|
31
|
+
}
|
|
32
|
+
return this.httpUpload('media/upload', {
|
|
33
|
+
media: file
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = PrivacyClient;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BaseClient from '../../../../Core/BaseClient';
|
|
2
|
+
export default class SecurityClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取接口列表
|
|
5
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
|
|
6
|
+
*/
|
|
7
|
+
get(): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* 申请接口
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
|
|
11
|
+
* @param params
|
|
12
|
+
*/
|
|
13
|
+
set(params: object): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 SecurityClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取接口列表
|
|
10
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
|
|
11
|
+
*/
|
|
12
|
+
get() {
|
|
13
|
+
return this.httpGet('wxa/security/get_privacy_interface');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 申请接口
|
|
17
|
+
* @see https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/apply_privacy_interface.html
|
|
18
|
+
* @param params
|
|
19
|
+
*/
|
|
20
|
+
set(params) {
|
|
21
|
+
return this.httpPostJson('wxa/security/apply_privacy_interface', params);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = SecurityClient;
|
|
@@ -8,7 +8,6 @@ const MiniProgramClient_1 = __importDefault(require("./MiniProgram/MiniProgramCl
|
|
|
8
8
|
class OfficialAccount extends Application_1.default {
|
|
9
9
|
constructor(config = {}, prepends = {}, id = null) {
|
|
10
10
|
super(config, prepends, id);
|
|
11
|
-
this.mini_program = null;
|
|
12
11
|
this.registerExtraProviders();
|
|
13
12
|
}
|
|
14
13
|
registerExtraProviders() {
|
|
@@ -35,15 +35,6 @@ class OpenWork extends BaseApplication_1.default {
|
|
|
35
35
|
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
36
36
|
},
|
|
37
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
38
|
this.registerProviders();
|
|
48
39
|
}
|
|
49
40
|
registerProviders() {
|
|
@@ -69,4 +69,13 @@ export default class CorpClient extends BaseClient {
|
|
|
69
69
|
* @returns
|
|
70
70
|
*/
|
|
71
71
|
getUserByTicket(userTicket: string): Promise<any>;
|
|
72
|
+
/**
|
|
73
|
+
* 第三方根据unionid查询external_userid
|
|
74
|
+
* @see https://developer.work.weixin.qq.com/document/path/95327
|
|
75
|
+
* @param unionid 微信用户的unionid
|
|
76
|
+
* @param openid 微信用户的openid
|
|
77
|
+
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
unionidToExternalUserid(unionid: string, openid: string, corpid?: string): Promise<any>;
|
|
72
81
|
}
|
|
@@ -146,5 +146,20 @@ class CorpClient extends BaseClient_1.default {
|
|
|
146
146
|
user_ticket: userTicket,
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* 第三方根据unionid查询external_userid
|
|
151
|
+
* @see https://developer.work.weixin.qq.com/document/path/95327
|
|
152
|
+
* @param unionid 微信用户的unionid
|
|
153
|
+
* @param openid 微信用户的openid
|
|
154
|
+
* @param corpid 需要换取的企业corpid,不填则拉取所有企业
|
|
155
|
+
* @returns
|
|
156
|
+
*/
|
|
157
|
+
unionidToExternalUserid(unionid, openid, corpid = '') {
|
|
158
|
+
return this.httpPostJson('cgi-bin/service/externalcontact/unionid_to_external_userid_3rd', {
|
|
159
|
+
unionid,
|
|
160
|
+
openid,
|
|
161
|
+
corpid,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
149
164
|
}
|
|
150
165
|
exports.default = CorpClient;
|
|
@@ -44,21 +44,6 @@ class Payment extends BaseApplication_1.default {
|
|
|
44
44
|
baseURL: 'https://api.mch.weixin.qq.com/',
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
-
this.base = null;
|
|
48
|
-
this.bill = null;
|
|
49
|
-
this.coupon = null;
|
|
50
|
-
this.jssdk = null;
|
|
51
|
-
this.merchant = null;
|
|
52
|
-
this.order = null;
|
|
53
|
-
this.redpack = null;
|
|
54
|
-
this.refund = null;
|
|
55
|
-
this.reverse = null;
|
|
56
|
-
this.sandbox = null;
|
|
57
|
-
this.transfer = null;
|
|
58
|
-
this.security = null;
|
|
59
|
-
this.profit_sharing = null;
|
|
60
|
-
this.access_token = null;
|
|
61
|
-
this.url = null;
|
|
62
47
|
this.registerProviders();
|
|
63
48
|
}
|
|
64
49
|
registerProviders() {
|
|
@@ -26,7 +26,9 @@ class OrderClient extends BaseClient_1.default {
|
|
|
26
26
|
params['spbill_create_ip'] = 'NATIVE' === params['trade_type'] ? yield this.getServerIp() : this.getClientIp();
|
|
27
27
|
}
|
|
28
28
|
params['appid'] = this.app.config.app_id;
|
|
29
|
-
params['notify_url']
|
|
29
|
+
if (!params['notify_url']) {
|
|
30
|
+
params['notify_url'] = this.app.config.notify_url;
|
|
31
|
+
}
|
|
30
32
|
if (isContract) {
|
|
31
33
|
params['contract_appid'] = this.app.config.app_id;
|
|
32
34
|
params['contract_mchid'] = this.app.config.mch_id;
|
|
@@ -32,6 +32,8 @@ import ExternalGroupChatWayClient from './ExternalContact/GroupChatWayClient';
|
|
|
32
32
|
import ExternalStatisticsClient from './ExternalContact/StatisticsClient';
|
|
33
33
|
import ExternalMessageClient from './ExternalContact/MessageClient';
|
|
34
34
|
import ExternalMessageTemplateClient from './ExternalContact/MessageTemplateClient';
|
|
35
|
+
import ExternalInterceptClient from './ExternalContact/InterceptClient';
|
|
36
|
+
import ExternalProductClient from './ExternalContact/ProductClient';
|
|
35
37
|
import ExternalSchoolClient from './ExternalContact/SchoolClient';
|
|
36
38
|
import ExternalMomentClient from './ExternalContact/MomentClient';
|
|
37
39
|
import CorpGroupClient from './CorpGroup/CorpGroupClient';
|
|
@@ -53,6 +55,8 @@ export default class Work extends BaseApplication {
|
|
|
53
55
|
external_contact_statistics: ExternalStatisticsClient;
|
|
54
56
|
external_contact_message: ExternalMessageClient;
|
|
55
57
|
external_contact_message_template: ExternalMessageTemplateClient;
|
|
58
|
+
external_contact_intercept: ExternalInterceptClient;
|
|
59
|
+
external_contact_product: ExternalProductClient;
|
|
56
60
|
school: ExternalSchoolClient;
|
|
57
61
|
external_contact_moment: ExternalMomentClient;
|
|
58
62
|
group_robot: GroupRobotClient;
|
package/dist/Work/Application.js
CHANGED
|
@@ -46,6 +46,8 @@ const GroupChatWayClient_1 = __importDefault(require("./ExternalContact/GroupCha
|
|
|
46
46
|
const StatisticsClient_1 = __importDefault(require("./ExternalContact/StatisticsClient"));
|
|
47
47
|
const MessageClient_2 = __importDefault(require("./ExternalContact/MessageClient"));
|
|
48
48
|
const MessageTemplateClient_1 = __importDefault(require("./ExternalContact/MessageTemplateClient"));
|
|
49
|
+
const InterceptClient_1 = __importDefault(require("./ExternalContact/InterceptClient"));
|
|
50
|
+
const ProductClient_1 = __importDefault(require("./ExternalContact/ProductClient"));
|
|
49
51
|
const SchoolClient_1 = __importDefault(require("./ExternalContact/SchoolClient"));
|
|
50
52
|
const MomentClient_1 = __importDefault(require("./ExternalContact/MomentClient"));
|
|
51
53
|
const CorpGroupClient_1 = __importDefault(require("./CorpGroup/CorpGroupClient"));
|
|
@@ -58,41 +60,6 @@ class Work extends BaseApplication_1.default {
|
|
|
58
60
|
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
59
61
|
},
|
|
60
62
|
};
|
|
61
|
-
this.oa = null;
|
|
62
|
-
this.access_token = null;
|
|
63
|
-
this.agent = null;
|
|
64
|
-
this.agent_workbench = null;
|
|
65
|
-
this.base = null;
|
|
66
|
-
this.calendar = null;
|
|
67
|
-
this.chat = null;
|
|
68
|
-
this.corp_group = null;
|
|
69
|
-
this.department = null;
|
|
70
|
-
this.external_contact = null;
|
|
71
|
-
this.contact_way = null;
|
|
72
|
-
this.group_chat_way = null;
|
|
73
|
-
this.external_contact_statistics = null;
|
|
74
|
-
this.external_contact_message = null;
|
|
75
|
-
this.external_contact_message_template = null;
|
|
76
|
-
this.school = null;
|
|
77
|
-
this.external_contact_moment = null;
|
|
78
|
-
this.group_robot = null;
|
|
79
|
-
this.group_robot_messenger = null;
|
|
80
|
-
this.invoice = null;
|
|
81
|
-
this.jssdk = null;
|
|
82
|
-
this.kf_account = null;
|
|
83
|
-
this.kf_message = null;
|
|
84
|
-
this.kf_servicer = null;
|
|
85
|
-
this.live = null;
|
|
86
|
-
this.media = null;
|
|
87
|
-
this.menu = null;
|
|
88
|
-
this.message = null;
|
|
89
|
-
this.messenger = null;
|
|
90
|
-
this.msg_audit = null;
|
|
91
|
-
this.encryptor = null;
|
|
92
|
-
this.server = null;
|
|
93
|
-
this.user = null;
|
|
94
|
-
this.tag = null;
|
|
95
|
-
this.oauth = null;
|
|
96
63
|
this.registerProviders();
|
|
97
64
|
}
|
|
98
65
|
registerProviders() {
|
|
@@ -144,6 +111,12 @@ class Work extends BaseApplication_1.default {
|
|
|
144
111
|
this.offsetSet('external_contact_message_template', function (app) {
|
|
145
112
|
return new MessageTemplateClient_1.default(app);
|
|
146
113
|
});
|
|
114
|
+
this.offsetSet('external_contact_intercept', function (app) {
|
|
115
|
+
return new InterceptClient_1.default(app);
|
|
116
|
+
});
|
|
117
|
+
this.offsetSet('external_contact_product', function (app) {
|
|
118
|
+
return new ProductClient_1.default(app);
|
|
119
|
+
});
|
|
147
120
|
this.offsetSet('school', function (app) {
|
|
148
121
|
return new SchoolClient_1.default(app);
|
|
149
122
|
});
|
|
@@ -196,6 +196,7 @@ export default class ExternalContactClient extends BaseClient {
|
|
|
196
196
|
finishExternalUseridMigration(corpid: string): Promise<any>;
|
|
197
197
|
/**
|
|
198
198
|
* unionid查询external_userid
|
|
199
|
+
* @deprecated 使用新方法 `(new EasyWechat.Factory.OpenWork).crop.unionidToExternalUserid()`
|
|
199
200
|
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
200
201
|
* @param unionid
|
|
201
202
|
* @param openid
|
|
@@ -321,6 +321,7 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* unionid查询external_userid
|
|
324
|
+
* @deprecated 使用新方法 `(new EasyWechat.Factory.OpenWork).crop.unionidToExternalUserid()`
|
|
324
325
|
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
325
326
|
* @param unionid
|
|
326
327
|
* @param openid
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class InterceptClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 新建敏感词规则
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#新建敏感词规则
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
create(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取敏感词规则列表
|
|
12
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则列表
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
gets(): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 获取敏感词规则详情
|
|
18
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则详情
|
|
19
|
+
* @param ruleId 规则id
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
getDetails(ruleId: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* 删除敏感词规则
|
|
25
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#删除敏感词规则
|
|
26
|
+
* @param ruleId
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
delete(ruleId: string): Promise<any>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 InterceptClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 新建敏感词规则
|
|
10
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#新建敏感词规则
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
create(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/externalcontact/add_intercept_rule', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取敏感词规则列表
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则列表
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
gets() {
|
|
23
|
+
return this.httpGet('cgi-bin/externalcontact/get_intercept_rule_list');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 获取敏感词规则详情
|
|
27
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#获取敏感词规则详情
|
|
28
|
+
* @param ruleId 规则id
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
getDetails(ruleId) {
|
|
32
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_intercept_rule', {
|
|
33
|
+
rule_id: ruleId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 删除敏感词规则
|
|
38
|
+
* @see https://developer.work.weixin.qq.com/document/path/95097#删除敏感词规则
|
|
39
|
+
* @param ruleId
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
delete(ruleId) {
|
|
43
|
+
return this.httpPostJson('cgi-bin/externalcontact/del_intercept_rule', {
|
|
44
|
+
rule_id: ruleId,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = InterceptClient;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class ProductClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 创建商品图册
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#创建商品图册
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
create(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取商品图册
|
|
12
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册
|
|
13
|
+
* @param productId 商品id
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
get(productId: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取商品图册列表
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册列表
|
|
20
|
+
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
|
21
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
getList(limit: number, cursor: string): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* 编辑商品图册
|
|
27
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#编辑商品图册
|
|
28
|
+
* @param params
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
update(params: object): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* 删除商品图册
|
|
34
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#删除商品图册
|
|
35
|
+
* @param productId 商品id
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
delete(productId: string): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 ProductClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 创建商品图册
|
|
10
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#创建商品图册
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
create(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/externalcontact/add_product_album', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取商品图册
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册
|
|
20
|
+
* @param productId 商品id
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
get(productId) {
|
|
24
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_product_album', {
|
|
25
|
+
product_id: productId,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 获取商品图册列表
|
|
30
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#获取商品图册列表
|
|
31
|
+
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
|
32
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
getList(limit, cursor) {
|
|
36
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_product_album_list', {
|
|
37
|
+
limit,
|
|
38
|
+
cursor,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 编辑商品图册
|
|
43
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#编辑商品图册
|
|
44
|
+
* @param params
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
update(params) {
|
|
48
|
+
return this.httpPostJson('cgi-bin/externalcontact/update_product_album', params);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 删除商品图册
|
|
52
|
+
* @see https://developer.work.weixin.qq.com/document/path/95096#删除商品图册
|
|
53
|
+
* @param productId 商品id
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
delete(productId) {
|
|
57
|
+
return this.httpPostJson('cgi-bin/externalcontact/delete_product_album', {
|
|
58
|
+
product_id: productId,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.default = ProductClient;
|