Commit facd501a by 王勇飞

add tmInfoPusherApi log

parent 1b76f19a
......@@ -3,6 +3,8 @@ const System = require("../../system");
const request = require('request');
const aliyunClient = require('../../utils/aliyunClient.js');
const OplogSve = require('../../service/impl/oplogSve.js');
// this.fqReqUrl = "https://yunfuapi.gongsibao.com";//线上域名
let fqReqUrl = "https://yunfuapi-dev.gongsibao.com";//dev域名
......@@ -12,6 +14,7 @@ class TmInfoPusherApi {
this.trademarkS = System.getObject("service.trademarkSve");
this.tmapplierinfoDao = System.getObject("db.tmapplierinfoDao");
this.aliyunClient = new aliyunClient();
this.oplogSve = new OplogSve();
};
async collectInfo() {
......@@ -54,6 +57,14 @@ class TmInfoPusherApi {
let res = await this.aliyunClient.postig(url, body);
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
await this.trademarkS.updateIsPushed(d.id);
......@@ -63,6 +74,14 @@ class TmInfoPusherApi {
return {code: 200, message: "调用推送接口成功"};
}catch(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;
}
}
......
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