where("create_time", "between", [strtotime($where['start_time'] . " 00:00:00"), strtotime($where['end_time'] . " 23:59:59")]); } if ($where['title'] != '') $model = $model->where("title|content", "like", "%$where[title]%"); if ($where['is_read'] != '') $model = $model->where("is_read", $where['is_read']); if ($where['aid'] != '') $model = $model->where("aid", $where['aid']); $model = $model->order("is_read"); $model = $model->order("create_time desc"); return $model->paginate(10)->appends($where); } /** * 添加记录 * @param array $data * @return int|string */ public static function addLog(array $data) { return self::create($data); } /** * 后台首页获取通知信息 * @param int $num * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public static function pageList(int $num) { $model = new self; $model = $model->where("is_read", 0); $count = self::count(); $model = $model->order("create_time desc"); $model = $model->page(1, $num); $data = $model->select(); if ($data) $data = $data->toArray(); return compact("data", "count"); } }