diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index d56c1bf7..9385f1ea 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -178,6 +178,12 @@ class SpuDao extends BaseDao ->when(isset($where['action']) && $where['action'] !== '',function($query)use($where){ $query->where('S.product_type','>',0)->where('S.mer_id','<>',0); }) + ->when(isset($where['recommend']) && $where['recommend'] == 1,function($query)use($where){ + $cateId = env('PLATFORM_CARD_CATE_ID'); + $productId = ProductCate::where('mer_cate_id', $cateId)->column('product_id'); + $productId = array_unique($productId); + $query->whereNotIn('P.product_id', $productId); + }) ->when(isset($where['mer_cate_id']) && $where['mer_cate_id'] !== '',function($query)use($where){ $ids = (StoreCategory::where('path','like','%/'.$where['mer_cate_id'].'/%'))->column('store_category_id'); $ids[] = intval($where['mer_cate_id']); diff --git a/app/common/repositories/system/merchant/MerchantIntentionRepository.php b/app/common/repositories/system/merchant/MerchantIntentionRepository.php index a235881d..42370031 100644 --- a/app/common/repositories/system/merchant/MerchantIntentionRepository.php +++ b/app/common/repositories/system/merchant/MerchantIntentionRepository.php @@ -16,6 +16,7 @@ use app\common\Enum; use app\common\model\system\merchant\Merchant; use app\common\model\system\merchant\MerchantCategory; use app\common\model\system\merchant\MerchantIntention; +use app\common\model\system\merchant\MerchantType; use app\common\repositories\BaseRepository; use app\common\repositories\system\config\ConfigValueRepository; use crmeb\jobs\SendSmsJob; @@ -178,6 +179,7 @@ class MerchantIntentionRepository extends BaseRepository $margin = app()->make(MerchantTypeRepository::class)->get($intention['mer_type_id']); $commissionRate = MerchantCategory::where('merchant_category_id', $intention['merchant_category_id'])->value('commission_rate'); + $autoMarginRate = MerchantType::where('mer_type_id', $intention['mer_type_id'])->value('auto_margin_rate'); $data['is_margin'] = $margin['is_margin'] ?? -1; $data['margin'] = $margin['margin'] ?? 0; $merData = []; @@ -198,6 +200,7 @@ class MerchantIntentionRepository extends BaseRepository 'mer_password' => $password, 'is_margin' => $margin['is_margin'] ?? -1, 'margin' => $margin['margin'] ?? 0, + 'auto_margin_rate' => $autoMarginRate, 'mark' => $margin['margin'] ?? 0, 'mer_state' => 1, //审核通过自动开启 'city_id' => $intention['city_id'], diff --git a/app/controller/admin/system/merchant/MerchantType.php b/app/controller/admin/system/merchant/MerchantType.php index 87d6dd37..c54e8b7f 100644 --- a/app/controller/admin/system/merchant/MerchantType.php +++ b/app/controller/admin/system/merchant/MerchantType.php @@ -94,7 +94,7 @@ class MerchantType extends BaseController protected function getValidParams() { - $data = $this->request->params(['type_name', 'type_info', 'is_margin', 'margin', 'auth', 'description', 'mark', 'is_allow_apply', 'is_search_display']); + $data = $this->request->params(['type_name', 'type_info', 'is_margin', 'margin', 'auth', 'description', 'mark', 'is_allow_apply', 'is_search_display', 'auto_margin_rate']); $validate = app()->make(MerchantTypeValidate::class); $validate->check($data); if ($data['is_margin'] == 1) { diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 993c8448..b466266e 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -161,6 +161,7 @@ class StoreSpu extends BaseController } $where['product_type'] = 0; $where['is_stock'] = 1; + $where['recommend'] = 1; $data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo); $count = $data['count']; $list = $data['list']->toArray();