Commit 2b229d6d by 王悦

fix

parent 5a630754
...@@ -88,32 +88,27 @@ class TrademarkCtl extends CtlBase { ...@@ -88,32 +88,27 @@ class TrademarkCtl extends CtlBase {
* {"error": ""} * {"error": ""}
*/ */
async publish(p, q, req) { async publish(p, q, req) {
try { let body = {
let body = { "tm": p
"tm": p };
}; let upload = await this.uploadSve.create({
let upload = await this.uploadSve.create({ total: p.length
total: p.length });
}); body.upload_id = upload.id;
body.upload_id = upload.id; let rtn = await pushClient(body);
let rtn = await pushClient(body); if (rtn.status == 1) {
if (rtn.status == 1) { let tradedb = [];
let tradedb = []; p.map(db => tradedb.push({
p.map(db => tradedb.push({ opath: p.opath,
opath: p.opath, user_id: p.userid,
user_id: p.userid, company_id: p.company_id,
company_id: p.company_id, // trademark_id: db.id,
// trademark_id: db.id, tm_code: db.code,
tm_code: db.code, upload_id: upload.id
upload_id: upload.id }));
})); rtn = await this.service.bulkCreate(tradedb);
rtn = await this.service.bulkCreate(tradedb);
}
return system.getResult(rtn)
}catch (e) {
return system.getResult(e)
} }
return system.getResult(rtn)
} }
/** /**
...@@ -168,6 +163,7 @@ class TrademarkCtl extends CtlBase { ...@@ -168,6 +163,7 @@ class TrademarkCtl extends CtlBase {
//接受队列返回消息 //接受队列返回消息
async notify(p, q, req) { async notify(p, q, req) {
console.log("=====================>接受队列消息",p);
let update = []; let update = [];
let upload_id = p.actionBody.messageBody.upload_id; let upload_id = p.actionBody.messageBody.upload_id;
let upload = await this.uploadSve.findOne({ let upload = await this.uploadSve.findOne({
...@@ -182,7 +178,7 @@ class TrademarkCtl extends CtlBase { ...@@ -182,7 +178,7 @@ class TrademarkCtl extends CtlBase {
trademark_id: db.id, trademark_id: db.id,
tm_code: db.code tm_code: db.code
})); }));
let res = await this.service.dao.model.bulkCreate(tradedb, {updateOnDuplicate: ["tm_code"]}); let res = await this.service.dao.model.bulkCreate(update, {updateOnDuplicate: ["tm_code"]});
return system.getResult(res) return system.getResult(res)
} }
......
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