From c28a719e8291835f31a137472a1e5c40c6e083db Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 1 Jun 2024 16:04:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86=E5=95=86?= =?UTF-8?q?=E5=93=81=E7=AE=A1=E7=90=86=E7=9A=84=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_product/StoreProductLists.php | 5 ----- .../logic/store_product/StoreProductLogic.php | 21 +++++++------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 08f1a8c93..d0d12d7e6 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -51,11 +51,6 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa ->select()->each(function ($item) { $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name'); $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name'); - if($item['store_id'] == 0){ - $item['system_store_name'] = '平台'; - }else{ - $item['system_store_name'] = '门店:'.SystemStore::where('id', $item['store_id'])->value('name'); - } return $item; }) ->toArray(); diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 456bc4d93..6747db80d 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -174,23 +174,19 @@ class StoreProductLogic extends BaseLogic public static function copy($id, $store_id) { $find = StoreProduct::where('id', $id)->findOrEmpty()->toArray(); - $store_find = StoreProduct::where(['source_id' => $id, 'store_id' => $store_id])->findOrEmpty()->toArray(); + $store_find = StoreBranchProduct::where(['product_id' => $id, 'store_id' => $store_id])->findOrEmpty()->toArray(); if ($find && !$store_find) { $attr_value = StoreProductAttrValue::where('product_id', $id)->findOrEmpty(); Db::startTrans(); try { - unset($find['create_time'], $find['update_time'], $find['id'],$find['stock']); - $find['store_id'] = $store_id; - $find['source_id'] = $id; - $res = StoreProduct::create($find); $product = [ - 'product_id' => $res['id'], - 'image' => $res['image'], - 'store_name' => $res['store_name'], - 'store_info' => $res['store_info'], - 'keyword' => $res['keyword'], - 'bar_code' => $res['bar_code'], - 'cate_id' => $res['cate_id'], + 'product_id' => $find['id'], + 'image' => $find['image'], + 'store_name' => $find['store_name'], + 'store_info' => $find['store_info'], + 'keyword' => $find['keyword'], + 'bar_code' => $find['bar_code'], + 'cate_id' => $find['cate_id'], 'store_id' => $store_id, 'sales' => 0, 'stock' =>0, @@ -199,7 +195,6 @@ class StoreProductLogic extends BaseLogic $arr = [ 'product_id' => $id, 'store_id' => $store_id, - 'unique' => setUnique($res['id'], '', 0), 'sales' => 0, 'stock' => 0, 'type' => 0,