Procházet zdrojové kódy

[智价云] 开始结束时间校验

tangyuanwang před 1 dnem
rodič
revize
3443599740

+ 2 - 0
app/Http/Controllers/Manager/Collect/Product.php

@@ -272,6 +272,7 @@ class Product extends Controller
         if (is_numeric($round_number) && $round_number > 3) return json_send(['code' => 'error', 'msg' => '轮次数量不能超过3']);
         if ($all_data['sampling_start_time']  && strtotime(date('Y-m-d', $all_data['sampling_start_time']) . '23:59:59') < time()) return json_send(['code' => 'error', 'msg' => '采集开始时间必须大于当前时间']);
         if ($all_data['sampling_end_time']  && $all_data['sampling_end_time'] < time()) return json_send(['code' => 'error', 'msg' => '采集结束时间必须大于当前时间']);
+        if ($all_data['sampling_start_time'] > $all_data['sampling_end_time']) return json_send(['code' => 'error', 'msg' => '采集结束时间必须大于开始时间']);
 
         $platform_string = $all_data['platform'];
         if (empty($platform_string)) return json_send(['code' => 'error', 'msg' => '平台不能为空']);
@@ -423,6 +424,7 @@ class Product extends Controller
         if (is_numeric($round_number) && $round_number > 3) return json_send(['code' => 'error', 'msg' => '轮次数量不能超过3']);
         if ($all_data['sampling_start_time']  && strtotime(date('Y-m-d', $all_data['sampling_start_time']) . '23:59:59') < time()) return json_send(['code' => 'error', 'msg' => '采集开始时间必须大于当前时间']);
         if ($all_data['sampling_end_time']  && $all_data['sampling_end_time'] < time()) return json_send(['code' => 'error', 'msg' => '采集结束时间必须大于当前时间']);
+        if ($all_data['sampling_start_time'] > $all_data['sampling_end_time']) return json_send(['code' => 'error', 'msg' => '采集结束时间必须大于开始时间']);
 
         $platform_string = $all_data['platform'];
         if (empty($platform_string)) return json_send(['code' => 'error', 'msg' => '平台不能为空']);