toData('400', lang('parameter_error')); } $where = ['state'=>1]; if (isset($param['type'])) { $where['type'] = $param['type']; } $list = InformationArticleModel::where($where)->order('id', 'desc')->paginate([ 'list_rows' => $param['limit'], 'page' => $param['page'], ]); return $this->toData('0', 'Successful', [ 'list' => $list->items(), 'total' => $list->total(), 'page' => $list->currentPage(), 'last_page' => $list->lastPage(), ]); } catch (\Exception $d) { return $this->toData('500', 'The system is busy'); } } // 获取一条资讯详情 public function informationArticleDetails($param) { try { if (empty($param['id'])) { return $this->toData('400', lang('parameter_error')); } $info = InformationArticleModel::where(['id'=>$param['id']])->find(); if (empty($info)) { return $this->toData('400', lang('data_empty')); } $res = $info->toArray(); return $this->toData('0', 'Successful', $res); } catch (\Exception $d) { return $this->toData('500', 'The system is busy'); } } }