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,