Commit 88adcd00 by 王悦

fix

parent 11fb5cf8
......@@ -94,33 +94,37 @@ class TrademarkCtl extends CtlBase {
* {"error": ""}
*/
async publish(p, q, req) {
let body = {
"tm": p
};
let uploadid;
if (q && q.upload_id)
uploadid = q.upload_id;
else {
let upload = await this.uploadSve.create({
total: p.length
});
uploadid = upload.id;
}
body.upload_id = uploadid;
let rtn = await pushClient(body, pushurl, notifyurl);
if (rtn.status == 1) {
let tradedb = [];
p.map(db => tradedb.push({
opath: p.opath,
user_id: p.userid,
company_id: p.company_id,
// trademark_id: db.id,
tm_code: db.code,
upload_id: uploadid
}));
rtn = await this.service.bulkCreate(tradedb);
try {
let body = {
"tm": p
};
let uploadid;
if (q && q.upload_id)
uploadid = q.upload_id;
else {
let upload = await this.uploadSve.create({
total: p.length
});
uploadid = upload.id;
}
body.upload_id = uploadid;
let rtn = await pushClient(body, pushurl, notifyurl);
if (rtn.status == 1) {
let tradedb = [];
p.map(db => tradedb.push({
opath: p.opath,
user_id: p.userid,
company_id: p.company_id,
// trademark_id: db.id,
tm_code: db.code,
upload_id: uploadid
}));
rtn = await this.service.bulkCreate(tradedb);
}
return system.getResult(rtn)
}catch (e) {
return system.getResultFail(-2,e)
}
return system.getResult(rtn)
}
async process(p, q, req) {
......@@ -153,15 +157,19 @@ class TrademarkCtl extends CtlBase {
}
async excelpublish(p, q, req) {
let upload = await this.uploadSve.create({
name: p.name,
file_url: p.file_url
});
let rtn = await pushClient({upload_id: upload.id, file_url: p.file_url}, pushmyurl);
if (rtn.status == 1) {
return system.getResult(rtn)
try {
let upload = await this.uploadSve.create({
name: p.name,
file_url: p.file_url
});
let rtn = await pushClient({upload_id: upload.id, file_url: p.file_url}, pushmyurl);
if (rtn.status == 1) {
return system.getResult(rtn)
}
return system.getResultFail(-1, rtn.msg, rtn)
}catch (e) {
return system.getResultFail(-2, e)
}
return system.getResultFail(-1, rtn.msg, rtn)
}
/**
......
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