设置首页排序

main
fengxinyhyl 8 months ago
parent 806a9172c1
commit 75ac0335ab
  1. 7
      app/controller/api/store/product/StoreSpu.php

@ -18,6 +18,7 @@ use crmeb\services\CopyCommand;
use think\App; use think\App;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
use app\common\repositories\store\product\SpuRepository; use app\common\repositories\store\product\SpuRepository;
use think\facade\Log;
class StoreSpu extends BaseController class StoreSpu extends BaseController
{ {
@ -63,11 +64,8 @@ class StoreSpu extends BaseController
]); ]);
$where['is_gift_bag'] = 0; $where['is_gift_bag'] = 0;
$where['product_type'] = 0; $where['product_type'] = 0;
if($limit == 6){
$limit = 10;
$where['is_good'] = 1; $where['is_good'] = 1;
} $where['order'] = $where['order'] ?: 'rank';
$where['order'] = $where['order'] ?: 'product_id';
if ($where['is_trader'] != 1) unset($where['is_trader']); if ($where['is_trader'] != 1) unset($where['is_trader']);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
return app('json')->success($data); return app('json')->success($data);
@ -127,6 +125,7 @@ class StoreSpu extends BaseController
$where['order'] = 'star'; $where['order'] = 'star';
break; break;
} }
Log::info("recommend is ".systemConfig('recommend_type'));
$where['product_type'] = 0; $where['product_type'] = 0;
$where['is_stock'] = 1; $where['is_stock'] = 1;
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);

Loading…
Cancel
Save