dfws-ve-taro-request 0.0.2 → 0.0.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.
package/dist/index.js CHANGED
@@ -126,7 +126,7 @@ var getPublicChannel = function (channels, taro) {
126
126
  // 接口加密密钥
127
127
  var secretkey = "dz15z9z2z15z11z8zf";
128
128
  // 图片验证码加密密钥
129
- var captchaKey = "#DFws082#2312";
129
+ var captchaKey = "3dz2dz2bzcz8z30z2hz2nz3dz2nz2mz2oz2n";
130
130
  // 项目渠道配置:管理后台-138美业人才-系统设置-渠道管理
131
131
  var channel = { "project": "VE", "origin": "C", "platform": "XCX", "device": "ZJDF", "version": "1.0.0" };
132
132
 
@@ -6724,14 +6724,16 @@ var isEncoding = function (url) {
6724
6724
  return url.includes('/sso/v1/') || url.includes('/resume/v1/');
6725
6725
  };
6726
6726
  // 加密
6727
- var encryptByDES = function (params) {
6728
- console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
6727
+ var encryptByDES = function (params, debug) {
6728
+ if (debug === void 0) { debug = false; }
6729
+ debug && console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
6729
6730
  return encodeURIComponent(_default.encryptByDES(JSON.stringify(params), secretkey));
6730
6731
  };
6731
6732
  //解密
6732
- var decryptByDES = function (params) {
6733
+ var decryptByDES = function (params, debug) {
6734
+ if (debug === void 0) { debug = false; }
6733
6735
  var data = JSON.parse(_default.decryptByDES(params, secretkey));
6734
- console.log("\u83B7\u53D6\u5185\u5BB9\uFF1A", data);
6736
+ debug && console.log("\u83B7\u53D6\u5185\u5BB9\uFF1A", data);
6735
6737
  return data;
6736
6738
  };
6737
6739
  // 对象转URL字符串
@@ -6747,7 +6749,7 @@ var objectToQueryString = function (obj) {
6747
6749
  //短信/邮箱验证码加密
6748
6750
  var encryptBySso = function (value) {
6749
6751
  var key = Date.parse(new Date().toString());
6750
- var sign = encryptByDES("".concat(captchaKey).concat(value).concat(key));
6752
+ var sign = _default.encryptByDES("".concat(_default.decrypto(captchaKey, 123, 25)).concat(value).concat(key), secretkey);
6751
6753
  return {
6752
6754
  check_sign: sign,
6753
6755
  check_key: key,
@@ -6828,16 +6830,17 @@ var checkStatus = function (response, options, Taro) {
6828
6830
  return onErrorMsgRrport(response, options, Taro);
6829
6831
  }
6830
6832
  };
6831
- var request = (function (url, data, method, header, Taro) {
6833
+ var request = (function (url, data, method, header, Taro, debug) {
6832
6834
  if (method === void 0) { method = 'get'; }
6835
+ if (debug === void 0) { debug = false; }
6833
6836
  var isEncode = isEncoding(url); // 判断是否加密
6834
6837
  var isMethod = method.toLocaleLowerCase() === 'get' && Object.keys(data).length; // 请求方式get而且加密处理
6835
6838
  if (isMethod) {
6836
- url = "".concat(url, "?").concat(isEncode ? encryptByDES(objectToQueryString(data)) : objectToQueryString(data));
6839
+ url = "".concat(url, "?").concat(isEncode ? encryptByDES(objectToQueryString(data), debug) : objectToQueryString(data));
6837
6840
  }
6838
6841
  return Taro.request({
6839
6842
  url: url,
6840
- data: isEncode ? encryptByDES(data) : data,
6843
+ data: isEncode ? encryptByDES(data, debug) : data,
6841
6844
  method: method,
6842
6845
  timeout: 15000,
6843
6846
  header: {
@@ -6848,7 +6851,7 @@ var request = (function (url, data, method, header, Taro) {
6848
6851
  'resume-language': header['resume-language'] || 'zh-CN',
6849
6852
  }
6850
6853
  }).then(function (res) {
6851
- var response = isEncode ? __assign(__assign({}, res), { data: decryptByDES(unescape(res.data)) }) : res;
6854
+ var response = isEncode ? __assign(__assign({}, res), { data: decryptByDES(unescape(res.data), debug) }) : res;
6852
6855
  return checkStatus(response, { url: url, data: data, method: method }, Taro);
6853
6856
  }).catch(function (err) {
6854
6857
  console.log('error:', err);
@@ -6864,9 +6867,10 @@ var request = (function (url, data, method, header, Taro) {
6864
6867
  });
6865
6868
 
6866
6869
  var index = {
6867
- request: function (taro, projectChannel, url, data, method, headers) {
6870
+ request: function (taro, projectChannel, url, data, method, headers, debug) {
6868
6871
  if (projectChannel === void 0) { projectChannel = {}; }
6869
6872
  if (headers === void 0) { headers = {}; }
6873
+ if (debug === void 0) { debug = false; }
6870
6874
  /**
6871
6875
  * 东方网升项目公共 header
6872
6876
  * @param {object} dfws_params
@@ -6876,7 +6880,7 @@ var index = {
6876
6880
  dfws_header.getNetworkType(function (network) {
6877
6881
  channel.network = network;
6878
6882
  });
6879
- return request(url, data, method, __assign({ version: channel.version, params: JSON.stringify(dfws_header.queryChannels()) }, headers), taro);
6883
+ return request(url, data, method, __assign({ version: channel.version, params: JSON.stringify(dfws_header.queryChannels()) }, headers), taro, debug);
6880
6884
  },
6881
6885
  // 接口解密
6882
6886
  decryptByDES: decryptByDES,