Commit 79857b71 by linboxuan

add tmStatusCheck

parent 833b535e
......@@ -46,6 +46,12 @@ class ProductAPI extends APIBase {
case "createjsonfile": // 2020 0908 lin 新增 json文件生成
opResult = await this.trademarkTransactionSve.createjsonfile();
break;
case "tmStatusCheck": // 2020 0911 lin 新增 上架状态查询
opResult = await this.trademarkTransactionSve.tmStatusCheck(pobj, pobj.actionBody);
break;
case "tmStatus": // 2020 0911 lin 新增 上架状态查询
opResult = await this.trademarkTransactionSve.tmStatusCheck(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -500,7 +500,7 @@ class TrademarktransactionService extends ServiceBase {
return system.getResultFail(-103, "参数错误");
}
if(actionBody.tm.length == 0) {
return system.getResultFail(-110, "标源id为空");
return system.getResultFail(-110, "标源为空");
}
switch (actionBody.status) {
// 如果下架 全部下架
......@@ -540,6 +540,13 @@ class TrademarktransactionService extends ServiceBase {
// 可以优化的地方:比如已经是想修改的状态 怎么做跳过?其他验证是否完善?
}
break;
case "oversales" :
for(var i = 0;i <actionBody.tm.length;i++) {
await this.dao.model.update({publish_status:"oversales"},{ where: { id: actionBody.tm[i].id } })
}
// 这个方法会把其他字段改为null 不使用了
// var tmUpdateResult = await this.dao.model.bulkCreate(actionBody.tm,{updateOnDuplicate:true})
break;
default:
return system.getResultFail(-111, "修改状态错误");
}
......@@ -809,6 +816,23 @@ class TrademarktransactionService extends ServiceBase {
}
async tmStatusCheck(pobj, actionBody) {
if (!pobj || !pobj.actionBody) {
return system.getResultFail(-103, "参数错误");
}
var tmInfo = await this.dao.model.findOne({
where: {
code: actionBody.code,
},
attributes: [
"id",
"publish_status"
],
raw: true
});
return system.getResultSuccess(tmInfo);
}
}
module.exports = TrademarktransactionService;
......
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