request->isPost()) { $page = input('page/d', 1); $limit = input('size/d', 20); $searchParams = input('searchParams'); $search = []; if ($searchParams) { foreach ($searchParams as $key => $param) { if ($param) { if ($key == 'begin_time') { $begin = strtotime($param.' 00:00:00'); $search[] = ['create_time', '>', $begin]; } elseif ($key == 'end_time') { $end = strtotime($param.' 23:59:59'); $search[] = ['create_time', '<', $end]; } else { $search[] = [$key, 'like', '%'.$param.'%']; } } } } $items = LogModel::findList($search, [], $page, $limit, function ($q) { return $q->with(['memberName'])->order('create_time', 'desc'); }); return $this->json(0, '操作成功', $items); } return $this->view(); } }