input('search', "")); $start = $end = null; $fieldSearchable = $this->repository->getFieldsSearchable(); foreach ($search as $value) { if (!empty($value)) { list($one, $tow) = explode(":", $value); if (!empty($fieldSearchable[$one])) { if ($fieldSearchable[$one] == 'like') $tow = "%{$tow}%"; $where[] = [$one, $fieldSearchable[$one], $tow]; } elseif ($one == 'start') { $start = $tow . " 00:00:00"; } elseif ($one == 'end') { $end = $tow . " 23:59:59"; } else { continue; } } } return function ($query) use ($where, $start, $end) { if ($start) $where[] = ['created_at', '>=', $start]; if ($end) $where[] = ['created_at', '<=', $end]; if ($where) { $query->where($where); } }; } /** * 数据更新 */ protected function _indexPost($datum) { foreach ($datum as $value){ $value->{'type'}=MoneyDetailServer::creatServer()->getTypeArr($value->{'type'}); $value->{'status'}=MoneyDetailServer::creatServer()->getStatusArr($value->{'status'}); $value->{'add_reduce'}=MoneyDetailServer::creatServer()->getAddReduceArr($value->{'add_reduce'}); } return $datum; } function _indexGet(){ $type=MoneyDetailServer::creatServer()->getType(); $status=MoneyDetailServer::creatServer()->getStatus(); return ['type'=>$type,'status'=>$status]; } function _indexJoin() { $model = MoneyDetail::from('money_details as d') ->leftJoin('members as m', 'm.id', '=', 'd.m_id'); return $model; } function _indexSelect() { return ['d.*', 'm.address']; } }