const system = require("../../../system");
const mediaaggregationDao = system.getObject("db.mediaaggregation.mediaaggregationDao");

class MediaaggregationSve {
    constructor() {
        
    }
    //服务列表
    async productList(pobj) {
        if (!pobj || !pobj.actionBody || !pobj.actionBody.product_type_code) {
            return system.getResultFail(-100, "参数错误");
        }
        var res = await mediaaggregationDao.productList(pobj);
        return system.getResultSuccess(res);
    }

    //首页轮播图
    async rotationChartList(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.rotationChartList(pobj);
        return system.getResultSuccess(res);
    }
    
    //列表头图
    async tablePicList(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.tablePicList(pobj);
        return system.getResultSuccess(res);
    }
    //留资表单产品
    async needProductList(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.needProductList(pobj);
        return system.getResultSuccess(res);
    }


    //热门推荐
    async popularRecommendationList(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.popularRecommendationList(pobj);
        return system.getResultSuccess(res);
    }



    //产品分类一类
    async productTypeFirst(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.productTypeFirst(pobj);
        return system.getResultSuccess(res);
    }

    //产品分类二类
    async productTypeSecend(pobj) {
        if (!pobj || !pobj.actionBody || !pobj.actionBody.p_code) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.productTypeSecend(pobj);
        return system.getResultSuccess(res);
    }
    //产品详情
    async productDetail(pobj) {
        if (!pobj || !pobj.actionBody || !pobj.actionBody.code) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.productDetail(pobj);
        return system.getResultSuccess(res);
    }

    //吸底菜单
    async bottomMenuConfig(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.bottomMenuConfig(pobj);
        return system.getResultSuccess(res);
    }

    //周期产品
    async cycleProduct(pobj) {
        if (!pobj) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.cycleProduct(pobj);
        return system.getResultSuccess(res);
    }
    
    //二级留资页
    async secondLevelNeedConfig(pobj) {
        if (!pobj || !pobj.actionBody.code) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.secondLevelNeedConfig(pobj);
        return system.getResultSuccess(res);
    }
    
    //二类产品资质选项(选取数据线索的数据)、留资表单产品列表(我需要)
    async clueMaintenance(pobj) {
        if (!pobj || !pobj.actionBody.apiType) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.clueMaintenance(pobj);
        return system.getResultSuccess(res);
    }

    //周期产品二类
    async cycleProductSecend(pobj) {
        if (!pobj || !pobj.actionBody.cycle_type) {
            return system.getResultFail(-100, "参数错误");
        }

        var res = await mediaaggregationDao.cycleProductSecend(pobj);
        return system.getResultSuccess(res);
    }
    
}


module.exports = MediaaggregationSve;