Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
postData.appid = config.appid;
postData.now = Date.now();
const sig = openapi.signature({
pathname : url.parse(config.runtimeReportUrl).pathname,
method : 'POST',
data : postData,
appkey : config.appkey
});
postData.sig = sig;
require('ajax').request({
url : config.runtimeReportUrl,
type : 'POST',
l5api : config.tswL5api['openapi.tswjs.org'],
dcapi : {
key: 'EVENT_TSW_OPENAPI_RUNTIME_REPORT'
},
data : postData,
keepAlive : true,
autoToken : false,
dataType : 'json'
}).fail(function() {
logger.error('runtime report fail.');
defer.reject();
}).done(function(d) {
if(d.result) {
if(d.result.code === 0) {
logger.debug('runtime report success.');
return defer.resolve();
}else{
return defer.reject();
}
var sig = openapi.signature({
pathname: url.parse(config.utilCDUrl).pathname,
method: 'POST',
data: postData,
appkey: config.appkey
});
postData.sig = sig;
require('ajax').request({
url : config.utilCDUrl,
type : 'POST',
l5api : config.tswL5api['openapi.tswjs.org'],
dcapi : {
key: 'EVENT_TSW_OPENAPI_UTIL_CD'
},
data : postData,
keepAlive : true,
autoToken : false,
dataType : 'json'
}).fail(function(){
logger.error('checkByOpenapi fail.');
defer.reject();
}).done(function(d){
var data = null;
if(d.result && d.result.code === 0){
data = d.result.data;
}
process.nextTick(function() {
require('ajax').request({
url: config.appReportUrl,
type: 'POST',
l5api: config.tswL5api['openapi.tswjs.org'],
dcapi: {
key: 'EVENT_TSW_OPENAPI_APP_REPORT'
},
data: postData,
keepAlive: true,
autoToken: false,
dataType: 'json'
}).fail(function() {
logger.error('app report fail.');
defer.reject();
}).done(function(d) {
if (d.result) {
if (d.result.code === 0) {
logger.debug('app report success.');
return defer.resolve();
} else {
postData.now = Date.now();
const sig = openapi.signature({
pathname: url.parse(config.logReportUrl).pathname,
method: 'POST',
data: postData,
appkey: config.appkey
});
postData.sig = sig;
require('ajax').request({
url: config.logReportUrl,
type: 'POST',
l5api: config.tswL5api['openapi.tswjs.org'],
dcapi: {
key: 'EVENT_TSW_OPENAPI_LOG_REPORT'
},
data: postData,
keepAlive: true,
autoToken: false,
dataType: 'json'
}).done(function () {
logger.debug('reportCloud success.');
}).fail(function () {
logger.error('reportCloud fail.');
});
};