Commit b569d9a8 by 蒋勇

Merge branch 'scratch-web' of gitlab.gongsibao.com:jiangyong/zhichan into scratch-web

parents 0537dd77 d65e6070
var childproc = require('child_process');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const uuidv4 = require('uuid/v4');
class ExecClient {
constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
}
async exec(cmd) {
......@@ -69,6 +71,26 @@ class ExecClient {
const {stdout, stderr} = await exec(cmd, options);
return {stdout, stderr};
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
FetchPushDataPostCmd(subData, url, token, requestId) {
var requestId = requestId || this.getUUID();
var data = JSON.stringify(subData);
var cmd = this.cmdPushDataPostPattern.replace(/\{data\}/g,
data).replace(/\{url\}/g, url).replace(/\{tk\}/g, token).replace(/\{requestId\}/g, requestId);
console.log(cmd);
return cmd;
}
async execPushDataPost(subData, url, token, requestId) {
let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId);
var result = await this.exec(cmd);
return result;
}
}
module.exports = ExecClient;
......
......@@ -7,11 +7,11 @@ var settings={
},
database:{
dbname : "zc",
user: "root",
password: "123456",
user: "write",
password: "write",
config: {
host: '192.168.4.119',
port: 3306,
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
......
......@@ -38,6 +38,13 @@ var settings = {
return "http://43.247.184.94:7200/";
}
},
centerChannelUrl: function () {
if (this.env == "dev") {
return "http://gsb.qifu.gongsibao.com:4012/";
} else {
return "http://center-channel-service/";
}
},
reqEsAddrIc:function(){
if(this.env=="dev"){
var localsettings=require("./localsettings");
......
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