node-easywechat 2.8.1 → 2.9.1

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.
Files changed (67) hide show
  1. package/README.md +51 -4
  2. package/dist/Core/Http/Request.js +2 -2
  3. package/dist/Core/ServerGuard.d.ts +2 -2
  4. package/dist/Core/Types.d.ts +34 -4
  5. package/dist/MiniProgram/Application.d.ts +14 -0
  6. package/dist/MiniProgram/Application.js +35 -0
  7. package/dist/MiniProgram/Shop/AccoutClient.d.ts +25 -0
  8. package/dist/MiniProgram/Shop/AccoutClient.js +42 -0
  9. package/dist/MiniProgram/Shop/AftersaleClient.d.ts +22 -0
  10. package/dist/MiniProgram/Shop/AftersaleClient.js +35 -0
  11. package/dist/MiniProgram/Shop/BasicClient.d.ts +39 -0
  12. package/dist/MiniProgram/Shop/BasicClient.js +69 -0
  13. package/dist/MiniProgram/Shop/DeliveryClient.d.ts +20 -0
  14. package/dist/MiniProgram/Shop/DeliveryClient.js +32 -0
  15. package/dist/MiniProgram/Shop/OrderClient.d.ts +32 -0
  16. package/dist/MiniProgram/Shop/OrderClient.js +51 -0
  17. package/dist/MiniProgram/Shop/RegisterClient.d.ts +25 -0
  18. package/dist/MiniProgram/Shop/RegisterClient.js +43 -0
  19. package/dist/MiniProgram/Shop/SpuClient.d.ts +67 -0
  20. package/dist/MiniProgram/Shop/SpuClient.js +92 -0
  21. package/dist/OpenPlatform/Application.js +2 -2
  22. package/dist/OpenWork/Application.d.ts +37 -0
  23. package/dist/OpenWork/Application.js +128 -0
  24. package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +8 -0
  25. package/dist/OpenWork/Auth/ProviderAccessToken.js +33 -0
  26. package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +8 -0
  27. package/dist/OpenWork/Auth/SuiteAccessToken.js +34 -0
  28. package/dist/OpenWork/Auth/SuiteTicket.d.ts +8 -0
  29. package/dist/OpenWork/Auth/SuiteTicket.js +40 -0
  30. package/dist/OpenWork/Corp/CorpClient.d.ts +72 -0
  31. package/dist/OpenWork/Corp/CorpClient.js +150 -0
  32. package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +5 -0
  33. package/dist/OpenWork/MiniProgram/MiniProgramClient.js +18 -0
  34. package/dist/OpenWork/Provider/ProviderClient.d.ts +81 -0
  35. package/dist/OpenWork/Provider/ProviderClient.js +172 -0
  36. package/dist/OpenWork/Server/OpenWorkGuard.d.ts +13 -0
  37. package/dist/OpenWork/Server/OpenWorkGuard.js +51 -0
  38. package/dist/OpenWork/Work/Application.d.ts +5 -0
  39. package/dist/OpenWork/Work/Application.js +22 -0
  40. package/dist/OpenWork/Work/Auth/AccessToken.d.ts +12 -0
  41. package/dist/OpenWork/Work/Auth/AccessToken.js +44 -0
  42. package/dist/Work/Agent/WorkbenchClient.d.ts +24 -0
  43. package/dist/Work/Agent/WorkbenchClient.js +39 -0
  44. package/dist/Work/Application.d.ts +8 -0
  45. package/dist/Work/Application.js +20 -0
  46. package/dist/Work/CorpGroup/CorpGroupClient.d.ts +34 -0
  47. package/dist/Work/CorpGroup/CorpGroupClient.js +42 -0
  48. package/dist/Work/ExternalContact/Client.d.ts +11 -0
  49. package/dist/Work/ExternalContact/Client.js +16 -0
  50. package/dist/Work/ExternalContact/ContactWayClient.d.ts +37 -0
  51. package/dist/Work/ExternalContact/ContactWayClient.js +49 -0
  52. package/dist/Work/ExternalContact/MomentClient.d.ts +56 -3
  53. package/dist/Work/ExternalContact/MomentClient.js +62 -3
  54. package/dist/Work/ExternalContact/StatisticsClient.d.ts +24 -0
  55. package/dist/Work/ExternalContact/StatisticsClient.js +35 -0
  56. package/dist/Work/Kf/KfAccountClient.d.ts +41 -0
  57. package/dist/Work/Kf/KfAccountClient.js +71 -0
  58. package/dist/Work/Kf/KfMessageClient.d.ts +44 -0
  59. package/dist/Work/Kf/KfMessageClient.js +73 -0
  60. package/dist/Work/Kf/KfServicerClient.d.ts +26 -0
  61. package/dist/Work/Kf/KfServicerClient.js +47 -0
  62. package/dist/Work/Server/Guard.d.ts +1 -1
  63. package/dist/index.d.ts +8 -2
  64. package/dist/index.js +8 -6
  65. package/package.json +5 -5
  66. package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +0 -1
  67. package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +0 -1
