public function getDemands($idstr, $bids = "", $key = "") { $ids = explode(",", $idstr); $conditions = " 1!=1"; foreach ($ids as $id) { $id = trim($id); if (empty($id)) { continue; } $conditions .= " or sortpath like '%," . $id . ",%' "; } $catemodel = new Category(); $catarray = $catemodel->getbysql2array($conditions); if (!$catarray) { return; } $cateids = implode(",", $catarray); //TODO:去掉注释 $condition = " 1=1 "; $condition = " status=0 and is_pay=1 "; // $condition.='and status != -1 and deposit!=0'; $condition .= " and category_id in ( {$cateids} )"; $condition .= " and expire_time>now()"; if (substr($bids, -1) == ',') { $bids = substr($bids, 0, -1); } if (!empty($bids)) { $condition .= " and bid in ( {$bids} ) "; } if (!empty($key)) { $condition .= " and title like '%" . urldecode($key) . "%' "; } //echo "condition =$condition";exit(); return $this->whereRaw($condition)->orderby("id", "desc")->get()->toArray(); }