Commit 102b3d90 by 王栋源

wdyMMC

parent 8617bf6b
const TaskBase = require("../../task.base");
const system = require("../../../system");
var settings = require("../../../../config/settings");
class Pushmarketplatneed2fq extends TaskBase {
constructor() {
super(TaskBase.getServiceName(Pushmarketplatneed2fq));
this.restclient = system.getObject("util.restClient");
this.fqbossUrl = settings.fqbossUrl();
}
async beforeTask(params) {
console.log("前置操作......", this.serviceName);
//this.isThrough=true;
//console.log(this.cacheManager);
}
async subDoTask() {
console.log("--------------");
console.log("TestTask1.....");
var obj = {
    "actionType":"pushFormInfo2Fq",
    "actionBody":{
    }
}
try {
var url ="https://mmc-service.newtime/external/action/template/springBoard";
var rtn = await this.restclient.execPostMMC(obj, url);
return rtn;
} catch (error) {
console.log(error);
return null;
}
}
}
module.exports = Pushmarketplatneed2fq;
\ No newline at end of file
......@@ -7,7 +7,7 @@ class RestClient{
constructor(){
this.cmdGetPattern = "curl {-G} -k -d '{data}' {url}";
this.cmdPostPattern="curl -k -H 'Content-type: application/json' -d '{data}' '{url}'";
this.cmdPostPatternMMC="curl -k -H 'Content-type: application/json' -H 'xappkey:f6b59b74-f943-4735-bb86-e05d6b7fdwsv' -d '{data}' '{url}'";
this.cmdPostPatternWithAK="curl -k -H 'Content-type: application/json' -H 'AccessKey:{ak}' -d '{data}' {url} -m 20000";
this.cmdDownLoadFilePattern="curl -G -o {fileName} {url}";
......@@ -28,6 +28,13 @@ class RestClient{
data).replace(/\{url\}/g, url);
return cmd;
}
FetchPostCmdMMC(subData, url) {
var data=JSON.stringify(subData);
var cmd= this.cmdPostPatternMMC.replace(/\{data\}/g,
data).replace(/\{url\}/g, url);
return cmd;
}
FetchPostCmdWithAK(subData, url,acck) {
var data=JSON.stringify(subData);
var cmd= this.cmdPostPatternWithAK.replace(/\{data\}/g,
......@@ -102,6 +109,13 @@ class RestClient{
});
return result;
}
async execPostMMC(subData, url){
let cmd=this.FetchPostCmdMMC(subData,url);
var result=await this.exec(cmd,{
maxBuffer: 10000 * 1024
});
return result;
}
async execPostWithAK(subData, url,ak){
let cmd=this.FetchPostCmdWithAK(subData,url,ak);
var result=await this.exec(cmd,{
......
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