Преглед изворни кода

[智价云] 采集周期时间回滚

tangyuanwang пре 1 месец
родитељ
комит
0897d24255
1 измењених фајлова са 6 додато и 9 уклоњено
  1. 6 9
      app/Http/Controllers/Manager/Collect/Product.php

+ 6 - 9
app/Http/Controllers/Manager/Collect/Product.php

@@ -139,7 +139,7 @@ class Product extends Controller
         // 接收数据
         $all_data = request()->all();
         //采集信息配置
-        $minimum_order_quantity = request('minimum_order_quantity', 0);
+        $minimum_order_quantity = request('minimum_order_quantity', 1);
         $sampling_cycle = request('sampling_cycle', '0');
         $sampling_start_time = request('sampling_start_time', '');
         $sampling_end_time = request('sampling_end_time', '');
@@ -156,11 +156,8 @@ class Product extends Controller
         $Product = $ProductModel->where($where)->first();
         if (!$Product) return json_send(['code' => 'error', 'msg' => '记录不存在']);
         $oldData = $Product->toarray();
-        //如果修改采集周期,则校验采集时间是否在明天以后
-        if ($sampling_cycle != $Product->sampling_cycle) {
-            $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
-            if ($all_data['sampling_start_time']  && $all_data['sampling_start_time'] < $allow_sampling_time) return json_send(['code' => 'error', 'msg' => '采集最早开始时间为明天']);
-        }
+        $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
+        if ($all_data['sampling_start_time']  && $all_data['sampling_start_time'] < $allow_sampling_time) return json_send(['code' => 'error', 'msg' => '采集最早开始时间为明天']);
         $result =  $ProductModel->editProduct_content($Product, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -192,9 +189,9 @@ class Product extends Controller
             //获取商品启用数量
             // $product_count = $ProductModel->where('status', 0)->count();
             //判断是否超过限制
-            if ($product_count >= 50) {
-                return json_send(['code' => 'error', 'msg' => '启用数量超过限制,不能超过50条']);
-            }
+            // if ($product_count >= 50) {
+            //     return json_send(['code' => 'error', 'msg' => '启用数量超过限制,不能超过50条']);
+            // }
         }
         // 查询用户
         $where = ['id' => $id];