node-easywechat 2.7.2 → 2.8.3

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 (123) hide show
  1. package/dist/BaseService/Jssdk/JssdkClient.js +5 -5
  2. package/dist/BaseService/Media/MediaClient.js +1 -1
  3. package/dist/Core/AES.d.ts +1 -1
  4. package/dist/Core/AES.js +4 -4
  5. package/dist/Core/BaseAccessToken.js +2 -2
  6. package/dist/Core/BaseApplication.js +4 -4
  7. package/dist/Core/BaseClient.js +2 -2
  8. package/dist/Core/Cache/FileCache.js +3 -3
  9. package/dist/Core/Encryptor.js +3 -3
  10. package/dist/Core/Http/Request.js +11 -11
  11. package/dist/Core/Http/StreamResponse.js +1 -1
  12. package/dist/Core/Messages/Media.js +2 -2
  13. package/dist/Core/Messages/Message.js +7 -7
  14. package/dist/Core/Mixins/HttpMixin.js +4 -4
  15. package/dist/Core/ServerGuard.js +5 -5
  16. package/dist/Core/Utils.js +18 -18
  17. package/dist/MicroMerchant/Application.js +1 -1
  18. package/dist/MicroMerchant/Base/MicroMerchantBase.js +6 -6
  19. package/dist/MicroMerchant/Certficates/CertficatesClient.js +1 -1
  20. package/dist/MicroMerchant/Core/BaseClient.js +8 -8
  21. package/dist/MicroMerchant/Media/MediaClient.js +1 -1
  22. package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +1 -1
  23. package/dist/MicroMerchant/Meterial/MeterialClient.js +4 -4
  24. package/dist/MicroMerchant/Withdraw/WithdrawClient.js +2 -2
  25. package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +3 -3
  26. package/dist/MiniProgram/AppCode/AppCodeClient.js +2 -2
  27. package/dist/MiniProgram/Application.d.ts +20 -0
  28. package/dist/MiniProgram/Application.js +50 -0
  29. package/dist/MiniProgram/Base/MiniProgramBase.js +1 -1
  30. package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +3 -3
  31. package/dist/MiniProgram/OpenData/OpenDataClient.js +2 -2
  32. package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +10 -0
  33. package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +20 -0
  34. package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +1 -1
  35. package/dist/MiniProgram/Shop/AccoutClient.d.ts +25 -0
  36. package/dist/MiniProgram/Shop/AccoutClient.js +42 -0
  37. package/dist/MiniProgram/Shop/AftersaleClient.d.ts +22 -0
  38. package/dist/MiniProgram/Shop/AftersaleClient.js +35 -0
  39. package/dist/MiniProgram/Shop/BasicClient.d.ts +39 -0
  40. package/dist/MiniProgram/Shop/BasicClient.js +69 -0
  41. package/dist/MiniProgram/Shop/DeliveryClient.d.ts +20 -0
  42. package/dist/MiniProgram/Shop/DeliveryClient.js +32 -0
  43. package/dist/MiniProgram/Shop/OrderClient.d.ts +32 -0
  44. package/dist/MiniProgram/Shop/OrderClient.js +51 -0
  45. package/dist/MiniProgram/Shop/RegisterClient.d.ts +25 -0
  46. package/dist/MiniProgram/Shop/RegisterClient.js +43 -0
  47. package/dist/MiniProgram/Shop/SpuClient.d.ts +67 -0
  48. package/dist/MiniProgram/Shop/SpuClient.js +92 -0
  49. package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +11 -0
  50. package/dist/MiniProgram/ShortLink/ShortLinkClient.js +23 -0
  51. package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +5 -5
  52. package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +3 -3
  53. package/dist/MiniProgram/Union/UnionClient.d.ts +3 -0
  54. package/dist/MiniProgram/Union/UnionClient.js +9 -0
  55. package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +9 -0
  56. package/dist/MiniProgram/UrlLink/UrlLinkClient.js +17 -0
  57. package/dist/OfficialAccount/Base/OfficialAccountBase.js +2 -2
  58. package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +2 -2
  59. package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +1 -1
  60. package/dist/OfficialAccount/Card/Client.js +1 -1
  61. package/dist/OfficialAccount/Card/JssdkClient.js +2 -2
  62. package/dist/OfficialAccount/Card/MemberCardClient.js +1 -1
  63. package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +2 -2
  64. package/dist/OfficialAccount/CustomerService/Messenger.js +1 -1
  65. package/dist/OfficialAccount/DataCube/DataCubeClient.js +1 -1
  66. package/dist/OfficialAccount/Material/MaterialClient.js +2 -2
  67. package/dist/OfficialAccount/OCR/OCRClient.js +1 -1
  68. package/dist/OfficialAccount/Semantic/SemanticClient.js +1 -1
  69. package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +4 -4
  70. package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +4 -4
  71. package/dist/OpenPlatform/Application.js +7 -7
  72. package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +1 -1
  73. package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +1 -1
  74. package/dist/Payment/Application.js +4 -4
  75. package/dist/Payment/Bill/BillClient.js +2 -2
  76. package/dist/Payment/Core/BaseClient.js +8 -8
  77. package/dist/Payment/Jssdk/JssdkClient.d.ts +12 -0
  78. package/dist/Payment/Jssdk/JssdkClient.js +41 -9
  79. package/dist/Payment/Merchant/MerchantClient.js +1 -1
  80. package/dist/Payment/Notify/Handler.js +5 -5
  81. package/dist/Payment/Notify/Refunded.js +1 -1
  82. package/dist/Payment/Notify/Scanned.js +2 -2
  83. package/dist/Payment/Order/OrderClient.js +1 -1
  84. package/dist/Payment/Redpack/RedpackClient.js +5 -5
  85. package/dist/Payment/Refund/RefundClient.js +3 -3
  86. package/dist/Payment/Sandbox/SandboxClient.js +1 -1
  87. package/dist/Payment/Transfer/TransferClient.js +1 -1
  88. package/dist/Work/Agent/AgentClient.js +1 -1
  89. package/dist/Work/Agent/WorkbenchClient.d.ts +24 -0
  90. package/dist/Work/Agent/WorkbenchClient.js +39 -0
  91. package/dist/Work/Application.d.ts +8 -0
  92. package/dist/Work/Application.js +20 -0
  93. package/dist/Work/Calendar/CalendarClient.js +1 -1
  94. package/dist/Work/Chat/ChatClient.js +1 -1
  95. package/dist/Work/CorpGroup/CorpGroupClient.d.ts +34 -0
  96. package/dist/Work/CorpGroup/CorpGroupClient.js +42 -0
  97. package/dist/Work/Department/DepartmentClient.js +1 -1
  98. package/dist/Work/ExternalContact/Client.d.ts +202 -3
  99. package/dist/Work/ExternalContact/Client.js +244 -6
  100. package/dist/Work/ExternalContact/ContactWayClient.d.ts +37 -0
  101. package/dist/Work/ExternalContact/ContactWayClient.js +51 -2
  102. package/dist/Work/ExternalContact/MessageClient.d.ts +45 -0
  103. package/dist/Work/ExternalContact/MessageClient.js +90 -4
  104. package/dist/Work/ExternalContact/MessageTemplateClient.js +3 -3
  105. package/dist/Work/ExternalContact/MomentClient.d.ts +56 -3
  106. package/dist/Work/ExternalContact/MomentClient.js +62 -3
  107. package/dist/Work/ExternalContact/StatisticsClient.d.ts +24 -0
  108. package/dist/Work/ExternalContact/StatisticsClient.js +35 -0
  109. package/dist/Work/Jssdk/JssdkClient.js +3 -3
  110. package/dist/Work/Kf/KfAccountClient.d.ts +41 -0
  111. package/dist/Work/Kf/KfAccountClient.js +71 -0
  112. package/dist/Work/Kf/KfMessageClient.d.ts +44 -0
  113. package/dist/Work/Kf/KfMessageClient.js +73 -0
  114. package/dist/Work/Kf/KfServicerClient.d.ts +26 -0
  115. package/dist/Work/Kf/KfServicerClient.js +47 -0
  116. package/dist/Work/Media/MediaClient.js +1 -1
  117. package/dist/Work/Message/Messenger.js +2 -2
  118. package/dist/Work/Schedule/ScheduleClient.js +1 -1
  119. package/dist/Work/User/UserClient.js +3 -3
  120. package/dist/index.js +1 -1
  121. package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +1 -1
  122. package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +1 -1
  123. package/package.json +11 -11
