更新商品查询

This commit is contained in:
yaooo 2023-09-26 19:11:24 +08:00
parent d031167b4d
commit 03fc06b9d2
2 changed files with 5 additions and 7 deletions

View File

@ -164,7 +164,7 @@ class SpuRepository extends BaseRepository
return compact('count', 'list');
}
public function getApiCloudSearch($where, $page, $limit, $rand = true)
public function getApiCloudSearch($where, $page, $limit, $rand = false)
{
$where = array_merge(Product::searchEnable(), $where);
if (!empty($where['keyword'])) {
@ -178,7 +178,6 @@ class SpuRepository extends BaseRepository
app()->make(UserVisitRepository::class)->searchProduct($this->userInfo ? $this->userInfo['uid'] : 0, $where['keyword'], (int)($where['mer_id'] ?? 0));
}
}
if ($rand) {
$dataKey = sprintf(CloudProduct::CacheKey, $where['mer_id']);
$RedisCacheService = app()->make(RedisCacheService::class);
@ -193,12 +192,11 @@ class SpuRepository extends BaseRepository
unset($where['mer_id'], $where['page']);
$page = 1;
}
$entryMerId = $where['entry_mer_id'] ?? '';
unset($where['entry_mer_id']);
$query = $this->dao->search($where);
$count = $query->count();
$count = $query->fetchSql(false)->count();
$query->with([
'merchant' => function ($query) {
$query->field($this->merchantFiled)->with(['type_name']);

View File

@ -143,13 +143,13 @@ class StoreSpu extends BaseController
]);
if ($where['action']) unset($where['product_type']);
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
$typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id');
$typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
$mer_id = Db::name('merchant')
->where('street_id',$currentMerchant['street_id'])
->where('mer_state',1)
->where('status',1)
->where('category_id',$currentMerchant['category_id'])
->where('type_id', $typeCloudWarehouseId)
->where('type_id', $typeTownSupplyChainId)
->value('mer_id');
if (!$mer_id) {
return app('json')->success(['count'=>0,'list'=>[]]);