This commit is contained in:
mkm 2023-11-13 14:33:59 +08:00
parent 039d696b9b
commit 5f43305313
2 changed files with 9 additions and 4 deletions

View File

@ -129,7 +129,7 @@ class SpuRepository extends BaseRepository
* @author Qinii
* @day 12/18/20
*/
public function getApiSearch($where, $page, $limit, $userInfo = null)
public function getApiSearch($where, $page, $limit, $userInfo = null,$is_sku=false)
{
if (isset($where['keyword']) && !empty($where['keyword'])) {
if (preg_match('/^(\/@[1-9]{1}).*\*\//', $where['keyword'])) {
@ -154,7 +154,13 @@ class SpuRepository extends BaseRepository
]);
$productMake = app()->make(ProductRepository::class);
$count = $query->fetchSql(false)->count();
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select();
$list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select()
->each(function ($item) use ($is_sku,$productMake,$userInfo) {
if($is_sku==true){
$sku = $productMake->detailAttrValue($item['product']['attrValue'], $userInfo);
$item['sku']=$sku;
}
});
$append = ['stop_time','svip_price','show_svip_info','is_svip_price'];
if ($productMake->getUserIsPromoter($userInfo))
$append[] = 'max_extension';

View File

@ -149,14 +149,13 @@ class CloudWarehouse extends BaseController
if (empty($merchantIds)) {
return app('json')->success(['count' => 0, 'list' => []]);
}
$where['entry_mer_id'] = 0;
$where['keyword'] = $params['keyword'];
$where['mer_ids'] = $merchantIds;
$where['product_type'] = $params['product_type'];
$where['is_gift_bag'] = 0;
$where['order'] = $params['order'] ?: 'sort';
$products = $this->spuRepository->getApiSearch($where, $page, $limit, false);
$products = $this->spuRepository->getApiSearch($where, $page, $limit, false,true);
return app('json')->success($products);
}
}