88 行
2.7 KiB
PHP
88 行
2.7 KiB
PHP
<?php
|
|
|
|
|
|
namespace addons\official\controller\web;
|
|
|
|
|
|
use addons\official\model\OfficialCategory;
|
|
use addons\official\model\OfficialListVideo;
|
|
use think\Request;
|
|
|
|
class OfficialVideo extends OfficialBaseController
|
|
{
|
|
protected $model;
|
|
protected $noNeedLogin = '*';
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
public function __construct(Request $request = null)
|
|
{
|
|
$this->model = new OfficialListVideo();
|
|
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();
|
|
|
|
if ($son_id) {
|
|
$data = $this
|
|
->model
|
|
->where('official_category_id', $son_id)
|
|
->where('language', $this->language)
|
|
->where('deletetime', null)
|
|
->order('weigh', 'desc')
|
|
->field(['id,title,image'])
|
|
->paginate(8, $simple = $this->isMobile(), $config = [
|
|
'query' => ['pid' => $p_id, 'sid' => $son_id]
|
|
]);
|
|
}
|
|
return view("web/official_video/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'], '', $data['subheading']);
|
|
$category = (new OfficialCategory())->where('id', $data['official_category_id'])->field(['id,name,e_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_video/details{$this->Mobile}", compact('data', 'category', 'before', 'after'));
|
|
}
|
|
|
|
} |