init: 项目初始代码
This commit is contained in:
61
app/index/controller/Download.php
Normal file
61
app/index/controller/Download.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\model\SoftManual as SoftManualModel;
|
||||
use app\index\validate\SoftManual as SoftManualValidate;
|
||||
use think\facade\Lang;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* Class Download
|
||||
* @package app\index\controller
|
||||
*/
|
||||
class Download extends Base
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->model = new SoftManualModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$resource = [];
|
||||
$inputData = $this->request->param();
|
||||
$resource['type'] = $this->model->getDownloadType();
|
||||
|
||||
if (isset($inputData['keyword']) && $inputData['keyword'] != '') {
|
||||
$this->vague['name'] = ($inputData['keyword']);
|
||||
}
|
||||
// $this->request->pathinfo()
|
||||
if (isset($inputData['file_type_id']) && $inputData['file_type_id'] != '' && $inputData['file_type_id'] != 0) {
|
||||
$this->focus['file_type_id'] = $inputData['file_type_id'];
|
||||
}
|
||||
|
||||
$this->sort['sort'] = 'desc';
|
||||
$this->focus['status'] = "0";
|
||||
$result = $this->model->getAllList($inputData,$this->vague,$this->focus,$this->sort);
|
||||
// dump($result);
|
||||
//构建数据
|
||||
if ((isset($result['page']) && !empty($result['page'])) && !empty($result)) {
|
||||
$resource['list'] = $result;
|
||||
} else {
|
||||
if (isset($inputData['keyword']) && $inputData['keyword'] != '') {
|
||||
$this->vague['introduce'] = ($inputData['keyword']);
|
||||
}
|
||||
$result = $this->model->getAllList($inputData,$this->vague,$this->focus,$this->sort);
|
||||
$resource['list'] = $result;
|
||||
}
|
||||
|
||||
// dump($this->model->getLastSql());
|
||||
// dump($resource);
|
||||
// $resource['page'] = $result->render();
|
||||
// $resource['list'] = $result->toArray();
|
||||
// 增加标签显示
|
||||
$metaTitle = $this->model->getMetaTitle($this->languageId,'download');
|
||||
View::assign('meta',$metaTitle);
|
||||
View::assign('resource',$resource);
|
||||
return View::fetch(Lang::getLangSet().DIRECTORY_SEPARATOR.'download/download');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user