dfws-ve-taro-request 0.2.0 → 0.2.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.
- package/dist/index.esm.js +12 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +12 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -6726,14 +6726,20 @@
|
|
|
6726
6726
|
var isEncoding = function (url, encode) {
|
|
6727
6727
|
if (url === void 0) { url = ''; }
|
|
6728
6728
|
if (encode === void 0) { encode = false; }
|
|
6729
|
-
return encode || url.includes('/sso/v1/') || url.includes('/resume/v1/') || url.includes('/resume/v2/');
|
|
6729
|
+
return encode || url.includes('/sso/v1/') || url.includes('/resume/v1/') || url.includes('/resume/v2/') || url.includes('/go/oss/v1/js');
|
|
6730
6730
|
};
|
|
6731
|
-
// 加密
|
|
6732
|
-
var
|
|
6731
|
+
// go加密
|
|
6732
|
+
var encryptByGoDES = function (params, debug) {
|
|
6733
6733
|
if (debug === void 0) { debug = false; }
|
|
6734
6734
|
debug && console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
|
|
6735
6735
|
return encodeURIComponent(_default.encryptByDES(encodeURIComponent(JSON.stringify(params)), secretkey));
|
|
6736
6736
|
};
|
|
6737
|
+
// php加密
|
|
6738
|
+
var encryptByDES = function (params, debug) {
|
|
6739
|
+
if (debug === void 0) { debug = false; }
|
|
6740
|
+
debug && console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
|
|
6741
|
+
return encodeURIComponent(_default.encryptByDES(JSON.stringify(params), secretkey));
|
|
6742
|
+
};
|
|
6737
6743
|
//解密
|
|
6738
6744
|
var decryptByDES = function (params, debug) {
|
|
6739
6745
|
if (debug === void 0) { debug = false; }
|
|
@@ -6854,12 +6860,13 @@
|
|
|
6854
6860
|
if (encode === void 0) { encode = false; }
|
|
6855
6861
|
var isEncode = isEncoding(url, encode); // 判断是否加密
|
|
6856
6862
|
var isMethod = method.toLocaleLowerCase() === 'get' && Object.keys(data).length; // 请求方式get而且加密处理
|
|
6863
|
+
var isGoServiceApi = url.includes('/go/'); // 是否go服务接口
|
|
6857
6864
|
if (isMethod) {
|
|
6858
|
-
url = "".concat(url, "?").concat(isEncode ? encryptByDES(objectToQueryString(data), debug) : objectToQueryString(data));
|
|
6865
|
+
url = "".concat(url, "?").concat(isEncode ? isGoServiceApi ? encryptByGoDES(objectToQueryString(data), debug) : encryptByDES(objectToQueryString(data), debug) : objectToQueryString(data));
|
|
6859
6866
|
}
|
|
6860
6867
|
return Taro.request({
|
|
6861
6868
|
url: url,
|
|
6862
|
-
data: isMethod ? {} : isEncode ? encryptByDES(data, debug) : data,
|
|
6869
|
+
data: isMethod ? {} : isEncode ? isGoServiceApi ? encryptByGoDES(data, debug) : encryptByDES(data, debug) : data,
|
|
6863
6870
|
method: method,
|
|
6864
6871
|
timeout: 15000,
|
|
6865
6872
|
header: __assign(__assign({ 'authorization': Taro.getStorageSync('ticket') }, header), { 've-version': header.version || '1.0.0', 'dfws-params': header.params || '', 'content-type': header["content-type"] || 'application/json;charset=utf-8', 'resume-language': header['resume-language'] || 'zh-CN', 'common-params': header['common-params'] || '' })
|