修改推荐商品列表

This commit is contained in:
luofei 2024-03-22 16:28:01 +08:00
parent 4c279f2153
commit e55321b5f8
4 changed files with 11 additions and 1 deletions

View File

@ -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']);

View File

@ -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'],

View File

@ -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) {

View File

@ -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();