package/README.md CHANGED
@@ -3,9 +3,11 @@
3
3
 
4
4
  [![Build Status](https://app.travis-ci.com/hpyer/node-easywechat.svg?branch=develop)](https://app.travis-ci.com/hpyer/node-easywechat) [![npm](https://img.shields.io/npm/v/node-easywechat.svg)](https://www.npmjs.com/package/node-easywechat) [![License](https://img.shields.io/npm/l/node-easywechat.svg)](LICENSE)
5
5
 
6
- **注:2.x分支针对 EasyWechat 的 5.x版本(由于4.x与5.x的结构基本一致,就不升级大版本了)。若您需要 EasyWechat 的 3.x版本,请切换到 [1.x](https://github.com/hpyer/node-easywechat/tree/1.x) 分支。**
6
+ **注:2.x分支针对 EasyWechat 的 5.x版本(由于4.x与5.x的结构基本一致,就不升级大版本了)。**
7
7
 
8
- [EasyWechat](https://github.com/overtrue/wechat) 是一个由 `安正超` 大神用 PHP 开发的开源的微信非官方 SDK。其功能强大,使用方便,个人一直很喜欢,所以近日将其在 Node.js 上实现。本人会尽量还原其配置项以及接口的调用方式,但毕竟语言环境不同,具体的实现方式会有些许差别,还请各位开发者见谅。
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
- protected validate(): Promise<this>;
39
- protected forceValidate(): this;
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>;
@@ -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
  * 服务端通知处理回调函数
@@ -21,6 +21,13 @@ import SoterClient from './Soter/SoterClient';
21
21
  import SubscribeMessageClient from './SubscribeMessage/SubscribeMessageClient';
22
22
  import RealtimeLogClient from './RealtimeLog/RealtimeLogClient';
23
23
  import SearchClient from './Search/SearchClient';
24
+ import ShopAccoutClient from './Shop/AccoutClient';
25
+ import ShopAftersaleClient from './Shop/AftersaleClient';
26
+ import ShopBasicClient from './Shop/BasicClient';
27
+ import ShopDeliveryClient from './Shop/DeliveryClient';
28
+ import ShopOrderClient from './Shop/OrderClient';
29
+ import ShopRegisterClient from './Shop/RegisterClient';
30
+ import ShopSpuClient from './Shop/SpuClient';
24
31
  import ShortLinkClient from './ShortLink/ShortLinkClient';
25
32
  import MediaClient from '../BaseService/Media/MediaClient';
26
33
  import ContentSecurityClient from '../BaseService/ContentSecurity/ContentSecurityClient';
@@ -54,6 +61,13 @@ export default class MiniProgram extends BaseApplication {
54
61
  subscribe_message: SubscribeMessageClient;
55
62
  realtime_log: RealtimeLogClient;
56
63
  search: SearchClient;
64
+ shop_account: ShopAccoutClient;
65
+ shop_aftersale: ShopAftersaleClient;
66
+ shop_basic: ShopBasicClient;
67
+ shop_delivery: ShopDeliveryClient;
68
+ shop_order: ShopOrderClient;
69
+ shop_register: ShopRegisterClient;
70
+ shop_spu: ShopSpuClient;
57
71
  short_link: ShortLinkClient;
58
72
  media: MediaClient;
59
73
  content_security: ContentSecurityClient;
@@ -35,6 +35,13 @@ const SoterClient_1 = __importDefault(require("./Soter/SoterClient"));
35
35
  const SubscribeMessageClient_1 = __importDefault(require("./SubscribeMessage/SubscribeMessageClient"));
36
36
  const RealtimeLogClient_1 = __importDefault(require("./RealtimeLog/RealtimeLogClient"));
37
37
  const SearchClient_1 = __importDefault(require("./Search/SearchClient"));
38
+ const AccoutClient_1 = __importDefault(require("./Shop/AccoutClient"));
39
+ const AftersaleClient_1 = __importDefault(require("./Shop/AftersaleClient"));
40
+ const BasicClient_1 = __importDefault(require("./Shop/BasicClient"));
41
+ const DeliveryClient_1 = __importDefault(require("./Shop/DeliveryClient"));
42
+ const OrderClient_1 = __importDefault(require("./Shop/OrderClient"));
43
+ const RegisterClient_1 = __importDefault(require("./Shop/RegisterClient"));
44
+ const SpuClient_1 = __importDefault(require("./Shop/SpuClient"));
38
45
  const ShortLinkClient_1 = __importDefault(require("./ShortLink/ShortLinkClient"));
39
46
  const MediaClient_1 = __importDefault(require("../BaseService/Media/MediaClient"));
40
47
  const ContentSecurityClient_1 = __importDefault(require("../BaseService/ContentSecurity/ContentSecurityClient"));
@@ -69,6 +76,13 @@ class MiniProgram extends BaseApplication_1.default {
69
76
  this.subscribe_message = null;
70
77
  this.realtime_log = null;
71
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;
72
86
  this.short_link = null;
73
87
  this.media = null;
74
88
  this.content_security = null;
@@ -165,6 +179,27 @@ class MiniProgram extends BaseApplication_1.default {
165
179
  this.offsetSet('search', function (app) {
166
180
  return new SearchClient_1.default(app);
167
181
  });
182
+ this.offsetSet('shop_account', function (app) {
183
+ return new AccoutClient_1.default(app);
184
+ });
185
+ this.offsetSet('shop_aftersale', function (app) {
186
+ return new AftersaleClient_1.default(app);
187
+ });
188
+ this.offsetSet('shop_basic', function (app) {
189
+ return new BasicClient_1.default(app);
190
+ });
191
+ this.offsetSet('shop_delivery', function (app) {
192
+ return new DeliveryClient_1.default(app);
193
+ });
194
+ this.offsetSet('shop_order', function (app) {
195
+ return new OrderClient_1.default(app);
196
+ });
197
+ this.offsetSet('shop_register', function (app) {
198
+ return new RegisterClient_1.default(app);
199
+ });
200
+ this.offsetSet('shop_spu', function (app) {
201
+ return new SpuClient_1.default(app);
202
+ });
168
203
  this.offsetSet('short_link', function (app) {
169
204
  return new ShortLinkClient_1.default(app);
170
205
  });
@@ -0,0 +1,25 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class AccountClient extends BaseClient {
3
+ /**
4
+ * 获取商家类目列表
5
+ * @returns
6
+ */
7
+ getCategoryList(): Promise<any>;
8
+ /**
9
+ * 获取商家品牌列表
10
+ * @returns
11
+ */
12
+ getBrandList(): Promise<any>;
13
+ /**
14
+ * 更新商家信息
15
+ * @param path 小程序path
16
+ * @param phone 客服联系方式
17
+ * @returns
18
+ */
19
+ updateInfo(path: string, phone: string): Promise<any>;
20
+ /**
21
+ * 获取商家信息
22
+ * @returns
23
+ */
24
+ getInfo(): Promise<any>;
25
+ }
@@ -0,0 +1,42 @@
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 AccountClient extends BaseClient_1.default {
8
+ /**
9
+ * 获取商家类目列表
10
+ * @returns
11
+ */
12
+ getCategoryList() {
13
+ return this.httpPostJson('shop/account/get_category_list');
14
+ }
15
+ /**
16
+ * 获取商家品牌列表
17
+ * @returns
18
+ */
19
+ getBrandList() {
20
+ return this.httpPostJson('shop/account/get_brand_list');
21
+ }
22
+ /**
23
+ * 更新商家信息
24
+ * @param path 小程序path
25
+ * @param phone 客服联系方式
26
+ * @returns
27
+ */
28
+ updateInfo(path, phone) {
29
+ return this.httpPostJson('shop/account/update_info', {
30
+ service_agent_path: path,
31
+ service_agent_phone: phone,
32
+ });
33
+ }
34
+ /**
35
+ * 获取商家信息
36
+ * @returns
37
+ */
38
+ getInfo() {
39
+ return this.httpPostJson('shop/account/get_info');
40
+ }
41
+ }
42
+ exports.default = AccountClient;
@@ -0,0 +1,22 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class AftersaleClient extends BaseClient {
3
+ /**
4
+ * 创建售后
5
+ * @param aftersale 售后数据
6
+ * @returns
7
+ */
8
+ add(aftersale: object): Promise<any>;
9
+ /**
10
+ * 获取订单下售后单
11
+ * @param order 订单数据
12
+ * @returns
13
+ */
14
+ get(order: object): Promise<any>;
15
+ /**
16
+ * 更新售后
17
+ * @param order 订单数据
18
+ * @param aftersale 售后数据
19
+ * @returns
20
+ */
21
+ update(order: object, aftersale: object): Promise<any>;
22
+ }
@@ -0,0 +1,35 @@
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
+ const Utils_1 = require("../../Core/Utils");
8
+ class AftersaleClient extends BaseClient_1.default {
9
+ /**
10
+ * 创建售后
11
+ * @param aftersale 售后数据
12
+ * @returns
13
+ */
14
+ add(aftersale) {
15
+ return this.httpPostJson('shop/aftersale/add', aftersale);
16
+ }
17
+ /**
18
+ * 获取订单下售后单
19
+ * @param order 订单数据
20
+ * @returns
21
+ */
22
+ get(order) {
23
+ return this.httpPostJson('shop/aftersale/get', order);
24
+ }
25
+ /**
26
+ * 更新售后
27
+ * @param order 订单数据
28
+ * @param aftersale 售后数据
29
+ * @returns
30
+ */
31
+ update(order, aftersale) {
32
+ return this.httpPostJson('shop/aftersale/update', (0, Utils_1.merge)((0, Utils_1.merge)({}, order), aftersale));
33
+ }
34
+ }
35
+ exports.default = AftersaleClient;
@@ -0,0 +1,39 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class BasicClient extends BaseClient {
3
+ /**
4
+ * 获取商品类目
5
+ * @returns
6
+ */
7
+ getCat(): Promise<any>;
8
+ /**
9
+ * 上传图片
10
+ * @param path
11
+ * @param respType
12
+ * @returns
13
+ */
14
+ imgUpload(path: string, respType?: number): Promise<any>;
15
+ /**
16
+ * 品牌审核
17
+ * @param brand
18
+ * @returns
19
+ */
20
+ auditBrand(brand: object): Promise<any>;
21
+ /**
22
+ * 类目审核
23
+ * @param category
24
+ * @returns
25
+ */
26
+ auditCategory(category: object): Promise<any>;
27
+ /**
28
+ * 获取审核结果
29
+ * @param auditId
30
+ * @returns
31
+ */
32
+ auditResult(auditId: string): Promise<any>;
33
+ /**
34
+ * 获取小程序资质
35
+ * @param reqType
36
+ * @returns
37
+ */
38
+ getMiniAppCertificate(reqType?: number): Promise<any>;
39
+ }
@@ -0,0 +1,69 @@
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 BasicClient extends BaseClient_1.default {
8
+ /**
9
+ * 获取商品类目
10
+ * @returns
11
+ */
12
+ getCat() {
13
+ return this.httpPostJson('shop/cat/get');
14
+ }
15
+ /**
16
+ * 上传图片
17
+ * @param path
18
+ * @param respType
19
+ * @returns
20
+ */
21
+ imgUpload(path, respType = 1) {
22
+ return this.httpUpload('customservice/kfaccount/uploadheadimg', {
23
+ media: path,
24
+ }, {
25
+ resp_type: respType,
26
+ });
27
+ }
28
+ /**
29
+ * 品牌审核
30
+ * @param brand
31
+ * @returns
32
+ */
33
+ auditBrand(brand) {
34
+ return this.httpPostJson('shop/audit/audit_brand', {
35
+ audit_req: brand,
36
+ });
37
+ }
38
+ /**
39
+ * 类目审核
40
+ * @param category
41
+ * @returns
42
+ */
43
+ auditCategory(category) {
44
+ return this.httpPostJson('shop/audit/audit_category', {
45
+ audit_req: category,
46
+ });
47
+ }
48
+ /**
49
+ * 获取审核结果
50
+ * @param auditId
51
+ * @returns
52
+ */
53
+ auditResult(auditId) {
54
+ return this.httpPostJson('shop/audit/result', {
55
+ audit_id: auditId,
56
+ });
57
+ }
58
+ /**
59
+ * 获取小程序资质
60
+ * @param reqType
61
+ * @returns
62
+ */
63
+ getMiniAppCertificate(reqType = 2) {
64
+ return this.httpPostJson('shop/audit/get_miniapp_certificate', {
65
+ req_type: reqType,
66
+ });
67
+ }
68
+ }
69
+ exports.default = BasicClient;
@@ -0,0 +1,20 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class DeliveryClient extends BaseClient {
3
+ /**
4
+ * 获取快递公司列表
5
+ * @returns
6
+ */
7
+ getCompanyList(): Promise<any>;
8
+ /**
9
+ * 订单发货
10
+ * @param order
11
+ * @returns
12
+ */
13
+ send(order: object): Promise<any>;
14
+ /**
15
+ * 订单确认收货
16
+ * @param order
17
+ * @returns
18
+ */
19
+ recieve(order: object): Promise<any>;
20
+ }
@@ -0,0 +1,32 @@
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 DeliveryClient extends BaseClient_1.default {
8
+ /**
9
+ * 获取快递公司列表
10
+ * @returns
11
+ */
12
+ getCompanyList() {
13
+ return this.httpPostJson('shop/delivery/get_company_list');
14
+ }
15
+ /**
16
+ * 订单发货
17
+ * @param order
18
+ * @returns
19
+ */
20
+ send(order) {
21
+ return this.httpPostJson('shop/delivery/send', order);
22
+ }
23
+ /**
24
+ * 订单确认收货
25
+ * @param order
26
+ * @returns
27
+ */
28
+ recieve(order) {
29
+ return this.httpPostJson('shop/delivery/recieve', order);
30
+ }
31
+ }
32
+ exports.default = DeliveryClient;
@@ -0,0 +1,32 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class OrderClient extends BaseClient {
3
+ /**
4
+ * 检查场景值是否在支付校验范围内
5
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/check_scene.html
6
+ * @param scene
7
+ * @returns
8
+ */
9
+ sceneCheck(scene: number): Promise<any>;
10
+ /**
11
+ * 生成订单
12
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/add_order.html
13
+ * @param order
14
+ * @returns
15
+ */
16
+ add(order: object): Promise<any>;
17
+ /**
18
+ * 获取订单详情
19
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/get_order.html
20
+ * @param openid 用户的openid
21
+ * @param orderIds {order_id, out_order_id} 二选一
22
+ * @returns
23
+ */
24
+ get(openid: string, orderIds: object): Promise<any>;
25
+ /**
26
+ * 同步订单支付结果
27
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/pay_order.html
28
+ * @param object
29
+ * @returns
30
+ */
31
+ pay(params: object): Promise<any>;
32
+ }
@@ -0,0 +1,51 @@
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
+ const Utils_1 = require("../../Core/Utils");
8
+ class OrderClient extends BaseClient_1.default {
9
+ /**
10
+ * 检查场景值是否在支付校验范围内
11
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/check_scene.html
12
+ * @param scene
13
+ * @returns
14
+ */
15
+ sceneCheck(scene) {
16
+ return this.httpPostJson('shop/scene/check', {
17
+ scene,
18
+ });
19
+ }
20
+ /**
21
+ * 生成订单
22
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/add_order.html
23
+ * @param order
24
+ * @returns
25
+ */
26
+ add(order) {
27
+ return this.httpPostJson('shop/order/add', order);
28
+ }
29
+ /**
30
+ * 获取订单详情
31
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/get_order.html
32
+ * @param openid 用户的openid
33
+ * @param orderIds {order_id, out_order_id} 二选一
34
+ * @returns
35
+ */
36
+ get(openid, orderIds) {
37
+ return this.httpPostJson('shop/order/get', (0, Utils_1.merge)((0, Utils_1.merge)({}, orderIds), {
38
+ openid,
39
+ }));
40
+ }
41
+ /**
42
+ * 同步订单支付结果
43
+ * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent2/API/order/pay_order.html
44
+ * @param object
45
+ * @returns
46
+ */
47
+ pay(params) {
48
+ return this.httpPostJson('shop/order/pay', params);
49
+ }
50
+ }
51
+ exports.default = OrderClient;
@@ -0,0 +1,25 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class RegisterClient extends BaseClient {
3
+ /**
4
+ * 接入申请
5
+ * @returns
6
+ */
7
+ apply(): Promise<any>;
8
+ /**
9
+ * 获取接入状态
10
+ * @returns
11
+ */
12
+ check(): Promise<any>;
13
+ /**
14
+ * 完成接入任务
15
+ * @param accessInfoItem 6:完成spu接口,7:完成订单接口,8:完成物流接口,9:完成售后接口,10:测试完成,11:发版完成
16
+ * @returns
17
+ */
18
+ finishAccessInfo(accessInfoItem: number): Promise<any>;
19
+ /**
20
+ * 场景接入申请
21
+ * @param sceneGroupId 1:视频号、公众号场景
22
+ * @returns
23
+ */
24
+ applyScene(sceneGroupId: number): Promise<any>;
25
+ }