|
@@ -61,15 +61,15 @@ class Product extends Model
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
try {
|
|
try {
|
|
|
// 计算品规数量
|
|
// 计算品规数量
|
|
|
- $product_specs_data = explode(',', $data['product_specs']);
|
|
|
|
|
|
|
+ $product_specs_data =isset($data['product_specs']) && $data['product_specs'] !='' ? explode(',', $data['product_specs']) : '';
|
|
|
//移除数组内空值
|
|
//移除数组内空值
|
|
|
- $product_specs_data = array_filter($product_specs_data);
|
|
|
|
|
|
|
+ $product_specs_data = !empty($product_specs_data) ? array_filter($product_specs_data):'';
|
|
|
$insert_data = [
|
|
$insert_data = [
|
|
|
'enable_full_quantity' => $data['enable_full_quantity'],
|
|
'enable_full_quantity' => $data['enable_full_quantity'],
|
|
|
'platform' => $data['platform'],
|
|
'platform' => $data['platform'],
|
|
|
'product_name' => $data['product_name'],
|
|
'product_name' => $data['product_name'],
|
|
|
'product_specs' => $data['product_specs'],
|
|
'product_specs' => $data['product_specs'],
|
|
|
- 'product_specs_number' => count($product_specs_data),
|
|
|
|
|
|
|
+ 'product_specs_number' => $data['product_specs'] ? count($product_specs_data) : 1,
|
|
|
'minimum_order_quantity' => $data['minimum_order_quantity'],
|
|
'minimum_order_quantity' => $data['minimum_order_quantity'],
|
|
|
'sampling_cycle' => $data['sampling_cycle'],
|
|
'sampling_cycle' => $data['sampling_cycle'],
|
|
|
'sampling_start_time' => $data['sampling_start_time'],
|
|
'sampling_start_time' => $data['sampling_start_time'],
|
|
@@ -102,15 +102,15 @@ class Product extends Model
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
try {
|
|
try {
|
|
|
// 计算品规数量
|
|
// 计算品规数量
|
|
|
- $product_specs_data = explode(',', $data['product_specs']);
|
|
|
|
|
|
|
+ $product_specs_data =isset($data['product_specs']) && $data['product_specs'] !='' ? explode(',', $data['product_specs']) : '';
|
|
|
//移除数组内空值
|
|
//移除数组内空值
|
|
|
- $product_specs_data = array_filter($product_specs_data);
|
|
|
|
|
|
|
+ $product_specs_data = !empty($product_specs_data) ? array_filter($product_specs_data):'';
|
|
|
|
|
|
|
|
$Product->enable_full_quantity = $data['enable_full_quantity'];
|
|
$Product->enable_full_quantity = $data['enable_full_quantity'];
|
|
|
$Product->platform = $data['platform'];
|
|
$Product->platform = $data['platform'];
|
|
|
$Product->product_name = $data['product_name'];
|
|
$Product->product_name = $data['product_name'];
|
|
|
$Product->product_specs = $data['product_specs'];
|
|
$Product->product_specs = $data['product_specs'];
|
|
|
- $Product->product_specs_number = count($product_specs_data);
|
|
|
|
|
|
|
+ $Product->product_specs_number = $product_specs_data ? count($product_specs_data) : 1;
|
|
|
$Product->minimum_order_quantity = $data['minimum_order_quantity'];
|
|
$Product->minimum_order_quantity = $data['minimum_order_quantity'];
|
|
|
$Product->sampling_cycle = $data['sampling_cycle'];
|
|
$Product->sampling_cycle = $data['sampling_cycle'];
|
|
|
$Product->sampling_start_time = $data['sampling_start_time'];
|
|
$Product->sampling_start_time = $data['sampling_start_time'];
|