|
@@ -88,6 +88,8 @@ class Product extends Auth{
|
|
|
$data['quota'] = request('quota',0);
|
|
|
$data['quota_start'] = request('quota_start','');
|
|
|
$data['quota_end'] = request('quota_end','');
|
|
|
+ $data['puton_time'] = request('puton_time','');
|
|
|
+ $data['putoff_time'] = request('putoff_time','');
|
|
|
$data['stock'] = request('stock',0);
|
|
|
$data['status'] = 1;
|
|
|
$data['admin_uid'] = admin('uid');
|
|
@@ -99,10 +101,19 @@ class Product extends Auth{
|
|
|
$cityIds = $cityIds ? $cityIds : [1];
|
|
|
$data['quota_start'] = $data['quota_start'] ? strtotime($data['quota_start']) : 0;
|
|
|
$data['quota_end'] = $data['quota_end'] ? strtotime($data['quota_end']) : 0;
|
|
|
+ $data['puton_time'] = $data['puton_time'] ? strtotime($data['puton_time']) : 0;
|
|
|
+ $data['putoff_time'] = $data['putoff_time'] ? strtotime($data['putoff_time']) : 0;
|
|
|
// 限购提示
|
|
|
if( !$data['thumb'] ) return json_send(['code'=>'error','msg'=>'请上传产品主图','data'=>['error'=>'请上传产品主图']]);
|
|
|
// 限购提示
|
|
|
if( $data['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) return json_send(['code'=>'error','msg'=>'限购必填限购时间','data'=>['error'=>'限购必填限购时间']]);
|
|
|
+ // 上下架
|
|
|
+ if( $data['puton_time'] ) {
|
|
|
+ // 下架时间必填
|
|
|
+ if( !$data['putoff_time'] ) return json_send(['code'=>'error','msg'=>'请填写自动下架时间','data'=>['error'=>'自动上架请填写下架时间']]);
|
|
|
+ // 下架时间必填
|
|
|
+ if( $data['putoff_time'] <= $data['puton_time'] ) return json_send(['code'=>'error','msg'=>'下架时间请晚于上架时间','data'=>['error'=>'下架时间请晚于上架时间']]);
|
|
|
+ }
|
|
|
// 总库存
|
|
|
if( $skuList ) $data['stock'] = array_sum(array_column($skuList,'stock'));
|
|
|
// 获取规格属性
|
|
@@ -232,6 +243,8 @@ class Product extends Auth{
|
|
|
$data['quota'] = request('quota',0);
|
|
|
$data['quota_start'] = request('quota_start','');
|
|
|
$data['quota_end'] = request('quota_end','');
|
|
|
+ $data['puton_time'] = request('puton_time','');
|
|
|
+ $data['putoff_time'] = request('putoff_time','');
|
|
|
$data['producer_id'] = request('producer_id',0);
|
|
|
$data['business_id'] = request('business_id',0);
|
|
|
$data['stock'] = request('stock',0);
|
|
@@ -244,10 +257,19 @@ class Product extends Auth{
|
|
|
$cityIds = $cityIds ? $cityIds : [1];
|
|
|
$data['quota_start'] = $data['quota_start'] ? strtotime($data['quota_start']) : 0;
|
|
|
$data['quota_end'] = $data['quota_end'] ? strtotime($data['quota_end']) : 0;
|
|
|
+ $data['puton_time'] = $data['puton_time'] ? strtotime($data['puton_time']) : 0;
|
|
|
+ $data['putoff_time'] = $data['putoff_time'] ? strtotime($data['putoff_time']) : 0;
|
|
|
// 限购提示
|
|
|
if( !$data['thumb'] ) return json_send(['code'=>'error','msg'=>'请上传产品主图','data'=>['error'=>'请上传产品主图']]);
|
|
|
// 限购提示
|
|
|
if( $data['quota'] && ( !$data['quota_start'] || !$data['quota_end'] )) return json_send(['code'=>'error','msg'=>'限购必填限购时间','data'=>['error'=>'限购必填限购时间']]);
|
|
|
+ // 上下架
|
|
|
+ if( $data['puton_time'] ) {
|
|
|
+ // 下架时间必填
|
|
|
+ if( !$data['putoff_time'] ) return json_send(['code'=>'error','msg'=>'请填写自动下架时间','data'=>['error'=>'自动上架请填写下架时间']]);
|
|
|
+ // 下架时间必填
|
|
|
+ if( $data['putoff_time'] <= $data['puton_time'] ) return json_send(['code'=>'error','msg'=>'下架时间请晚于上架时间','data'=>['error'=>'下架时间请晚于上架时间']]);
|
|
|
+ }
|
|
|
// 总库存
|
|
|
if( $skuList ) $data['stock'] = array_sum(array_column($skuList,'stock'));
|
|
|
// 获取规格属性
|