|
...
|
...
|
@@ -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,11 +27,18 @@ 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];
|
|
|
|
}
|
|
|
|
if(!empty($this->param['status'])){
|
|
|
|
$map[] = ['status', $this->param['status']];
|
|
|
|
}
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
$data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_at', 'updated_at']);
|
|
|
|
$data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_uid', 'created_at', 'updated_at']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -42,7 +50,7 @@ class ProductController extends BaseController |
|
|
|
]);
|
|
|
|
$data = $logic->getInfo($this->param['id']);
|
|
|
|
return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'gallery', 'attrs', 'category_id', 'keywords', 'intro', 'content',
|
|
|
|
'describe', 'seo_mate', 'related_product_id', 'status']));
|
|
|
|
'describe', 'seo_mate', 'related_product_id', 'status', 'category_id_text', 'status_text', 'created_uid', 'created_uid_text']));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function save(ProductRequest $request, ProductLogic $logic)
|
...
|
...
|
|