云仓商品添加关键字检索
This commit is contained in:
parent
caee99f429
commit
fb50a7accd
@ -34,6 +34,9 @@ class SpuRepository extends BaseRepository
|
||||
public $dao;
|
||||
public $merchantFiled = 'mer_id,mer_name,mer_avatar,is_trader,mer_info,mer_keyword,type_id';
|
||||
public $productFiled = 'P.bar_code,S.product_id,S.store_name,S.image,activity_id,S.keyword,S.price,S.mer_id,spu_id,S.status,store_info,brand_id,cate_id,unit_name,S.star,S.rank,S.sort,sales,S.product_type,rate,reply_count,extension_type,S.sys_labels,S.mer_labels,P.delivery_way,P.delivery_free,P.ot_price,svip_price_type,stock,mer_svip_status';
|
||||
|
||||
public $userInfo;
|
||||
|
||||
public function __construct(SpuDao $dao)
|
||||
{
|
||||
$this->dao = $dao;
|
||||
@ -163,6 +166,17 @@ class SpuRepository extends BaseRepository
|
||||
{
|
||||
$where['spu_status'] = 1;
|
||||
$where['mer_status'] = 1;
|
||||
if (!empty($where['keyword'])) {
|
||||
if (preg_match('/^(\/@[1-9]{1}).*\*\//', $where['keyword'])) {
|
||||
$command = app()->make(CopyCommand::class)->getMassage($where['keyword']);
|
||||
if (!$command || in_array($command['type'], [30, 40])) return ['count' => 0, 'list' => []];
|
||||
if ($this->userInfo && $command['uid']) app()->make(UserRepository::class)->bindSpread($this->userInfo, $command['uid']);
|
||||
$where['spu_id'] = $command['id'];
|
||||
unset($where['keyword']);
|
||||
} else {
|
||||
app()->make(UserVisitRepository::class)->searchProduct($this->userInfo ? $this->userInfo['uid'] : 0, $where['keyword'], (int)($where['mer_id'] ?? 0));
|
||||
}
|
||||
}
|
||||
if ($rand) {
|
||||
$RedisCacheService = app()->make(RedisCacheService::class);
|
||||
$exists=$RedisCacheService->exists('CloudMerchantSpu'.$where['mer_id']);
|
||||
@ -175,7 +189,7 @@ class SpuRepository extends BaseRepository
|
||||
}
|
||||
unset($where['mer_id']);
|
||||
}
|
||||
$entryMerId = $where['entry_mer_id'];
|
||||
$entryMerId = $where['entry_mer_id'] ?? '';
|
||||
unset($where['entry_mer_id']);
|
||||
$query = $this->dao->search($where);
|
||||
|
||||
|
@ -36,6 +36,7 @@ class CloudWarehouse extends BaseController
|
||||
$this->repository = $repository;
|
||||
$this->merchantDao = $merchantDao;
|
||||
$this->spuRepository = $spuRepository;
|
||||
$this->spuRepository->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,7 +45,7 @@ class CloudWarehouse extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0]]);
|
||||
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
|
||||
$search = [
|
||||
'street_id' => $params['street_code'],
|
||||
'type_id' => Merchant::TypeStore,
|
||||
@ -55,6 +56,7 @@ class CloudWarehouse extends BaseController
|
||||
if (empty($merchantIds)) {
|
||||
return app('json')->success(['count' => 0, 'list' => []]);
|
||||
}
|
||||
$where['keyword'] = $params['keyword'];
|
||||
$where['mer_ids'] = $merchantIds;
|
||||
$where['product_type'] = $params['product_type'];
|
||||
$where['is_gift_bag'] = 0;
|
||||
|
@ -44,4 +44,6 @@ return [
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => false,
|
||||
//应用加解密秘钥
|
||||
'app_secret' => '789XH80PTSb8pHjH',
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user