From 2df0bf5c1f8d873e0a7c6c8937c8df16638dde19 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 22 Jul 2024 11:26:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20SystemStoreStorage?= =?UTF-8?q?Lists=20=E7=B1=BB=E4=B8=AD=E7=9A=84=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemStoreStorageLists.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/store/lists/system_store_storage/SystemStoreStorageLists.php b/app/store/lists/system_store_storage/SystemStoreStorageLists.php index efdd3ade0..681fe63f8 100644 --- a/app/store/lists/system_store_storage/SystemStoreStorageLists.php +++ b/app/store/lists/system_store_storage/SystemStoreStorageLists.php @@ -29,7 +29,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI public function setSearch(): array { return [ - '=' => ['admin_id', 'staff_id', 'status','type'], + '=' => ['admin_id', 'staff_id', 'status', 'type'], ]; } @@ -45,12 +45,12 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI */ public function lists(): array { - $this->searchWhere[] = ['store_id','=',$this->adminInfo['store_id']];//只显示当前门店的入库记录 - if($this->request->__get('status')==-1){ - $this->searchWhere[] = ['status','>=',0]; + $this->searchWhere[] = ['store_id', '=', $this->adminInfo['store_id']]; //只显示当前门店的入库记录 + if ($this->request->__get('status') == -1) { + $this->searchWhere[] = ['status', '>=', 0]; } return SystemStoreStorage::where($this->searchWhere) - ->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums','mark', 'status']) + ->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums', 'mark', 'status']) ->limit($this->limitOffset, $this->limitLength) ->order(['status' => 'aes']) ->select()->each(function ($item) { @@ -62,9 +62,15 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI } else { $item['staff_name'] = '无'; } - $find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find(); - $item['store_name']=$find['store_name']; - $item['image']=$find['image']; + $find = StoreProduct::where('id', $item['product_id'])->field('store_name,image')->find(); + if ($find) { + $item['store_name'] = $find['store_name']; + $item['image'] = $find['image']; + } else { + $item['store_name'] = ''; + $item['image'] = ''; + } + return $item; }) ->toArray(); @@ -81,5 +87,4 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI { return SystemStoreStorage::where($this->searchWhere)->count(); } - }