调整云仓商品查询
This commit is contained in:
parent
5c84d96276
commit
0f0883c1a5
@ -19,6 +19,7 @@ use crmeb\jobs\SyncProductTopJob;
|
|||||||
use crmeb\services\CopyCommand;
|
use crmeb\services\CopyCommand;
|
||||||
use crmeb\services\RedisCacheService;
|
use crmeb\services\RedisCacheService;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
use app\common\repositories\BaseRepository;
|
use app\common\repositories\BaseRepository;
|
||||||
use app\common\dao\store\product\SpuDao;
|
use app\common\dao\store\product\SpuDao;
|
||||||
@ -162,11 +163,14 @@ class SpuRepository extends BaseRepository
|
|||||||
$where['spu_status'] = 1;
|
$where['spu_status'] = 1;
|
||||||
$where['mer_status'] = 1;
|
$where['mer_status'] = 1;
|
||||||
$RedisCacheService = app()->make(RedisCacheService::class);
|
$RedisCacheService = app()->make(RedisCacheService::class);
|
||||||
$exists=$RedisCacheService->exists('CloudMerchanSpu'.$where['mer_id']);
|
$exists=$RedisCacheService->exists('CloudMerchantSpu'.$where['mer_id']);
|
||||||
if ($exists){
|
if ($exists){
|
||||||
$Spu_arr=$RedisCacheService->SRANDMEMBER('CloudMerchanSpu'.$where['mer_id'], 10);
|
$Spu_arr=$RedisCacheService->SRANDMEMBER('CloudMerchantSpu'.$where['mer_id'], 10);
|
||||||
$where['product_id'] =$Spu_arr;
|
$where['product_id'] =$Spu_arr;
|
||||||
|
} else {
|
||||||
|
$where['product_id'] = Db::name('cloud_product')->where('mer_id', $where['mer_id'])->where('status', 1)->orderRand()->limit(10)->column('product_id');
|
||||||
}
|
}
|
||||||
|
unset($where['mer_id']);
|
||||||
$query = $this->dao->search($where);
|
$query = $this->dao->search($where);
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user