sassid = $sassid; } /** * 获取列表数据 * @param $page * @param $where * @param $pageCount * @param $desc */ public function getList($page = 1,$where = [],$pageCount = 20){ $data = $this->field("sp.id,p.title,img,sp.price,p.commission,sp.status,sp.sales,sp.is_new,sp.is_host,sp.ver_bug_count,p.count") ->alias("sp") ->join("product p","p.id = sp.p_id","left") ->where('sp.sassid',$this->sassid) ->when(!empty($where),function ($query) use($where){ if(!empty($where['type'])) { if($where['type'] == 'kc') { $query->where('p.count','>',0); } if($where['type'] == 'nkc') { $query->where('p.count','=',0); } } }) ->paginate(['list_rows'=>$pageCount,'page'=>$page]) ->toArray(); return [$data['total'],$data['data']]; } }