作者 lyh

gx视频任务

... ... @@ -422,6 +422,11 @@ class ProductController extends BaseController
* @time :2023/8/21 18:33
*/
public function getStatusNumber(ProductLogic $logic){
$this->request->validate([
'featured_status'=>'numeric',
],[
'featured_status.numeric' => 'numeric为数字',
]);
$data = $logic->getStatusNumber();
$this->response('success',Code::SUCCESS,$data);
}
... ... @@ -536,10 +541,9 @@ class ProductController extends BaseController
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
$this->response('success');
}
$info['data'] = json_decode($info['data']);
$this->response('success',Code::SUCCESS,$info);
}
... ...
... ... @@ -397,7 +397,8 @@ class ProductLogic extends BaseLogic
//查詢所有分類
$cateModel = new Category();
$cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
if(!empty($cateList) && !isset($this->param['featured_status'])){
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
$featured_ids = $cateModel->where('title', 'like', '%Featured%')->pluck('id')->toArray();
//获取当前的子集
$featured_arr = [];
... ... @@ -862,7 +863,8 @@ class ProductLogic extends BaseLogic
{
$categoryModel = new Category();
$this->param['deleted_at'] = null;
if(!isset($this->param['featured_status'])) {
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) {
$this->param['title'] = ['not like','%Featured%'];
}
$list = $categoryModel->list($this->param, ['sort', 'id'], ['id', 'pid', 'title']);
... ...