@@ -21,7 +21,7 @@ class BaseClient extends BaseClient_1.default {
21
21
  httpUpload(url, files = {}, form = {}, query = {}, returnResponse = false) {
22
22
  let formData = new form_data_1.default;
23
23
  for (let name in files) {
24
- if (Utils_1.isString(files[name])) {
24
+ if ((0, Utils_1.isString)(files[name])) {
25
25
  formData.append(name, fs_1.default.createReadStream(files[name]));
26
26
  }
27
27
  else {
@@ -43,14 +43,14 @@ class BaseClient extends BaseClient_1.default {
43
43
  let base = {
44
44
  mch_id: this.app.config.mch_id,
45
45
  };
46
- let localParams = Utils_1.merge(Utils_1.merge(base, this.prepends()), params);
46
+ let localParams = (0, Utils_1.merge)((0, Utils_1.merge)(base, this.prepends()), params);
47
47
  let secretKey = yield this.app.getKey();
48
- localParams['sign'] = Utils_1.makeSignature(localParams, secretKey, localParams['sign_type'] || 'MD5');
49
- let payload = Utils_1.merge(Utils_1.merge({}, options), {
48
+ localParams['sign'] = (0, Utils_1.makeSignature)(localParams, secretKey, localParams['sign_type'] || 'MD5');
49
+ let payload = (0, Utils_1.merge)((0, Utils_1.merge)({}, options), {
50
50
  url: endpoint,
51
51
  method,
52
52
  responseType: 'text',
53
- data: Utils_1.buildXml(localParams)
53
+ data: (0, Utils_1.buildXml)(localParams)
54
54
  });
55
55
  let response = yield this.doRequest(payload);
56
56
  if (returnResponse) {
@@ -59,7 +59,7 @@ class BaseClient extends BaseClient_1.default {
59
59
  else {
60
60
  let body = response.data;
61
61
  try {
62
- body = yield Utils_1.parseXml(body);
62
+ body = yield (0, Utils_1.parseXml)(body);
63
63
  }
64
64
  catch (e) { }
65
65
  return body;
@@ -77,11 +77,11 @@ class BaseClient extends BaseClient_1.default {
77
77
  }
78
78
  let rsa = new RSA_1.default;
79
79
  rsa.setPublicKey(certificate);
80
- let newParams = Utils_1.merge({}, params);
80
+ let newParams = (0, Utils_1.merge)({}, params);
81
81
  newParams['cert_sn'] = serial_no;
82
82
  let sensitive_fields = this.getSensitiveFieldsName();
83
83
  for (let k in newParams) {
84
- if (Utils_1.inArray(k, sensitive_fields)) {
84
+ if ((0, Utils_1.inArray)(k, sensitive_fields)) {
85
85
  newParams[k] = rsa.encrypt(newParams[k]);
86
86
  }
87
87
  }
@@ -21,7 +21,7 @@ class MediaClient extends BaseClient_1.default {
21
21
  throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
22
22
  }
23
23
  let form = {
24
- media_hash: yield Utils_1.md5File(file),
24
+ media_hash: yield (0, Utils_1.md5File)(file),
25
25
  sign_type: 'HMAC-SHA256',
26
26
  };
27
27
  return this.httpUpload('secapi/mch/uploadmedia', {
@@ -11,7 +11,7 @@ class MerchantConfigClient extends BaseClient_1.default {
11
11
  sub_appid: subAppId,
12
12
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
13
13
  sign_type: 'HMAC-SHA256',
14
- nonce_str: Utils_1.randomString(18),
14
+ nonce_str: (0, Utils_1.randomString)(18),
15
15
  };
16
16
  if (subscribeAppId) {
17
17
  params['subscribe_appid'] = subscribeAppId;
@@ -7,22 +7,22 @@ const Utils_1 = require("../../Core/Utils");
7
7
  const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
8
8
  class MeterialClient extends BaseClient_1.default {
9
9
  setSettlementCard(params) {
10
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
10
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
11
11
  sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
12
12
  version: '1.0',
13
13
  cert_sn: '',
14
14
  sign_type: 'HMAC-SHA256',
15
- nonce_str: Utils_1.randomString(18),
15
+ nonce_str: (0, Utils_1.randomString)(18),
16
16
  }));
17
17
  return this.safeRequest('applyment/micro/modifyarchives', newParams);
18
18
  }
19
19
  updateContact(params) {
20
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
20
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
21
21
  sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
22
22
  version: '1.0',
23
23
  cert_sn: '',
24
24
  sign_type: 'HMAC-SHA256',
25
- nonce_str: Utils_1.randomString(18),
25
+ nonce_str: (0, Utils_1.randomString)(18),
26
26
  }));
27
27
  return this.safeRequest('applyment/micro/modifycontactinfo', newParams);
28
28
  }
@@ -11,7 +11,7 @@ class WithdrawClient extends BaseClient_1.default {
11
11
  date,
12
12
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
13
13
  sign_type: 'HMAC-SHA256',
14
- nonce_str: Utils_1.randomString(18),
14
+ nonce_str: (0, Utils_1.randomString)(18),
15
15
  };
16
16
  return this.safeRequest('fund/queryautowithdrawbydate', params);
17
17
  }
@@ -20,7 +20,7 @@ class WithdrawClient extends BaseClient_1.default {
20
20
  date,
21
21
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
22
22
  sign_type: 'HMAC-SHA256',
23
- nonce_str: Utils_1.randomString(18),
23
+ nonce_str: (0, Utils_1.randomString)(18),
24
24
  };
25
25
  return this.safeRequest('fund/reautowithdrawbydate', params);
26
26
  }
@@ -10,7 +10,7 @@ class ActivityMessageClient extends BaseClient_1.default {
10
10
  return this.httpGet('cgi-bin/message/wxopen/activityid/create');
11
11
  }
12
12
  updateMessage(activityId, state = 0, params = {}) {
13
- if (!Utils_1.inArray(state, [0, 1, '0', '1'])) {
13
+ if (!(0, Utils_1.inArray)(state, [0, 1, '0', '1'])) {
14
14
  throw new Error('"state" should be "0" or "1".');
15
15
  }
16
16
  params = {
@@ -25,10 +25,10 @@ class ActivityMessageClient extends BaseClient_1.default {
25
25
  formatParameters(params) {
26
26
  let formatted = [];
27
27
  for (let key in params) {
28
- if (Utils_1.inArray(key, ['member_count', 'room_limit', 'path', 'version_type'])) {
28
+ if ((0, Utils_1.inArray)(key, ['member_count', 'room_limit', 'path', 'version_type'])) {
29
29
  continue;
30
30
  }
31
- if (key === 'version_type' && !Utils_1.inArray(params[key], ['develop', 'trial', 'release'])) {
31
+ if (key === 'version_type' && !(0, Utils_1.inArray)(params[key], ['develop', 'trial', 'release'])) {
32
32
  throw new Error('Invalid value of attribute "version_type".');
33
33
  }
34
34
  formatted.push({
@@ -23,7 +23,7 @@ class AppCodeClient extends BaseClient_1.default {
23
23
  */
24
24
  get(path, optional = {}) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
- let params = Utils_1.merge({
26
+ let params = (0, Utils_1.merge)({
27
27
  path,
28
28
  }, optional);
29
29
  return yield this.getStream('wxa/getwxacode', params);
@@ -36,7 +36,7 @@ class AppCodeClient extends BaseClient_1.default {
36
36
  */
37
37
  getUnlimit(scene, optional = {}) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- let params = Utils_1.merge({
39
+ let params = (0, Utils_1.merge)({
40
40
  scene,
41
41
  }, optional);
42
42
  return yield this.getStream('wxa/getwxacodeunlimit', params);
@@ -10,6 +10,7 @@ import CustomerServiceClient from '../OfficialAccount/CustomerService/CustomerSe
10
10
  import UniformMessageClient from './UniformMessage/UniformMessageClient';
11
11
  import ActivityMessageClient from './ActivityMessage/ActivityMessageClient';
12
12
  import OpenDataClient from './OpenData/OpenDataClient';
13
+ import PhoneNumberClient from './PhoneNumber/PhoneNumberClient';
13
14
  import PluginClient from './Plugin/PluginClient';
14
15
  import PluginDevClient from './Plugin/PluginDevClient';
15
16
  import MiniProgramBase from './Base/MiniProgramBase';
@@ -20,9 +21,18 @@ import SoterClient from './Soter/SoterClient';
20
21
  import SubscribeMessageClient from './SubscribeMessage/SubscribeMessageClient';
21
22
  import RealtimeLogClient from './RealtimeLog/RealtimeLogClient';
22
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';
31
+ import ShortLinkClient from './ShortLink/ShortLinkClient';
23
32
  import MediaClient from '../BaseService/Media/MediaClient';
24
33
  import ContentSecurityClient from '../BaseService/ContentSecurity/ContentSecurityClient';
25
34
  import { EasyWechatConfig } from '../Core/Types';
35
+ import UrlLinkClient from './UrlLink/UrlLinkClient';
26
36
  import UrlSchemeClient from './UrlScheme/UrlSchemeClient';
27
37
  import RiskControlClient from './RiskControl/RiskControlClient';
28
38
  import LiveClient from './Live/LiveClient';
@@ -40,6 +50,7 @@ export default class MiniProgram extends BaseApplication {
40
50
  uniform_message: UniformMessageClient;
41
51
  activity_message: ActivityMessageClient;
42
52
  open_data: OpenDataClient;
53
+ phone_number: PhoneNumberClient;
43
54
  plugin: PluginClient;
44
55
  plugin_dev: PluginDevClient;
45
56
  base: MiniProgramBase;
@@ -50,8 +61,17 @@ export default class MiniProgram extends BaseApplication {
50
61
  subscribe_message: SubscribeMessageClient;
51
62
  realtime_log: RealtimeLogClient;
52
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;
71
+ short_link: ShortLinkClient;
53
72
  media: MediaClient;
54
73
  content_security: ContentSecurityClient;
74
+ url_link: UrlLinkClient;
55
75
  url_scheme: UrlSchemeClient;
56
76
  risk_control: RiskControlClient;
57
77
  live: LiveClient;
@@ -24,6 +24,7 @@ const CustomerServiceClient_1 = __importDefault(require("../OfficialAccount/Cust
24
24
  const UniformMessageClient_1 = __importDefault(require("./UniformMessage/UniformMessageClient"));
25
25
  const ActivityMessageClient_1 = __importDefault(require("./ActivityMessage/ActivityMessageClient"));
26
26
  const OpenDataClient_1 = __importDefault(require("./OpenData/OpenDataClient"));
27
+ const PhoneNumberClient_1 = __importDefault(require("./PhoneNumber/PhoneNumberClient"));
27
28
  const PluginClient_1 = __importDefault(require("./Plugin/PluginClient"));
28
29
  const PluginDevClient_1 = __importDefault(require("./Plugin/PluginDevClient"));
29
30
  const MiniProgramBase_1 = __importDefault(require("./Base/MiniProgramBase"));
@@ -34,8 +35,17 @@ const SoterClient_1 = __importDefault(require("./Soter/SoterClient"));
34
35
  const SubscribeMessageClient_1 = __importDefault(require("./SubscribeMessage/SubscribeMessageClient"));
35
36
  const RealtimeLogClient_1 = __importDefault(require("./RealtimeLog/RealtimeLogClient"));
36
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"));
45
+ const ShortLinkClient_1 = __importDefault(require("./ShortLink/ShortLinkClient"));
37
46
  const MediaClient_1 = __importDefault(require("../BaseService/Media/MediaClient"));
38
47
  const ContentSecurityClient_1 = __importDefault(require("../BaseService/ContentSecurity/ContentSecurityClient"));
48
+ const UrlLinkClient_1 = __importDefault(require("./UrlLink/UrlLinkClient"));
39
49
  const UrlSchemeClient_1 = __importDefault(require("./UrlScheme/UrlSchemeClient"));
40
50
  const RiskControlClient_1 = __importDefault(require("./RiskControl/RiskControlClient"));
41
51
  const LiveClient_1 = __importDefault(require("./Live/LiveClient"));
@@ -55,6 +65,7 @@ class MiniProgram extends BaseApplication_1.default {
55
65
  this.uniform_message = null;
56
66
  this.activity_message = null;
57
67
  this.open_data = null;
68
+ this.phone_number = null;
58
69
  this.plugin = null;
59
70
  this.plugin_dev = null;
60
71
  this.base = null;
@@ -65,8 +76,17 @@ class MiniProgram extends BaseApplication_1.default {
65
76
  this.subscribe_message = null;
66
77
  this.realtime_log = null;
67
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;
68
87
  this.media = null;
69
88
  this.content_security = null;
89
+ this.url_link = null;
70
90
  this.url_scheme = null;
71
91
  this.risk_control = null;
72
92
  this.live = null;
@@ -126,6 +146,9 @@ class MiniProgram extends BaseApplication_1.default {
126
146
  this.offsetSet('open_data', function (app) {
127
147
  return new OpenDataClient_1.default(app);
128
148
  });
149
+ this.offsetSet('phone_number', function (app) {
150
+ return new PhoneNumberClient_1.default(app);
151
+ });
129
152
  this.offsetSet('plugin', function (app) {
130
153
  return new PluginClient_1.default(app);
131
154
  });
@@ -156,6 +179,33 @@ class MiniProgram extends BaseApplication_1.default {
156
179
  this.offsetSet('search', function (app) {
157
180
  return new SearchClient_1.default(app);
158
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
+ });
203
+ this.offsetSet('short_link', function (app) {
204
+ return new ShortLinkClient_1.default(app);
205
+ });
206
+ this.offsetSet('url_link', function (app) {
207
+ return new UrlLinkClient_1.default(app);
208
+ });
159
209
  this.offsetSet('url_scheme', function (app) {
160
210
  return new UrlSchemeClient_1.default(app);
161
211
  });
@@ -12,7 +12,7 @@ class MiniProgramBase extends BaseClient_1.default {
12
12
  * @param optional 参数。transaction_id:支付交易号;mch_id:商户id;out_trade_no:商家订单号
13
13
  */
14
14
  getPaidUnionid(openid, optional = {}) {
15
- let params = Utils_1.merge({
15
+ let params = (0, Utils_1.merge)({
16
16
  openid,
17
17
  }, optional);
18
18
  return this.httpGet('wxa/getpaidunionid', params);
@@ -11,7 +11,7 @@ class NearbyPoiClient extends BaseClient_1.default {
11
11
  * @param params 地点信息
12
12
  */
13
13
  add(params = {}) {
14
- params = Utils_1.merge({
14
+ params = (0, Utils_1.merge)({
15
15
  is_comm_nearby: '1',
16
16
  poi_id: '',
17
17
  }, params);
@@ -23,7 +23,7 @@ class NearbyPoiClient extends BaseClient_1.default {
23
23
  * @param params 地点信息
24
24
  */
25
25
  update(poiId, params = {}) {
26
- params = Utils_1.merge({
26
+ params = (0, Utils_1.merge)({
27
27
  is_comm_nearby: '1',
28
28
  poi_id: poiId,
29
29
  }, params);
@@ -55,7 +55,7 @@ class NearbyPoiClient extends BaseClient_1.default {
55
55
  * @param status 0:不展示;1:展示
56
56
  */
57
57
  setVisibility(poiId = '', status) {
58
- if (!Utils_1.inArray(status, [0, 1, '0', '1'])) {
58
+ if (!(0, Utils_1.inArray)(status, [0, 1, '0', '1'])) {
59
59
  throw new Error('status should be 0 or 1.');
60
60
  }
61
61
  return this.httpPostJson('wxa/setnearbypoishowstatus', {
@@ -17,7 +17,7 @@ class OpenDataClient extends BaseClient_1.default {
17
17
  let query = {
18
18
  openid: openid,
19
19
  sig_method: 'hmac_sha256',
20
- signature: Utils_1.createHmac(JSON.stringify(data), sessionKey, 'sha256'),
20
+ signature: (0, Utils_1.createHmac)(JSON.stringify(data), sessionKey, 'sha256'),
21
21
  };
22
22
  return this.httpPostJson('remove_user_storage', data, query);
23
23
  }
@@ -28,7 +28,7 @@ class OpenDataClient extends BaseClient_1.default {
28
28
  let query = {
29
29
  openid: openid,
30
30
  sig_method: 'hmac_sha256',
31
- signature: Utils_1.createHmac(JSON.stringify(data), sessionKey, 'sha256'),
31
+ signature: (0, Utils_1.createHmac)(JSON.stringify(data), sessionKey, 'sha256'),
32
32
  };
33
33
  return this.httpPostJson('set_user_storage', data, query);
34
34
  }
@@ -0,0 +1,10 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class PhoneNumber extends BaseClient {
3
+ /**
4
+ * 获取用户手机号
5
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html
6
+ * @param code [前端获取code方法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html)
7
+ * @returns
8
+ */
9
+ getUserPhoneNumber(code: string): Promise<any>;
10
+ }
@@ -0,0 +1,20 @@
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 PhoneNumber extends BaseClient_1.default {
8
+ /**
9
+ * 获取用户手机号
10
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html
11
+ * @param code [前端获取code方法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html)
12
+ * @returns
13
+ */
14
+ getUserPhoneNumber(code) {
15
+ return this.httpPostJson('wxa/business/getuserphonenumber', {
16
+ code
17
+ });
18
+ }
19
+ }
20
+ exports.default = PhoneNumber;
@@ -14,7 +14,7 @@ class RealtimeLogClient extends BaseClient_1.default {
14
14
  * @param options 其它参数
15
15
  */
16
16
  search(date, beginTime, endTime, options = {}) {
17
- let params = Utils_1.merge({
17
+ let params = (0, Utils_1.merge)({
18
18
  date: date,
19
19
  begintime: beginTime,
20
20
  endtime: endTime,
@@ -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
+ }