var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;

class LaunchchannelCtl extends CtlBase {
    constructor() {
        super("launchchannelmag", CtlBase.getServiceName(LaunchchannelCtl));
        this.launchchannelSve = system.getObject('service.configmag.launchchannelSve');
    }

    /**
     * 重写添加方法
     * @param pobj
     * @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
     */
    async create(pobj){
        const result = await this.launchchannelSve.createChannel(pobj);
        return result;
    }

    /**
     * 重写查询
     * @param pobj
     * @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
     */
    async findAndCountAll(pobj){
        pobj.search.company_id = pobj.company_id;
        const result = await this.launchchannelSve.findByCompanyId(pobj);
        return result;
    }
}

module.exports = LaunchchannelCtl;
