Commit 02d00cd6 by 王栋源

wdy

parent ec80560a
......@@ -10,7 +10,8 @@ class TmtransactionApi extends ApiBase {
this.utilstmtasktradeSve = System.getObject("service.utilstmtasktradeSve");
this.pytmreportSve = System.getObject("service.pytmreportSve");
this.mailClient = System.getObject("util.mailClient");
this.redisClient=System.getObject("util.redisClient");
this.redisClient = System.getObject("util.redisClient");
this.execClient = System.getObject("util.execClient");
};
//获取某类型的交易商标 post
async findByTmType(obj) {
......@@ -50,13 +51,20 @@ class TmtransactionApi extends ApiBase {
async tmreport() {
var id = await this.redisClient.lpop("create_tmrepotCache");
var id = await this.redisClient.lpop("create_repotCache");
console.log(id, "商标检索报告执行开始.................");
if (id) {
var info = await this.pytmreportSve.dao.findById(id);
console.log(info.dataValues);
if (info) {
var url = "http://43.247.184.92:8015/tmdoc/api/createdoc?mycompanyname=" + encodeURIComponent(info.companyname);
var cpush = "";
if (info.push_type == 1) {
cpush = "http://43.247.184.92:8015/tmdoc/api/createdoc?mycompanyname=";
}
if (info.push_type == 2) {
cpush = "http://43.247.184.94:19500/patentdoc/api/createdoc?mycompanyname=";
}
var url = cpush + encodeURIComponent(info.companyname);
var rc = System.getObject("util.execClient");
var rtn = null;
try {
......@@ -66,26 +74,41 @@ class TmtransactionApi extends ApiBase {
// console.log("fanhui");
console.log(j);
if (j.indexOf("gsb-zc.oss-cn-beijing.aliyuncs.com") >= 0) {
var text = "企业监控报告";
var html = '<a href="' + j + '">企业监控报告</a>'
var mresult = this.mailClient.sendMsg(info.email, "企业监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
if (info.push_type == 1) {
if (info.type == 1) {
var html = '<a href="' + j + '">企业商标监控报告</a>'
this.mailClient.sendMsg(info.email, "企业商标监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
if (info.type == 2) {
var html = '<a href="' + j + '">企业专利监控报告</a>'
this.mailClient.sendMsg(info.email, "企业专利监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
}
if (info.push_type == 2) {
var pobj = {
fid: info.wxuser_id,
title: info.companyname,
linkUrl: j
}
var rtn = await this.execClient.execPost(pobj, info.notifyUrl);
}
info.dataValues.filepath = j;
info.dataValues.status = 1;
var result = await this.pytmreportSve.dao.model.update(info.dataValues, { where: { id: id } });
logCtl.info({
optitle: "检索报告执行结果",
op: "/igirl-web/app/base/db/task/CreaterepotTask.js",
content: "id=" + id + "执行结果:" + j,
clientIp: ""
});
return result;
}
info.dataValues.filepath = j;
info.dataValues.status = 1;
var result = await this.pytmreportSve.dao.model.update(info.dataValues, { where: { id: id } });
logCtl.info({
optitle: "商标检索报告执行结果",
op: "/igirl-web/app/base/db/task/CreatetmrepotTask.js",
content: "id=" + id + "执行结果:" + j,
clientIp: ""
});
return result;
} catch (e) {
console.log(e);
//日志记录
logCtl.error({
optitle: "商标检索报告执行结果-error",
op: "/igirl-web/app/base/db/task/CreatetmrepotTask.js",
optitle: "检索报告执行结果-error",
op: "/igirl-web/app/base/db/task/CreaterepotTask.js",
content: e.stack,
clientIp: ""
});
......
......@@ -4,19 +4,22 @@ module.exports = (db, DataTypes) => {
filepath: DataTypes.STRING,
phonenum: DataTypes.STRING,
email: DataTypes.STRING,
status:DataTypes.INTEGER,
type:DataTypes.INTEGER,
channel_company_id:DataTypes.INTEGER,//统计公司id(通过公司渠道码获取,用于渠道用户统计使用商标报告功能情况)
wxuser_id:DataTypes.INTEGER //微信用户id(使用商标报告功能的微信用户id,存在于wx_user表中)
},{
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'py_tmreport',
validate: {
}
});
status: DataTypes.INTEGER,
type: DataTypes.INTEGER,
channel_company_id: DataTypes.INTEGER,//统计公司id(通过公司渠道码获取,用于渠道用户统计使用商标报告功能情况)
wxuser_id: DataTypes.INTEGER, //微信用户id(使用商标报告功能的微信用户id,存在于wx_user表中)
notifyUrl: DataTypes.STRING,
source: DataTypes.STRING,
push_type: DataTypes.STRING,
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'py_tmreport',
validate: {
}
});
}
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