const system = require("../../../system");
const Dao = require("../../dao.base");
class PlatformchannelDao extends Dao {
    constructor() {
        super(Dao.getModelName(PlatformchannelDao));
    }

    async findByamong(params) {
        var sql = "SELECT pc.platform_id,pc.channel_id,cm.origin_merchant_id,cm.origin_id,cm.merchant_name,cm.id,cm.contact_mobile from ch_platform_channel pc JOIN ch_channel_merchant cm ON pc.channel_id = cm.channel_id ";
        return await this.customQuery(sql) || [];
    }

    async allChannelIds() {
        let sql = "SELECT channel_id FROM `ch_platform_channel`";
        let list = await this.customQuery(sql) || [];
        let rs = [];
        for(let item of list) {
            rs.push(item.channel_id);
        }
        return rs;
    }
}
module.exports = PlatformchannelDao;
