Prechádzať zdrojové kódy

[智价云] 采集轮次信息配置

tangyuanwang 12 hodín pred
rodič
commit
cd0d3c6030

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

@@ -246,6 +246,8 @@ class Product extends Controller
         $sampling_cycle = request('sampling_cycle', '0');
         $sampling_start_time = request('sampling_start_time', '');
         $sampling_end_time = request('sampling_end_time', '');
+        $round_number = request('round_number', 1);
+        $all_data['round_number'] = $round_number;
         $all_data['sampling_cycle'] = $sampling_cycle;
         $all_data['sampling_start_time'] = $sampling_start_time ? strtotime($sampling_start_time . '00:00:00') : '0';
         $all_data['sampling_end_time'] = $sampling_end_time ? strtotime($sampling_end_time . '23:59:59') : '0';
@@ -355,6 +357,8 @@ class Product extends Controller
         $sampling_cycle = request('sampling_cycle', '0');
         $sampling_start_time = request('sampling_start_time', '');
         $sampling_end_time = request('sampling_end_time', '');
+        $round_number = request('round_number', 1);
+        $all_data['round_number'] = $round_number;
         $all_data['sampling_cycle'] = $sampling_cycle;
         $all_data['sampling_start_time'] = $sampling_start_time ? strtotime($sampling_start_time . '00:00:00') : '0';
         $all_data['sampling_end_time'] = $sampling_end_time ? strtotime($sampling_end_time . '23:59:59') : '0';

+ 10 - 1
app/Models/Manager/Collect/Product.php

@@ -59,16 +59,23 @@ class Product extends Model
      */
     public function addProduct_content($data)
     {
+        // 计算品规数量
+        $product_specs_data = isset($data['product_specs']) && $data['product_specs'] != '' ? explode(',', $data['product_specs']) : '';
+        //移除数组内空值
+        $product_specs_data = !empty($product_specs_data) ? array_filter($product_specs_data) : '';
         $insert_data = [
             'enable_full_quantity' => isset($data['enable_full_quantity']) ? $data['enable_full_quantity'] : 0,
             'platform' => $data['platform'],
+            'product_brand' => $data['product_brand'],
             'product_name' => $data['product_name'],
             'product_specs' => $data['product_specs'],
+            'product_specs_number' => $data['product_specs'] ? count($product_specs_data) : 1,
             'minimum_order_quantity' => $data['minimum_order_quantity'],
             'sampling_cycle' => $data['sampling_cycle'],
+            'round_number' => $data['round_number'],
             'sampling_start_time' => $data['sampling_start_time'],
             'sampling_end_time' => $data['sampling_end_time'],
-            'product_brand' => $data['product_brand'],
+            'company_id' => $data['company_id'],
             'insert_time' => time(),
         ];
         $Product_id = $this->insertGetId($insert_data);
@@ -111,6 +118,7 @@ class Product extends Model
                 'product_specs_number' => $data['product_specs'] ? count($product_specs_data) : 1,
                 'minimum_order_quantity' => $data['minimum_order_quantity'],
                 'sampling_cycle' => $data['sampling_cycle'],
+                'round_number' => $data['round_number'],
                 'sampling_start_time' => $data['sampling_start_time'],
                 'sampling_end_time' => $data['sampling_end_time'],
                 'company_id' => $data['company_id'],
@@ -168,6 +176,7 @@ class Product extends Model
             $Product->product_specs_number = $product_specs_data ? count($product_specs_data) : 1;
             $Product->minimum_order_quantity = $data['minimum_order_quantity'];
             $Product->sampling_cycle = $data['sampling_cycle'];
+            $Product->round_number = $data['round_number'];
             $Product->sampling_start_time = $data['sampling_start_time'];
             $Product->sampling_end_time = $data['sampling_end_time'];
             $Product->update_time = time();