Commit f3256419 by 宋毅

深度拷贝对象

parent 99cd7f0c
...@@ -30,10 +30,11 @@ class aliyunClient { ...@@ -30,10 +30,11 @@ class aliyunClient {
var action = obj.action; var action = obj.action;
var reqbody = obj.reqbody; var reqbody = obj.reqbody;
try { try {
var reqAliclient = { ... this.aliclient };
if (obj.apiVersion) { if (obj.apiVersion) {
this.aliclient.apiVersion = obj.apiVersion; reqAliclient.apiVersion = obj.apiVersion;
} }
var res = await this.aliclient.request(action, reqbody, { var res = await reqAliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case formatParams: true, // default true, format the parameter name to first letter upper case
...@@ -69,46 +70,48 @@ class aliyunClient { ...@@ -69,46 +70,48 @@ class aliyunClient {
var action = obj.action; var action = obj.action;
var reqbody = obj.reqbody; var reqbody = obj.reqbody;
var rpcParam = obj.rpcParam; var rpcParam = obj.rpcParam;
var reqAliclient = { ... this.aliclient };
if (rpcParam.accessKeyId) { if (rpcParam.accessKeyId) {
this.aliclient.accessKeyId = rpcParam.accessKeyId; reqAliclient.accessKeyId = rpcParam.accessKeyId;
} }
if (rpcParam.accessKeySecret) { if (rpcParam.accessKeySecret) {
this.aliclient.accessKeySecret = rpcParam.accessKeySecret; reqAliclient.accessKeySecret = rpcParam.accessKeySecret;
} }
if (rpcParam.endpoint) { if (rpcParam.endpoint) {
this.aliclient.endpoint = rpcParam.endpoint; reqAliclient.endpoint = rpcParam.endpoint;
} }
if (rpcParam.apiVersion) { if (rpcParam.apiVersion) {
this.aliclient.apiVersion = rpcParam.apiVersion; reqAliclient.apiVersion = rpcParam.apiVersion;
} }
var res = await this.aliclient.request(action, reqbody, { var res = await reqAliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case formatParams: true, // default true, format the parameter name to first letter upper case
method: 'GET', // set the http method, default is GET method: 'GET', // set the http method, default is GET
headers: {}, // set the http request headers headers: {}, // set the http request headers
}); });
console.log(action,"action..........."); console.log(action, "action...........");
console.log(reqbody,"reqbody..........."); console.log(reqbody, "reqbody...........");
return system.getResultSuccess(res); return system.getResultSuccess(res);
} }
async reqCustomByPost(obj, cbk) { async reqCustomByPost(obj, cbk) {
var action = obj.action; var action = obj.action;
var reqbody = obj.reqbody; var reqbody = obj.reqbody;
var rpcParam = obj.rpcParam; var rpcParam = obj.rpcParam;
var reqAliclient = { ... this.aliclient };
if (rpcParam.accessKeyId) { if (rpcParam.accessKeyId) {
this.aliclient.accessKeyId = rpcParam.accessKeyId; reqAliclient.accessKeyId = rpcParam.accessKeyId;
} }
if (rpcParam.accessKeySecret) { if (rpcParam.accessKeySecret) {
this.aliclient.accessKeySecret = rpcParam.accessKeySecret; reqAliclient.accessKeySecret = rpcParam.accessKeySecret;
} }
if (rpcParam.endpoint) { if (rpcParam.endpoint) {
this.aliclient.endpoint = rpcParam.endpoint; reqAliclient.endpoint = rpcParam.endpoint;
} }
if (rpcParam.apiVersion) { if (rpcParam.apiVersion) {
this.aliclient.apiVersion = rpcParam.apiVersion; reqAliclient.apiVersion = rpcParam.apiVersion;
} }
var res = await this.aliclient.request(action, reqbody, { var res = await reqAliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case formatParams: true, // default true, format the parameter name to first letter upper case
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment