select()->toArray(); if (!empty($space)) { return $this->getBanner($languageId,$space[0]['id']); } return ['image' => '']; } /** * @param $languageId * @param $data * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getResourceList($languageId,$data):array { return $this->where('site_id',$languageId)->where('status',0)->order('sort','desc')->select()->toArray(); } /** * 获取上一篇,下一篇 */ public function getPreNexInfo($data) { if (isset($data['id'])) { // 下一条 $next = $this->field(['id','title'])->where('id','>',$data['id'])->limit(1)->select()->toArray(); // 上一条 $pre = $this->field(['id','title'])->where('id','<',$data['id'])->limit(1)->select()->toArray(); return [ 'pre' => empty($pre) ? [] : $pre[0], 'next' => empty($next) ? [] : $next[0] ]; } return []; } }