|
...
|
...
|
@@ -8,6 +8,7 @@ use App\Helper\Arr; |
|
|
|
use App\Http\Controllers\Bside\BaseController;
|
|
|
|
use App\Http\Logic\Bside\Product\ProductLogic;
|
|
|
|
use App\Http\Requests\Bside\Product\ProductRequest;
|
|
|
|
use App\Models\Product\CategoryRelated;
|
|
|
|
use App\Rules\Ids;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
...
|
...
|
@@ -26,9 +27,13 @@ class ProductController extends BaseController |
|
|
|
if(!empty($this->param['search'])){
|
|
|
|
$map[] = ['title', 'like', "%{$this->param['search']}%"];
|
|
|
|
}
|
|
|
|
if(!empty($this->param['created_at'])){
|
|
|
|
if(!empty($this->param['created_at'][0]) && !empty($this->param['created_at'][1])){
|
|
|
|
$map[] = ['created_at', 'between', $this->param['created_at']];
|
|
|
|
}
|
|
|
|
if(!empty($this->param['category_id'])){
|
|
|
|
$ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray();
|
|
|
|
$map[] = ['id', 'in', $ids];
|
|
|
|
}
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
$data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_at', 'updated_at']);
|
|
|
|
return $this->success($data);
|
...
|
...
|
|