Commit 49e74a45 by 王栋源

wdy

parents 47958582 facd501a
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');
const OplogSve = require('../../service/impl/oplogSve.js');
let fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名 let fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
// let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名 // let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名
...@@ -11,12 +13,12 @@ class TmInfoPusherApi { ...@@ -11,12 +13,12 @@ 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();
this.oplogSve = new OplogSve();
}; };
async collectInfo() { async collectInfo() {
try { try {
//根据状态判断获取商标数据、根据商标数据获取申请人信息、联系人信息、官文信息
//获取商标数据 //获取商标数据
let resultTm = await this.trademarkS.queryTmInfoForPush(); let resultTm = await this.trademarkS.queryTmInfoForPush();
...@@ -42,27 +44,29 @@ class TmInfoPusherApi { ...@@ -42,27 +44,29 @@ 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 = {
'method': 'POST', let url = fqReqUrl + '/cloudapi/iduty/igirl/pushFollowUp';
'url': fqReqUrl + ':/cloudapi/iduty/igirl/pushFollowUp', let body = {
'headers': { 'order_no': order_no,
}, 'json': oneItem
body: JSON.stringify({
'order_no': order_no,
'json': oneItem
})
}; };
let res = await this.reqPost(options); let res = await this.aliyunClient.postig(url, body);
console.log('推送完成--' + i, res); console.log('推送完成--' + i, res);
//将成功结果写入到日志
await this.oplogSve.create({
logLevel: "info",
optitle: "推送商标数据至蜂擎---",
op: "app/base/api/impl/tmInfoPusherApi.js/collectInfo",
content: "参数:" + JSON.stringify(body) + "返回结果:" + JSON.stringify(res),
clientIp: ""
});
//更新isPushed字段为1 //更新isPushed字段为1
await this.trademarkS.updateIsPushed(d.id); await this.trademarkS.updateIsPushed(d.id);
...@@ -72,21 +76,16 @@ class TmInfoPusherApi { ...@@ -72,21 +76,16 @@ class TmInfoPusherApi {
return { code: 200, message: "调用推送接口成功" }; return { code: 200, message: "调用推送接口成功" };
} catch (e) { } catch (e) {
console.log('collectInfo error: ', e); console.log('collectInfo error: ', e);
//将错误写入到日志
await this.oplogSve.create({
logLevel: "error",
optitle: "推送商标数据至蜂擎---异常",
op: "app/base/api/impl/tmInfoPusherApi.js/collectInfo",
content: JSON.stringify(e.stack),
clientIp: ""
});
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);
});
})
} }
} }
......
...@@ -365,9 +365,11 @@ class TmFlowService extends ServiceBase { ...@@ -365,9 +365,11 @@ class TmFlowService extends ServiceBase {
}; };
if (tm.tmStatus != officialType) { if (tm.tmStatus != officialType) {
var param = { tmStatus: officialType }; var param = { tmStatus: officialType };
param.isPushed = 0; //tm状态更新
self.trademarkDao.updateByWhere(param, { where: { tmRegistNum: reg_code } }, t); self.trademarkDao.updateByWhere(param, { where: { tmRegistNum: reg_code } }, t);
} }
if (flowCount > 0) { if (flowCount > 0) {
params.isPushed=0; //官文信息更新的时候tm状态也会更新
self.updateByWhere(params, flowWhere, t); self.updateByWhere(params, flowWhere, t);
} else { } else {
opResult.isMobileMsg = 1; opResult.isMobileMsg = 1;
......
...@@ -3,7 +3,11 @@ const Client = require('aliyun-api-gateway').Client; ...@@ -3,7 +3,11 @@ const Client = require('aliyun-api-gateway').Client;
const client = new Client('203732072', '3r0dn583041bco48lq0xgsw09r0hh6ew'); const client = new Client('203732072', '3r0dn583041bco48lq0xgsw09r0hh6ew');
const clientig = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发 const clientig = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发
<<<<<<< HEAD
//const clientig = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上 //const clientig = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
=======
// const clientig = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
>>>>>>> facd501a97803626a8b7c6f760b33af2544fcc4c
class aliyunClient { class aliyunClient {
constructor() { constructor() {
this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard"; this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
......
...@@ -6,7 +6,7 @@ var settings = { ...@@ -6,7 +6,7 @@ var settings = {
db: 11, db: 11,
}, },
database: { database: {
dbname: "fqboss", dbname: "fqboss2",
user: "write", user: "write",
password: "write", password: "write",
// user: "root", // user: "root",
......
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