84 lines
1.9 KiB
PHP
84 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace app\modules\api\controllers;
|
|
|
|
use function AlibabaCloud\Client\value;
|
|
use app\models\Banner;
|
|
use app\models\Option;
|
|
use app\modules\api\behaviors\LoginBehavior;
|
|
use Yii;
|
|
use yii\web\NotFoundHttpException;
|
|
use yii\filters\VerbFilter;
|
|
|
|
/**
|
|
*轮播图
|
|
*/
|
|
class BannerController extends Controller
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function behaviors()
|
|
{
|
|
return array_merge(parent::behaviors(), [
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
'ignore' => [
|
|
'api/banner/index',
|
|
'api/banner/description',
|
|
]
|
|
]
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 轮播图列表
|
|
*/
|
|
public function actionIndex()
|
|
{
|
|
$list = Banner::getBannerList(Banner::ZONE_ID_WXAPP_INDEX);
|
|
|
|
$arr = [];
|
|
$banner_arr = [11, 12, 13];
|
|
|
|
foreach ($list as $key => $value) {
|
|
if (in_array($value['id'], $banner_arr)) {
|
|
$arr[] = $value;
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'code' => 0,
|
|
'msg' => 'ok',
|
|
'data' => $list,
|
|
'banner' => $arr,
|
|
];
|
|
return $this->responseHandler($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* showdoc
|
|
* @catalog 首页公告
|
|
* @title 首页公告
|
|
* @description 首页公告
|
|
* @method get
|
|
* @url /api/banner/description
|
|
* @return {"code":0,"msg":"ok","data":"追求完美、追求和谐、追求卓越"}
|
|
* @return_param data string 公告
|
|
* @remark
|
|
*/
|
|
public function actionDescription()
|
|
{
|
|
$list = Option::getOption('SITE_DESCRIPTION');
|
|
$data = [
|
|
'code' => 0,
|
|
'msg' => 'ok',
|
|
'data' => $list
|
|
];
|
|
return $this->responseHandler($data);
|
|
|
|
}
|
|
}
|