Commit b5feb287 by 兰国旗

添加图片管理,投放方式,营销主体的修改、删除判断限制

parent 55f7d157
......@@ -15,7 +15,17 @@ class MainInfoCtl extends CtlBase {
async refQuery(pobj, qobj, req) {
pobj.refwhere.company_id = pobj.company_id;
let rtn = await this.service.refQuery(pobj);
return rtn
return rtn;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return up;
}
}
module.exports = MainInfoCtl;
......@@ -6,10 +6,21 @@ class PutTypeCtl extends CtlBase {
constructor() {
super("configmag", CtlBase.getServiceName(PutTypeCtl));
}
async create(pobj, qobj, req) {
pobj.company_id = req && req.xctx && req.xctx.companyid ?req.xctx.companyid : "";
const up = await this.service.create(pobj);
return up;
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return up;
}
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return up;
}
}
module.exports = PutTypeCtl;
......@@ -23,5 +23,31 @@ class MaininfoService extends ServiceBase {
}
return system.getResultSuccess(this.dao.create(pobj));
}
async update(pobj) {
let whereParams = {
lauch_type_code: pobj.code
}
let searchResult = await this.templateLink.findOne(whereParams, []);
if (searchResult.is_enabled == 1) {
return system.getResultFail(-104, '该业务正在投放中,不能修改');
}
return system.getResultSuccess(this.dao.update(pobj));
}
async delete(pobj) {
let whereParams = {
id: pobj.id
}
let searchResult = await this.findOne(whereParams, []);
let linkWhere = {
lauch_type_code: searchResult.code
}
let searchLink = await this.templateLink.findOne(linkWhere, []);
if (searchLink.is_enabled == 1) {
return system.getResultFail(-105, '该业务正在投放中,不能删除');
}
return system.getResultSuccess(this.dao.delete(pobj));
}
}
module.exports = MaininfoService;
\ No newline at end of file
......@@ -4,9 +4,10 @@ const settings = require("../../../../config/settings");
class PuttypeService extends ServiceBase {
constructor() {
super("configmag", ServiceBase.getDaoName(PuttypeService));
this.templateLink = system.getObject("db.template.templatelinkDao");;
}
async create(pobj){
async create(pobj) {
if (!pobj.name) {
return system.getResultFail(-101, 'name can not be empty');
}
......@@ -22,5 +23,31 @@ class PuttypeService extends ServiceBase {
}
return system.getResultSuccess(this.dao.create(pobj));
}
async update(pobj) {
let whereParams = {
lauch_type_code: pobj.code
}
let searchResult = await this.templateLink.findOne(whereParams, []);
if (searchResult.is_enabled == 1) {
return system.getResultFail(-104, '该业务正在投放中,不能修改');
}
return system.getResultSuccess(this.dao.update(pobj));
}
async delete(pobj) {
let whereParams = {
id: pobj.id
}
let searchResult = await this.findOne(whereParams, []);
let linkWhere = {
lauch_type_code: searchResult.code
}
let searchLink = await this.templateLink.findOne(linkWhere, []);
if (searchLink.is_enabled == 1) {
return system.getResultFail(-105, '该业务正在投放中,不能删除');
}
return system.getResultSuccess(this.dao.delete(pobj));
}
}
module.exports = PuttypeService;
\ No newline at end of file
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