样机小程序

This commit is contained in:
2025-12-08 17:37:34 +08:00
commit d19bb9046b
175 changed files with 19427 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace app\admin\controller;
use app\common\controller\BaseController;
use app\common\service\OssService;
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());
}
}
/**
* 列表页数据格式化
*
* @param array $data
* @return array
*/
protected function indexFormat($data)
{
if (isset($data['created_at']))
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
if (isset($data['updated_at']))
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
if (isset($data['image_url']) && !empty($data['image_url'])){
$ossservice = new OssService();
$data['image_url_pull'] = $ossservice->generatePrivateUrl($data['image_url']);
}
return $data;
}
}