login_white = 'all';//登录白名单 $this->majia_white = array('get');//超级管理员披上马甲可操作权限 $this->load->model('app/appusual/app_cms_model', 'cms_model'); } /** * @return array * @throws Exception */ protected function get() { $page = $this->input_param('page'); $size = $this->input_param('size'); $position = $this->input_param('position'); $type = $this->input_param('type'); !$page && $page = 1; !$size && $size = 20; $now = time(); $where = array( 'app_id' => $this->app_id, 'status' => self::STATUS_NOR, ); if (is_numeric($position)) { $where['position'] = $position; } elseif ($position) { $where["position in ({$position})"] = null; } if($type == 1){ $where['e_time <= '] = time(); } else { $where['e_time >= '] = time(); } $total = $this->cms_model->count($where); $lists = array(); if ($total) { $select = 'id, title, cover, url, position, content,e_time'; $rows = $this->cms_model->select($where, 'sort desc, id desc', $page, $size, $select); foreach ($rows as $item) { $value = array( 'id' => $item['id'], 'title' => $item['title'], 'img' => $item['cover'] ? build_qiniu_image_url($item['cover']) : '', 'url' => build_app_url($item['url']), 'content' => $item['content'], 'e_time' => date('Y-m-d H:i:s',$item['e_time']), 'status' => $item['e_time'] $lists, 'total' => $total ); return $data; } }