Browse Source

[智价云] 采集启用规则补充

tangyuanwang 2 days ago
parent
commit
10a5e656ac
1 changed files with 18 additions and 0 deletions
  1. 18 0
      app/Http/Controllers/Manager/Collect/Product.php

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

@@ -354,6 +354,12 @@ class Product extends Controller
                                 $q->where('sampling_start_time', '<=', $Product->sampling_end_time);
                             });
                         }
+                        // 新增记录有完整的时间段,数据库有开始时间结束时间未设置
+                        elseif ($sampling_start_time > 0 && $sampling_end_time > 0) {
+                            $query->where(function ($q) use ($sampling_start_time ) {
+                                $q->where('sampling_start_time', '<=', $sampling_start_time);
+                            });
+                        }
                     })
                     ->first();
                 
@@ -501,6 +507,12 @@ class Product extends Controller
                                 $q->where('sampling_start_time', '<=', $Product->sampling_end_time);
                             });
                         }
+                        // 新增记录有完整的时间段,数据库有开始时间结束时间未设置
+                        elseif ($Product->sampling_start_time > 0 && $Product->sampling_end_time > 0) {
+                            $query->where(function ($q) use ($Product ) {
+                                $q->where('sampling_start_time', '<=', $Product->sampling_start_time);
+                            });
+                        }
                     })
                     ->first();
                 
@@ -625,6 +637,12 @@ class Product extends Controller
                                 $q->where('sampling_start_time', '<=', $Product->sampling_end_time);
                             });
                         }
+                        // 新增记录有完整的时间段,数据库有开始时间结束时间未设置
+                        elseif ($Product->sampling_start_time > 0 && $Product->sampling_end_time > 0) {
+                            $query->where(function ($q) use ($Product ) {
+                                $q->where('sampling_start_time', '<=', $Product->sampling_start_time);
+                            });
+                        }
                     })
                     ->first();