This commit is contained in:
2026-01-05 16:15:27 +08:00
parent 8470fdc2a9
commit cc5fe0bcaa
2 changed files with 33 additions and 8 deletions
+19 -8
View File
@@ -2,6 +2,7 @@
namespace app\common\controller;
use app\common\controller\BaseController;
use app\common\service\OssService;
use app\common\traits\crud\CrudControllerTrait;
use app\common\service\UsedCarService;
@@ -22,12 +23,22 @@ class UsedCarController extends BaseController
* @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']);
// return $data;
// }
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 (!empty($data['images'])){
$images = explode(',', $data['images']);
$ossService = new OssService();
$images_pull = [];
foreach ($images as $image){
$images_pull[] = $ossService->generatePrivateUrl($image);
}
$data['images_pull'] = $images_pull;
}
return $data;
}
}