From dbe731f6289e9e7458d6886f2ffa19a71c6a85ba Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Mon, 25 Dec 2023 17:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/product/ProductRepository.php | 10 +++++++++- app/controller/api/store/product/StoreProduct.php | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 3bf18a26..b901f34b 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -344,7 +344,15 @@ class ProductRepository extends BaseRepository $ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find(); Db::transaction(function () use ($id, $data, $settleParams, $ret) { $this->save($id, $settleParams, null, [], 0); - app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price']]); + $value = $data['mer_labels']; + if (!empty($value)) { + if (!is_array($value)) { + $data['mer_labels'] = ',' . $value . ','; + } else { + $data['mer_labels'] = ',' . implode(',', $value) . ','; + } + } + app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price'],'mer_labels'=>$data['mer_labels']]); Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]); }); } diff --git a/app/controller/api/store/product/StoreProduct.php b/app/controller/api/store/product/StoreProduct.php index cb001a22..5625a0c2 100644 --- a/app/controller/api/store/product/StoreProduct.php +++ b/app/controller/api/store/product/StoreProduct.php @@ -211,7 +211,8 @@ class StoreProduct extends BaseController "attr", "attrValue", 'spec_type', - 'is_stock' + 'is_stock', + 'mer_labels' ]; $data = $this->request->params($params); // $count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]);