model = new OfficialListProduct(); parent::__construct($request); } /** * 列表 */ public function list() { $data = []; $p_id = (int)input('param.pid'); $son_id = (int)input('param.sid'); $this->setBasic(); //查詢父级 $res = $this->get_cate_pid_in_sid(); //如果所有子级别和父级一样 $status = 1; if (($p_id == $son_id) && (count($res['son']))) { $status = 2; $ids = [$p_id]; foreach ($res['son'] as $item) { if (($res['status'] != $item['status']) || ($res['official_rule_id'] != $item['official_rule_id'])) { $status = 1; } $ids[] = $item['id']; } } if ($son_id) { $data = $this->model; if ($status == 1) { $data = $data->where('official_category_id', $son_id); } else { $data = $data->whereIn('official_category_id', $ids); } $data = $data->where('language', $this->language) ->where('deletetime', null) ->order('weigh', 'desc') ->field(['id,title,image,createtime']) ->paginate(8, $simple = $this->isMobile(), $config = [ 'query' => ['pid' => $p_id, 'sid' => $son_id] ]); } return view("web/official_product/list{$this->Mobile}", compact('res', 'data')); } /** * 详情 */ public function details() { $id = (int)input('param.id'); //增加点击量 $this->addClick($this->model, $id); $data = $this->model ->where('id', $id) ->where('deletetime', null) ->find(); $this->setBasic(999, $data['title']); $category = (new OfficialCategory())->where('id', $data['official_category_id'])->field(['id,name'])->find(); //前面一个新闻 $before = $this->model ->where('id', '<', $data['id']) ->where('official_category_id', $data['official_category_id']) ->where('language', $this->language) ->where('deletetime', null) ->order('id', 'desc') ->field(['id,title']) ->find(); //后面第一个新闻 $after = $this->model ->where('id', '>', $data['id']) ->where('official_category_id', $data['official_category_id']) ->where('language', $this->language) ->where('deletetime', null) ->order('id', 'asc') ->field(['id,title']) ->find(); return view("web/official_product/details{$this->Mobile}", compact('data', 'category', 'before', 'after')); } /** * 核心服务独立页:软件开发 */ public function service_software() { request()->get(['service' => 'software', 'pid' => 19, 'sid' => 19]); return $this->list(); } /** * 核心服务独立页:APP与小程序定制 */ public function service_app() { request()->get(['service' => 'app', 'pid' => 19, 'sid' => 19]); return $this->list(); } /** * 核心服务独立页:智能体开发 */ public function service_agent() { request()->get(['service' => 'agent', 'pid' => 19, 'sid' => 19]); return $this->list(); } }