修改名优特产查询

This commit is contained in:
luofei 2024-03-14 10:07:05 +08:00
parent 5335d8341e
commit 7832a9fee7
2 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,7 @@ use app\common\dao\BaseDao;
use app\common\Enum;
use app\common\model\store\product\ProductAttrValue;
use app\common\model\store\product\ProductCate;
use app\common\model\store\product\ProductLabel;
use app\common\model\store\product\Spu;
use app\common\model\store\StoreCategory;
use app\common\model\system\merchant\Merchant;
@ -175,6 +176,12 @@ class SpuDao extends BaseDao
->when(isset($where['spu_status']) && $where['spu_status'] !== '',function($query)use($where){
$query->where('S.status',$where['spu_status']);
})
->when(isset($where['label_name']) && $where['label_name'] !== '',function($query)use($where){
$labelId = ProductLabel::where('label_name', $where['label_name'])->value('product_label_id');
if (!empty($labelId)) {
$query->whereLike('S.sys_labels',"%,{$labelId},%");
}
})
->when(isset($where['sys_labels']) && $where['sys_labels'] !== '',function($query)use($where){
$query->whereLike('S.sys_labels',"%,{$where['sys_labels']},%");
})

View File

@ -12,12 +12,10 @@ namespace app\controller\api\store\product;
use app\common\model\store\product\ProductLabel;
use app\common\model\system\merchant\Merchant;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\StoreCategoryRepository;
use app\common\repositories\system\merchant\MerchantRepository;
use app\common\repositories\user\UserHistoryRepository;
use app\common\repositories\user\UserVisitRepository;
use app\controller\admin\system\merchant\MerchantType;
use app\common\model\system\merchant\MerchantType;
use crmeb\services\CopyCommand;
use think\App;
use crmeb\basic\BaseController;
@ -68,6 +66,7 @@ class StoreSpu extends BaseController
'type_id',
'type_code',
'category_id',
'label_name',
]);
if ($where['type_id'] || $where['type_code']) {
$query = Merchant::where(['status' => 1, 'mer_state' => 1, 'is_del' => 0]);