From ad608d1130614cd4ad5993f0aeb0276e5bf274df Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 8 Oct 2024 16:02:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=8E=B7=E5=8F=96=E5=B7=B2?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreLogic.php | 58 +++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 9ea3ecd4..d28950f7 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -15,6 +15,33 @@ use think\facade\Db; class LocalStoreLogic extends Logic { + private static $local_menu = array( + 1 => [ + 'id' => 1, + 'name' => '商品添加', + 'path' => '/bundle/pages/local_shop/local_shop_add', + 'image' => 'uniapp/bundle_b/local_shop/local_add.png' + ], + 2 => [ + 'id' => 2, + 'name' => '商品管理', + 'path' => '/bundle/pages/local_shop/local_shop_manager', + 'image' => 'uniapp/bundle_b/local_shop/local_shop.png' + ], + 3 => [ + 'id' => 3, + 'name' => '订单管理', + 'path' => '/bundle_b/pages/local_shop/local_shop_order', + 'image' => 'uniapp/bundle_b/local_shop/local_bill.png' + ], + 4 => [ + 'id' => 4, + 'name' => '站点设置', + 'path' => '/bundle/pages/local_map/index', + 'image' => 'uniapp/bundle_b/local_shop/local_map.png' + ] + ); + public function getLocalList($data) { $model = new LocalStore; @@ -471,24 +498,7 @@ class LocalStoreLogic extends Logic $userInfo = User::where(['sn' => $post['keyword'], 'del' => 0])->field('id, nickname, avatar as abs_avatar')->find(); if ($userInfo) { $userInfo = $userInfo->toArray(); - $userInfo['rule'] = array( - [ - 'id' => 1, - 'name' => '商品添加' - ], - [ - 'id' => 2, - 'name' => '商品管理' - ], - [ - 'id' => 3, - 'name' => '订单管理' - ], - [ - 'id' => 4, - 'name' => '站点设置' - ] - ); + $userInfo['rule'] = self::$local_menu; } else { $userInfo = []; } @@ -588,7 +598,7 @@ class LocalStoreLogic extends Logic if ($list) { foreach ($list as &$v) { - $v['rule'] = explode(',', $v['rule']); + $v['rule'] = self::crate_bind_menu($v['rule']); } } @@ -602,4 +612,14 @@ class LocalStoreLogic extends Logic return $data; } + + private static function crate_bind_menu($rule) + { + $menu = []; + $r = explode(',', $rule); + foreach ($r as &$v) { + $menu[] = self::$local_menu[$v]; + } + return $menu; + } } \ No newline at end of file