轮播
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
namespace app\common\controller;
|
namespace app\common\controller;
|
||||||
|
|
||||||
use app\common\controller\BaseController;
|
use app\common\controller\BaseController;
|
||||||
|
use app\common\service\OssService;
|
||||||
use app\common\traits\crud\CrudControllerTrait;
|
use app\common\traits\crud\CrudControllerTrait;
|
||||||
use app\common\service\BannerService;
|
use app\common\service\BannerService;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
@@ -27,6 +28,12 @@ class BannerController extends BaseController
|
|||||||
try {
|
try {
|
||||||
$params = $request->all();
|
$params = $request->all();
|
||||||
$result = $this->service->getBanner($params);
|
$result = $this->service->getBanner($params);
|
||||||
|
foreach ($result as $key => $value) {
|
||||||
|
if (isset($value['image_url']) && !empty($value['image_url'])){
|
||||||
|
$ossservice = new OssService();
|
||||||
|
$result[$key]['image_url_pull'] = $ossservice->generatePrivateUrl($value['image_url']);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $this->success($result, '获取轮播列表');
|
return $this->success($result, '获取轮播列表');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->error($e->getMessage());
|
return $this->error($e->getMessage());
|
||||||
@@ -39,12 +46,16 @@ class BannerController extends BaseController
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
// protected function indexFormat($data)
|
protected function indexFormat($data)
|
||||||
// {
|
{
|
||||||
// if (isset($data['created_at']))
|
if (isset($data['created_at']))
|
||||||
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||||
// if (isset($data['updated_at']))
|
if (isset($data['updated_at']))
|
||||||
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||||
// return $data;
|
if (isset($data['image_url']) && !empty($data['image_url'])){
|
||||||
// }
|
$ossservice = new OssService();
|
||||||
|
$data['image_url_pull'] = $ossservice->generatePrivateUrl($data['image_url']);
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user