This commit is contained in:
2026-01-05 17:30:53 +08:00
parent 9675ea4a15
commit d57978d431
2 changed files with 75 additions and 0 deletions
@@ -41,4 +41,29 @@ class UsedCarController extends BaseController
}
return $data;
}
/**
* 列表页数据格式化
*
* @param array $data
* @return array
*/
protected function showFormat($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;
}
}