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

  extraWhere(obj, w){
    let pageType = obj.pageType || 0;
    console.log(obj.pageType, "obj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageTypeobj.pageType");
    if(pageType == 1) {
      w["status"] = {[this.db.Op.in]: ['1']};
    } else if (pageType == 2) {
      w["status"] = {[this.db.Op.in]: ['2']};
    } else if (pageType == 3) {
      w["status"] = {[this.db.Op.in]: ['4','8','16']};
    }
    return w;
  }

  extraModelFilter(){
    console.log("99999999999999999999999999999999999999");
    let v = [
      {model:this.db.models.channelmanageallot,attributes:["id","channelName","channelCode"]},
      {model:this.db.models.businesschance,attributes:["id","publisherName","publisherMobile","chanceType", "chanceTypeName", "channelProfitRatio"]},
      {model:this.db.models.user,attributes:["id","userName"]},
    ]
    return {"key":"include","value": v};
  }
  orderBy(){
    //return {"key":"include","value":{model:this.db.models.app}};
    return [["updated_at","DESC"]];
  }
}
module.exports=BusinessallotDao;
