const system=require("../../system");
const Dao=require("../dao.base");
class PartnerInfoDao extends Dao{
  constructor(){
    super(Dao.getModelName(PartnerInfoDao));
  }
  async findPartnerList(appId,userId,t=null){
    return await this.model.findAll({where:{app_id:appId,user_id:userId}},{transaction:t});
  }
  async update(obj){
    var obj2=await this.preUpdate(obj);
    await this.model.update(obj2,{where:{id:obj2.id}});
    var user=await this.model.findOne({where:{id:obj2.id}});
    return user;
  }
  async update2(obj,t){
    var obj2=await this.preUpdate(obj);
    await this.model.update(obj2,{where:{id:obj2.id}},{transaction:t});
    var user=await this.model.findOne({where:{id:obj2.id}});
    return user;
  }
  async partnerUpdateOrCreate(partnerInfo,t){
    // var account=  await this.model.findOne({where:{unionId:ac.unionId}},{transaction:t});
    // if(account){
    //   return account;
    // }else{
    //   account=await this.model.create(ac,{transaction:t});
    //   return account;
    // }

  }
  extraWhere(obj,w){
     if(obj.extra){
       w["tagInfo"]={[this.db.Op.like]:"%"+obj.extra+"%"};
     }
     return w;
  }
}
module.exports=PartnerInfoDao;
