|
|
@@ -136,8 +136,8 @@ class Product extends Controller
|
|
|
$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';
|
|
|
$all_data['minimum_order_quantity'] = $minimum_order_quantity;
|
|
|
- $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' => '采集最早开始时间为明天']);
|
|
|
+ if ($all_data['sampling_start_time'] && $all_data['sampling_start_time'] < 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' => '采集结束时间必须大于当前时间']);
|
|
|
//查询是否存在
|
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
|
@@ -193,6 +193,8 @@ class Product extends Controller
|
|
|
$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';
|
|
|
$all_data['minimum_order_quantity'] = $minimum_order_quantity;
|
|
|
+ if ($all_data['sampling_start_time'] && $all_data['sampling_start_time'] < 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' => '采集结束时间必须大于当前时间']);
|
|
|
//查询是否存在
|
|
|
$map = ['product_name' => $all_data['product_name'], 'product_specs' => $all_data['product_specs'], 'platform' => $all_data['platform']];
|
|
|
if ($is_admin != 1 && $company_id != 0) {
|
|
|
@@ -213,8 +215,6 @@ class Product extends Controller
|
|
|
$Product = $ProductModel->where($where)->first();
|
|
|
if (!$Product) return json_send(['code' => 'error', 'msg' => '记录不存在']);
|
|
|
$oldData = $Product->toarray();
|
|
|
- $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' => '修改失败']);
|