Commit c3d6743a by 王栋源

wdy

parent 5e5dee1a
......@@ -496,67 +496,77 @@ class ToolCtl {
//生成企业监控报告-h5 post
async createMonitoringReportH5p(pobj, obj, r) {
var key = "create_repotCache"
if (!obj.companyname) {
return { code: -1, msg: "企业名称参数错误" };
}
obj.companyname = await this.getConvertSemiangleStr(obj.companyname);
var source = {
wxuser_id: obj.wxuser_id,
companyname: obj.companyname,
phonenum: obj.phonenum,
email: obj.email,
notifyUrl: obj.notifyUrl,
source: obj.appid,
push_type:obj.push_type,
type: obj.type
}
logCtl.info({
optitle: "生成企业监控报告-h5",
op: "tooCtl/createMonitoringReportH5",
content: JSON.stringify(obj) + "---------------" + JSON.stringify(source),
clientIp: ""
});
var search = { companyname: obj.companyname, status: 1, type: obj.type };
var info = await this.pytmreportSve.findOne(search);
if (info) {
if (obj.push_type == 1) {
if (obj.type == 1) {
var html = '<a href="' + info.filepath + '">企业商标监控报告</a>'
this.mailClient.sendMsg(info.email, "企业商标监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
try{
var key = "create_repotCache"
if (!obj.companyname) {
return { code: -1, msg: "企业名称参数错误" };
}
obj.companyname = await this.getConvertSemiangleStr(obj.companyname);
var source = {
wxuser_id: obj.wxuser_id,
companyname: obj.companyname,
phonenum: obj.phonenum,
email: obj.email,
notifyUrl: obj.notifyUrl,
source: obj.appid,
push_type:obj.push_type,
type: obj.type
}
logCtl.info({
optitle: "生成企业监控报告-h5",
op: "tooCtl/createMonitoringReportH5",
content: JSON.stringify(obj) + "---------------" + JSON.stringify(source),
clientIp: ""
});
var search = { companyname: obj.companyname, status: 1, type: obj.type };
var info = await this.pytmreportSve.findOne(search);
if (info) {
if (obj.push_type == 1) {
if (obj.type == 1) {
var html = '<a href="' + info.filepath + '">企业商标监控报告</a>'
this.mailClient.sendMsg(info.email, "企业商标监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
if (obj.type == 2) {
var html = '<a href="' + info.filepath + '">企业专利监控报告</a>'
this.mailClient.sendMsg(info.email, "企业专利监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
}
}
if (obj.type == 2) {
var html = '<a href="' + info.filepath + '">企业专利监控报告</a>'
this.mailClient.sendMsg(info.email, "企业专利监控报告", null, html, null, null, []); //发送成功后result的值:250 Data Ok: queued as freedom
if (obj.push_type == 2) {
var pobj = {
receiverId: obj.wxuser_id,
title: obj.companyname,
linkUrl: info.filepath
}
var rtn = await this.execClient.execPost(pobj, obj.notifyUrl);
console.log("report------------------------------------------------------------------");
logCtl.info({
optitle: "icompany---------log",
op: "tooCtl/createMonitoringReportH5p",
content: rtn,
clientIp: ""
});
console.log(rtn)
}
}
if (obj.push_type == 2) {
var pobj = {
receiverId: obj.wxuser_id,
title: obj.companyname,
linkUrl: info.filepath
source.filepath = info.filepath;
source.status = 1;
await this.pytmreportSve.create(source);
return { code: 1 };
} else {
var result = await this.pytmreportSve.create(source);
if (result) {
this.redisClient.rpush(key, result.id);
}
var rtn = await this.execClient.execPost(pobj, obj.notifyUrl);
console.log("report------------------------------------------------------------------");
logCtl.info({
optitle: "icompany---------log",
op: "tooCtl/createMonitoringReportH5p",
content: rtn,
clientIp: ""
});
console.log(rtn)
return { code: 1 };
}
source.filepath = info.filepath;
source.status = 1;
await this.pytmreportSve.create(source);
return { code: 1 };
} else {
var result = await this.pytmreportSve.create(source);
if (result) {
this.redisClient.rpush(key, result.id);
}
return { code: 1 };
} catch(e){
logCtl.info({
optitle: "icompany---------log",
op: "tooCtl/createMonitoringReportH5p--error",
content: rtn,
clientIp: ""
});
}
}
//生成企业专利监控报告-h5
......
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