From ecd03b1a2da91e65fc8bc7f1bc2c4e961c79752d Mon Sep 17 00:00:00 2001
From: wangzhenxin <wangzhenxin@iemsoft.cn>
Date: Sat, 22 Apr 2023 21:26:24 +0800
Subject: [PATCH] 对订单列表上的【批量导出订单】按钮增加权限控制,完成

---
 forms/mall/order/BaseOrderForm.php |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/forms/mall/order/BaseOrderForm.php b/forms/mall/order/BaseOrderForm.php
index 8b412d3..a635c95 100644
--- a/forms/mall/order/BaseOrderForm.php
+++ b/forms/mall/order/BaseOrderForm.php
@@ -109,8 +109,9 @@
         if (!$this->validate()) {
             return $this->getErrorResponse();
         }
+        
         $role = CommonUser::getUserRole();
-        if($role[0]['name'] == '提货客服'){
+        if(substr($role[0]['name'],0,12) == '提货客服'){
             $this->plugin = 'exchange';
         }
 
@@ -294,7 +295,16 @@
         }
         array_unshift($menuList, ['sign' => 'all', 'name' => '全部订单']);
         $list = $this->handleExtraData($list);
-
+        
+        // 判断当前用户是还有批量导出订单的权限
+        $userIdentity = CommonUser::getUserIdentity();
+        if($userIdentity->is_super_admin){
+            $is_show_export = true;
+        }else{
+            $userPermisson = CommonUser::getUserPermissions();
+            $is_show_export = in_array('mall/order/export',$userPermisson);    
+        }
+        
         return [
             'code' => ApiCode::CODE_SUCCESS,
             'data' => [
@@ -305,7 +315,8 @@
                 'plugins' => $menuList,
                 'hide_function' => \Yii::$app->role->getHideFunction(),
                 'send_type_list' => $this->getSendTypeList(),
-                'role' => $role
+                'role' => $role,
+                'is_show_export' => $is_show_export
             ],
         ];
     }

--
Gitblit v1.8.0