|
@@ -514,6 +514,21 @@ class ProductService extends Service
|
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
|
if(isset($data['state'])) $model->where('state', $data['state']);
|
|
|
if(! empty($data['product_category_id'])) $model->where('product_category_id', $data['product_category_id']);
|
|
|
+ if(! empty($data['product_category'])) {
|
|
|
+ $model2 = ProductCategory::TopClear($user,$data);
|
|
|
+ $product_category = $model2->where('del_time',0)
|
|
|
+ ->where('title', 'LIKE', '%'.$data['title'].'%')
|
|
|
+ ->select('id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $model->whereIn('product_category_id',array_unique(array_column($product_category,'id')));
|
|
|
+ }
|
|
|
+ if(! empty($data['code'])) $model->where('code', 'LIKE', '%'.$data['code'].'%');
|
|
|
+ if(! empty($data['bar_code'])) $model->where('bar_code', 'LIKE', '%'.$data['bar_code'].'%');
|
|
|
+ if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) {
|
|
|
+ $return = $this->changeDateToTimeStampAboutRange($data['crt_time']);
|
|
|
+ $model->where('crt_time','>=',$return[0]);
|
|
|
+ $model->where('crt_time','<=',$return[1]);
|
|
|
+ }
|
|
|
|
|
|
$list = $this->limit($model,'',$data);
|
|
|
$list = $this->fillData($list,$user,$data);
|