35 lines
852 B
PHP
35 lines
852 B
PHP
|
|
<?php
|
||
|
|
namespace app\admin\controller;
|
||
|
|
|
||
|
|
use app\common\controller\BaseController;
|
||
|
|
use app\common\traits\crud\CrudControllerTrait;
|
||
|
|
use app\common\service\BannerService;
|
||
|
|
|
||
|
|
class BannerController extends BaseController
|
||
|
|
{
|
||
|
|
use CrudControllerTrait;
|
||
|
|
|
||
|
|
protected $service;
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
$this->service = new BannerService();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 轮播图模块
|
||
|
|
* @return \support\Response
|
||
|
|
*/
|
||
|
|
public function getBannerModule()
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
$raw = $this->service->getBannerModule();
|
||
|
|
$data = $this->transformData($raw, method_exists($this, 'indexFormat')
|
||
|
|
? [$this, 'indexFormat']
|
||
|
|
: null);
|
||
|
|
return $this->success($data);
|
||
|
|
} catch (\Throwable $e) {
|
||
|
|
return $this->error($e->getMessage());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|