更新商品查询
This commit is contained in:
parent
d031167b4d
commit
03fc06b9d2
@ -164,7 +164,7 @@ class SpuRepository extends BaseRepository
|
|||||||
return compact('count', 'list');
|
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);
|
$where = array_merge(Product::searchEnable(), $where);
|
||||||
if (!empty($where['keyword'])) {
|
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));
|
app()->make(UserVisitRepository::class)->searchProduct($this->userInfo ? $this->userInfo['uid'] : 0, $where['keyword'], (int)($where['mer_id'] ?? 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rand) {
|
if ($rand) {
|
||||||
$dataKey = sprintf(CloudProduct::CacheKey, $where['mer_id']);
|
$dataKey = sprintf(CloudProduct::CacheKey, $where['mer_id']);
|
||||||
$RedisCacheService = app()->make(RedisCacheService::class);
|
$RedisCacheService = app()->make(RedisCacheService::class);
|
||||||
@ -193,12 +192,11 @@ class SpuRepository extends BaseRepository
|
|||||||
unset($where['mer_id'], $where['page']);
|
unset($where['mer_id'], $where['page']);
|
||||||
$page = 1;
|
$page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$entryMerId = $where['entry_mer_id'] ?? '';
|
$entryMerId = $where['entry_mer_id'] ?? '';
|
||||||
unset($where['entry_mer_id']);
|
unset($where['entry_mer_id']);
|
||||||
$query = $this->dao->search($where);
|
$query = $this->dao->search($where);
|
||||||
|
$count = $query->fetchSql(false)->count();
|
||||||
$count = $query->count();
|
|
||||||
$query->with([
|
$query->with([
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
$query->field($this->merchantFiled)->with(['type_name']);
|
$query->field($this->merchantFiled)->with(['type_name']);
|
||||||
|
@ -143,13 +143,13 @@ class StoreSpu extends BaseController
|
|||||||
]);
|
]);
|
||||||
if ($where['action']) unset($where['product_type']);
|
if ($where['action']) unset($where['product_type']);
|
||||||
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
|
$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')
|
$mer_id = Db::name('merchant')
|
||||||
->where('street_id',$currentMerchant['street_id'])
|
->where('street_id',$currentMerchant['street_id'])
|
||||||
->where('mer_state',1)
|
->where('mer_state',1)
|
||||||
->where('status',1)
|
->where('status',1)
|
||||||
->where('category_id',$currentMerchant['category_id'])
|
->where('category_id',$currentMerchant['category_id'])
|
||||||
->where('type_id', $typeCloudWarehouseId)
|
->where('type_id', $typeTownSupplyChainId)
|
||||||
->value('mer_id');
|
->value('mer_id');
|
||||||
if (!$mer_id) {
|
if (!$mer_id) {
|
||||||
return app('json')->success(['count'=>0,'list'=>[]]);
|
return app('json')->success(['count'=>0,'list'=>[]]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user