41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\controller\Api;
|
|
use think\Config;
|
|
/**
|
|
* 首页接口
|
|
*/
|
|
class Index extends Api
|
|
{
|
|
protected $noNeedLogin = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
|
|
/**
|
|
* 首页
|
|
*
|
|
*/
|
|
public function index()
|
|
{
|
|
$data['banner'] = \addons\cms\model\Block::getBlockList(["id"=>"block","name"=>"indexfocus","row"=>"5","orderby"=>"weigh"]);
|
|
$data['hotNews'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"5","channel"=>"43","type"=>"sons"]);
|
|
$data['industry'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"4","channel"=>"44","type"=>"sons"]);
|
|
$data['fly'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"6","channel"=>"45","type"=>"sons"]);
|
|
$data['atlas'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","limit"=>"4","channel"=>"46","type"=>"sons"]);
|
|
$data['video'] = \addons\cms\model\Archives::getArchivesList(["id"=>"item","channel"=>"47","addon"=>"video","limit"=>"0,5"]);
|
|
|
|
foreach ($data as $keys => $vals) {
|
|
if (count($vals) > 1) {
|
|
foreach ($vals as $key => $val) {
|
|
$data[$key][$key] = $val->toArray();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return json($data);
|
|
|
|
}
|
|
}
|