From 3f2b5b738dcb2ab386f946242c0634ff8fd11f07 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 19 Mar 2024 14:21:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E4=BB=A3=E7=A0=81=E7=9A=84?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/product/ProductRepository.php | 8 ++------ app/controller/api/Common.php | 15 +++++++++++++++ route/api.php | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index dd4a11df..fea25d9a 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -519,12 +519,8 @@ class ProductRepository extends BaseRepository } - - $minValues = array_map(function ($item) { - return min($item['price'], $item['ot_price']); - }, $data['attrValue']); - - $minPriceOtPrice = min($minValues); + $wholesalePrices = array_column($data['attrValue'], 'wholesale_price'); + $minPriceOtPrice = min($wholesalePrices); $result = [ 'store_name' => $data['store_name'], diff --git a/app/controller/api/Common.php b/app/controller/api/Common.php index e9e5c43a..7a7b6161 100644 --- a/app/controller/api/Common.php +++ b/app/controller/api/Common.php @@ -23,6 +23,7 @@ use app\common\repositories\delivery\DeliveryOrderRepository; use app\common\repositories\store\product\ProductAssistSetRepository; use app\common\repositories\store\product\ProductGroupBuyingRepository; use app\common\repositories\store\product\ProductGroupRepository; +use app\common\repositories\store\product\ProductLabelRepository; use app\common\repositories\store\product\ProductPresellRepository; use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\shipping\ExpressRepository; @@ -739,4 +740,18 @@ class Common extends BaseController } } + /** + * 商品标签 + */ + public function label_lst(ProductLabelRepository $repository) + { + [$page, $limit] = $this->getPage(); + $where = $this->request->params(['name', 'type', 'status']); + $data = $repository->getList($where, $page, $limit); + return app('json')->success($data); + } + + + + } diff --git a/route/api.php b/route/api.php index 479268ff..5c7d8403 100644 --- a/route/api.php +++ b/route/api.php @@ -24,6 +24,7 @@ Route::group('api/', function () { Route::any('ceshi', 'api.Demo/ceshi'); Route::any('promote_writing', 'api.Common/promote_writing'); Route::any('applet', 'api.Common/applet'); + Route::get('label_lst', 'api.Common/label_lst'); Route::any('promote_writing', 'api.Common/promoteWriting'); Route::get('business/agree', 'api.Auth/businessAgree'); Route::any('system_group_value', 'api.Common/system_group_value');