From e9acd6ccd9af9357711c79435bb8193a532e6e17 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 17 May 2023 15:55:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BA=91=E5=95=86?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/store/product/SpuRepository.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index 08177b6a..1d434d6f 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -165,6 +165,12 @@ class SpuRepository extends BaseRepository $count = $query->count(); // $Sql=$query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->fetchSql(true); + $query->with([ + 'merchant' => function ($query) { + $query->field($this->merchantFiled)->with(['type_name']); + }, + 'issetCoupon', + ]); $list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select(); $append = ['stop_time','svip_price','show_svip_info','is_svip_price']; From 1391cf16af18ff9f0750624a1f1328ca15bf1b73 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 17 May 2023 16:11:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/store/product/SpuRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index 1d434d6f..83951b66 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -171,7 +171,7 @@ class SpuRepository extends BaseRepository }, 'issetCoupon', ]); - $list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->select(); + $list = $query->page($page, $limit)->setOption('field', [])->field($this->productFiled)->orderRaw('rand()')->select(); $append = ['stop_time','svip_price','show_svip_info','is_svip_price']; $list->append($append);