|  |  | 
 |  |  | var  AWSService = {}; | 
 |  |  | let  AWSService = {}; | 
 |  |  | AWSService = { | 
 |  |  |     sfSessionId : '', | 
 |  |  |     insertModule : 'Insert AWS ', | 
 |  |  | 
 |  |  |         | 
 |  |  |    }, | 
 |  |  |  | 
 |  |  |    get:function(queryURL, queryback, token) { | 
 |  |  |         let para = { | 
 |  |  |             url:queryURL, | 
 |  |  |             headers: { | 
 |  |  |                 'Content-Type': 'application/json', | 
 |  |  |                 'pi-token': token | 
 |  |  |             }, | 
 |  |  |             type: "get", | 
 |  |  |             success: function (data) { | 
 |  |  |                 AWSService.insertCalloutLog(AWSService.queryModule,queryURL,'',JSON.stringify(data),AWSService.successStatus); | 
 |  |  |                 queryback(data);  | 
 |  |  |             }, | 
 |  |  |             error: function (error){ | 
 |  |  |             //错误相关处理 404属于该处理(经测试) | 
 |  |  |             //还可能是"timeout", "error", "notmodified" 和 "parsererror"。 | 
 |  |  |                 AWSService.insertCalloutLog(AWSService.queryModule,queryURL,'',JSON.stringify(error),AWSService.failStatus); | 
 |  |  |                 console.log(error); | 
 |  |  |             } | 
 |  |  |         }; | 
 |  |  |         jQuery.ajax(para); | 
 |  |  |     }, | 
 |  |  |  | 
 |  |  |    //update | 
 |  |  |     post:function(postURL, payloadForNewPI, callback, token) { | 
 |  |  |        console.log('Process New PI Data'); | 
 |  |  | 
 |  |  |        jQuery.ajax(para); | 
 |  |  |  | 
 |  |  |    }, | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     //update | 
 |  |  |     postConsumTrial:function(postURL, indexNumber , payloadForNewPI, callback, token) { | 
 |  |  |         console.log('Process New PI Data'); | 
 |  |  |         console.log(JSON.stringify(payloadForNewPI)); | 
 |  |  |  | 
 |  |  |         let payloadstr= null; | 
 |  |  |         if (payloadForNewPI) { | 
 |  |  |             if (typeof payloadForNewPI == 'string') { | 
 |  |  |                 payloadstr = payloadForNewPI; | 
 |  |  |             }else{ | 
 |  |  |                 payloadstr = JSON.stringify(payloadForNewPI); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         let para = { | 
 |  |  |             url:postURL, | 
 |  |  |             headers: { | 
 |  |  |                 'Content-Type': 'application/json', | 
 |  |  |                 'pi-token': token | 
 |  |  |             }, | 
 |  |  |             type: "post", | 
 |  |  |             success: function (result) { | 
 |  |  |                 AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus); | 
 |  |  |                 if(callback) callback(result,indexNumber); | 
 |  |  |             }, | 
 |  |  |             error: function (error){ | 
 |  |  |                 AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus); | 
 |  |  |                 console.log(error); | 
 |  |  |             } | 
 |  |  |         }; | 
 |  |  |         if (payloadstr) { | 
 |  |  |             para.data = payloadstr; | 
 |  |  |         } | 
 |  |  |         jQuery.ajax(para); | 
 |  |  |  | 
 |  |  |     }, | 
 |  |  |  | 
 |  |  |     confirmTrans:function(transactionURL,transParameters,callback,token){ | 
 |  |  |  | 
 |  |  | 
 |  |  |            { escape: true } | 
 |  |  |        ); | 
 |  |  |    } | 
 |  |  | }; | 
 |  |  | }; | 
 |  |  | window.AWSService = AWSService; |