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.js
CHANGED
|
@@ -6722,14 +6722,20 @@ var _default = dist.default = {
|
|
|
6722
6722
|
var isEncoding = function (url, encode) {
|
|
6723
6723
|
if (url === void 0) { url = ''; }
|
|
6724
6724
|
if (encode === void 0) { encode = false; }
|
|
6725
|
-
return encode || url.includes('/sso/v1/') || url.includes('/resume/v1/') || url.includes('/resume/v2/');
|
|
6725
|
+
return encode || url.includes('/sso/v1/') || url.includes('/resume/v1/') || url.includes('/resume/v2/') || url.includes('/go/oss/v1/js');
|
|
6726
6726
|
};
|
|
6727
|
-
// 加密
|
|
6728
|
-
var
|
|
6727
|
+
// go加密
|
|
6728
|
+
var encryptByGoDES = function (params, debug) {
|
|
6729
6729
|
if (debug === void 0) { debug = false; }
|
|
6730
6730
|
debug && console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
|
|
6731
6731
|
return encodeURIComponent(_default.encryptByDES(encodeURIComponent(JSON.stringify(params)), secretkey));
|
|
6732
6732
|
};
|
|
6733
|
+
// php加密
|
|
6734
|
+
var encryptByDES = function (params, debug) {
|
|
6735
|
+
if (debug === void 0) { debug = false; }
|
|
6736
|
+
debug && console.log("\u8BF7\u6C42\u53C2\u6570\uFF1A", params);
|
|
6737
|
+
return encodeURIComponent(_default.encryptByDES(JSON.stringify(params), secretkey));
|
|
6738
|
+
};
|
|
6733
6739
|
//解密
|
|
6734
6740
|
var decryptByDES = function (params, debug) {
|
|
6735
6741
|
if (debug === void 0) { debug = false; }
|
|
@@ -6850,12 +6856,13 @@ var request = (function (url, data, method, header, Taro, debug, encode) {
|
|
|
6850
6856
|
if (encode === void 0) { encode = false; }
|
|
6851
6857
|
var isEncode = isEncoding(url, encode); // 判断是否加密
|
|
6852
6858
|
var isMethod = method.toLocaleLowerCase() === 'get' && Object.keys(data).length; // 请求方式get而且加密处理
|
|
6859
|
+
var isGoServiceApi = url.includes('/go/'); // 是否go服务接口
|
|
6853
6860
|
if (isMethod) {
|
|
6854
|
-
url = "".concat(url, "?").concat(isEncode ? encryptByDES(objectToQueryString(data), debug) : objectToQueryString(data));
|
|
6861
|
+
url = "".concat(url, "?").concat(isEncode ? isGoServiceApi ? encryptByGoDES(objectToQueryString(data), debug) : encryptByDES(objectToQueryString(data), debug) : objectToQueryString(data));
|
|
6855
6862
|
}
|
|
6856
6863
|
return Taro.request({
|
|
6857
6864
|
url: url,
|
|
6858
|
-
data: isMethod ? {} : isEncode ? encryptByDES(data, debug) : data,
|
|
6865
|
+
data: isMethod ? {} : isEncode ? isGoServiceApi ? encryptByGoDES(data, debug) : encryptByDES(data, debug) : data,
|
|
6859
6866
|
method: method,
|
|
6860
6867
|
timeout: 15000,
|
|
6861
6868
|
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'] || '' })
|