Commit a46056de by 王勇飞

add pushApi

parent 028064f2
const ApiBase = require("../api.base"); const ApiBase = require("../api.base");
const System = require("../../system"); const System = require("../../system");
const request = require('request'); const request = require('request');
const fs = require('fs'); const aliyunClient = require('../../utils/aliyunClient.js');
// this.fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名 // this.fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名 let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名
...@@ -11,13 +11,11 @@ class TmInfoPusherApi { ...@@ -11,13 +11,11 @@ class TmInfoPusherApi {
constructor() { constructor() {
this.trademarkS = System.getObject("service.trademarkSve"); this.trademarkS = System.getObject("service.trademarkSve");
this.tmapplierinfoDao = System.getObject("db.tmapplierinfoDao"); this.tmapplierinfoDao = System.getObject("db.tmapplierinfoDao");
this.aliyunClient = new aliyunClient();
}; };
async collectInfo() { async collectInfo() {
try{ try{
//根据状态判断获取商标数据、根据商标数据获取申请人信息、联系人信息、官文信息
//获取商标数据 //获取商标数据
let resultTm = await this.trademarkS.queryTmInfoForPush(); let resultTm = await this.trademarkS.queryTmInfoForPush();
console.log('请求推送的数据成功:', resultTm.length); console.log('请求推送的数据成功:', resultTm.length);
...@@ -42,26 +40,19 @@ class TmInfoPusherApi { ...@@ -42,26 +40,19 @@ class TmInfoPusherApi {
let resultTmCustomer = await this.trademarkS.queryTmCustomerInfoForPush(orderNum); let resultTmCustomer = await this.trademarkS.queryTmCustomerInfoForPush(orderNum);
oneItem.tmCustomer = resultTmCustomer[0]; oneItem.tmCustomer = resultTmCustomer[0];
//获取官文信息, 一对多的关系,所以传入list //获取官文信息, 一对多的关系,所以传入list
let resultTmFlow = await this.trademarkS.queryTmFlowInfoForPush(tmRegistNum); let resultTmFlow = await this.trademarkS.queryTmFlowInfoForPush(tmRegistNum);
oneItem.tmFlow = resultTmFlow; oneItem.tmFlow = resultTmFlow;
console.log('收集商标信息完成--', i); console.log('收集商标信息完成--', i);
//调用推送接口推送oneItem //调用推送接口推送oneItem
var options = { let url = fqReqUrl + '/cloudapi/iduty/igirl/pushFollowUp';
'method': 'POST', let body = {
'url': fqReqUrl + '/cloudapi/iduty/igirl/pushFollowUp',
'headers': {
},
body: JSON.stringify({
'order_no': order_no, 'order_no': order_no,
'json': oneItem 'json': oneItem
})
}; };
let res = await this.reqPost(options); let res = await this.aliyunClient.postig(url, body);
console.log('推送完成--' + i, res); console.log('推送完成--' + i, res);
//更新isPushed字段为1 //更新isPushed字段为1
...@@ -74,19 +65,6 @@ class TmInfoPusherApi { ...@@ -74,19 +65,6 @@ class TmInfoPusherApi {
console.log('collectInfo error: ', e); console.log('collectInfo error: ', e);
return e; return e;
} }
}
async reqPost(options) {
return new Promise((resolve, reject)=>{
request(options, (e, response, body) => {
if(e) {
console.log('请求igirl接口错误:', e);
reject(e);
}
return resolve(body);
});
})
} }
} }
......
...@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client; ...@@ -2,8 +2,8 @@ const Client = require('aliyun-api-gateway').Client;
// const client = new Client('203727307', 'b6za34qem6k9a3s3jguvh24nc3ridlnh'); // const client = new Client('203727307', 'b6za34qem6k9a3s3jguvh24nc3ridlnh');
const client = new Client('203732072', '3r0dn583041bco48lq0xgsw09r0hh6ew'); const client = new Client('203732072', '3r0dn583041bco48lq0xgsw09r0hh6ew');
// const clientig = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发 const clientig = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发
const clientig = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上 // const clientig = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class aliyunClient { class aliyunClient {
constructor() { constructor() {
this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard"; this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
......
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