Ver código fonte

后台列表加权限现在

lizhen_gitee 1 ano atrás
pai
commit
02ce3b3436

+ 7 - 0
application/admin/controller/Banner.php

@@ -51,9 +51,16 @@ class Banner extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['banner.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/Company.php

@@ -51,9 +51,16 @@ class Company extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['company.id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['wallet'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/CompanyBank.php

@@ -50,9 +50,16 @@ class CompanyBank extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['company_bank.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/CompanyComment.php

@@ -50,9 +50,16 @@ class Companycomment extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['companycomment.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['user','company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/CompanyStaff.php

@@ -56,9 +56,16 @@ class CompanyStaff extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['company_staff.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 1
application/admin/controller/CompanyTakeCash.php

@@ -50,12 +50,18 @@ class CompanyTakeCash extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['company_take_cash.user_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
-
             foreach ($list as $row) {
                 
                 $row->getRelation('company')->visible(['name']);

+ 7 - 0
application/admin/controller/Companymoneylog.php

@@ -50,9 +50,16 @@ class Companymoneylog extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['companymoneylog.user_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/Coupons.php

@@ -48,8 +48,15 @@ class Coupons extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['coupons.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model->with(['company'])
                 ->where($where)
+                ->where($where_op)
                 ->order($sort, $order)
                 ->paginate($limit);
             foreach ($list as $row) {

+ 7 - 0
application/admin/controller/Order.php

@@ -52,9 +52,16 @@ class Order extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['order.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company','staff','user','preOrder','servicetype'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/Package.php

@@ -50,9 +50,16 @@ class Package extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['package.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company','servicetype'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/PreOrder.php

@@ -48,8 +48,15 @@ class PreOrder extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['pre_order.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model->with(['user','company','servicetype'])
                 ->where($where)
+                ->where($where_op)
                 ->order($sort, $order)
                 ->paginate($limit);
             foreach ($list as $row) {

+ 7 - 0
application/admin/controller/RechargeConfig.php

@@ -50,9 +50,16 @@ class RechargeConfig extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['recharge_config.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 7 - 0
application/admin/controller/UserCouponsLog.php

@@ -50,9 +50,16 @@ class UserCouponsLog extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //只能看自己的
+            $where_op = [];
+            if($this->auth->company_id){
+                $where_op['user_coupons_log.company_id'] = $this->auth->company_id;
+            }
+
             $list = $this->model
                     ->with(['company','user','coupons','staff'])
                     ->where($where)
+                    ->where($where_op)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 1 - 0
application/api/controller/company/Order.php

@@ -232,6 +232,7 @@ class Order extends Apic
         }
 
         $data = [
+            'company_id'   => $this->auth->company_id,
             'order_id'   => $id,
             'name'       => $name,
             'price'      => $price,