64 行
1.7 KiB
PHP
64 行
1.7 KiB
PHP
<?php
|
|
|
|
namespace addons\official\controller\web;
|
|
|
|
use addons\official\model\OfficialListDownload;
|
|
use think\Request;
|
|
|
|
class OfficialDownload extends OfficialBaseController
|
|
{
|
|
protected $model;
|
|
protected $noNeedLogin = '*';
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
public function __construct(Request $request = null)
|
|
{
|
|
$this->model = new OfficialListDownload();
|
|
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'])
|
|
->paginate(8, $simple = $this->isMobile(), $config = [
|
|
'query' => ['pid' => $p_id, 'sid' => $son_id]
|
|
]);
|
|
}
|
|
return view("web/official_download/list{$this->Mobile}", compact('res', 'data'));
|
|
}
|
|
|
|
//下载
|
|
public function download()
|
|
{
|
|
$id = (int)input('param.id');
|
|
//增加模型
|
|
$this->addClick($this->model, $id);
|
|
//查询数据
|
|
$data = $this->model
|
|
->where('id', $id)
|
|
->where('deletetime', null)
|
|
->find();
|
|
//跳转下载
|
|
$this->success('即将下载', cdnurl($data['download_file']));
|
|
}
|
|
|
|
|
|
} |