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