This commit is contained in:
2026-01-14 13:44:52 +08:00
parent 18e71af8cc
commit 2a1c61df61
+20
View File
@@ -107,6 +107,26 @@ class UsedCarService
return $data;
}
public function beforeServiceUpdate($data, Request $request): array
{
if (empty($data['product_name'])) {
throw new BusinessException('产品名称不能为空');
}
if (empty($data['images'])) {
throw new BusinessException('产品图片不能为空');
}
if (empty($data['price'])) {
$data['price'] = 0;
}
if (!empty($data['attachment'])) {
$data['attachment'] = json_encode($data['attachment']);
}else{
$data['attachment'] = '';
}
$data['mileage'] = str_replace(['K','M','k','m'], '', $data['mileage']);
return $data;
}
public function getcode($userId){
$userCount = Redis::get('used_car_count_'.$userId, 0);
$todayStart = strtotime('today');