luck-draw/app/controller/Index.php

39 lines
891 B
PHP

<?php
namespace app\controller;
use app\exception\RepositoryException;
use app\model\Archives;
use app\model\ArchivesCategory;
use app\model\Block;
use app\model\Slide;
use app\model\SlidePosition;
use Exception;
use think\response\Redirect;
/**
* auth 王兴龙 2022-02-18
* */
class Index extends Base
{
/**
* @return Redirect
* @throws Exception
*/
public function index()
{
try {
//banner
$this->data['slide'] = Slide::findList([["position","=",SlidePosition::home_position]])['list'];
$this->data['topCategoryId'] = ArchivesCategory::index_id ;
//碎片
$this->data['blocks'] = Block:: getByCategoryId(ArchivesCategory::index_id);
return $this->view();
}catch (RepositoryException $e){
return $this->error("服务器错误");
}
}
}