Browse Source

给代理的权限

lizhen_gitee 1 year ago
parent
commit
c9002d4315

+ 1 - 1
application/admin/controller/Banner.php

@@ -52,7 +52,7 @@ class Banner extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('banner');
+            $where_op = $this->whereop('banner.company_id');
 
             $list = $this->model
                     ->with(['company'])

+ 1 - 1
application/admin/controller/Company.php

@@ -52,7 +52,7 @@ class Company extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('company');
+            $where_op = $this->whereop('company.id');
 
             $list = $this->model
                     ->with(['wallet'])

+ 1 - 1
application/admin/controller/CompanyBank.php

@@ -51,7 +51,7 @@ class CompanyBank extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('company_bank');
+            $where_op = $this->whereop('company_bank.company_id');
 
             $list = $this->model
                     ->with(['company'])

+ 1 - 1
application/admin/controller/CompanyStaff.php

@@ -57,7 +57,7 @@ class CompanyStaff extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('company_staff');
+            $where_op = $this->whereop('company_staff.company_id');
 
             $list = $this->model
                     ->with(['company'])

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

@@ -51,7 +51,7 @@ class CompanyTakeCash extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('company_take_cash');
+            $where_op = $this->whereop('company_take_cash.user_id');
 
             $list = $this->model
                     ->with(['company'])

+ 1 - 1
application/admin/controller/Companycomment.php

@@ -51,7 +51,7 @@ class Companycomment extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('companycomment');
+            $where_op = $this->whereop('companycomment.company_id');
 
             $list = $this->model
                     ->with(['user','company'])

+ 1 - 1
application/admin/controller/Companymoneylog.php

@@ -51,7 +51,7 @@ class Companymoneylog extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('companymoneylog');
+            $where_op = $this->whereop('companymoneylog.user_id');
 
             $list = $this->model
                     ->with(['company'])

+ 1 - 1
application/admin/controller/Coupons.php

@@ -49,7 +49,7 @@ class Coupons extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('coupons');
+            $where_op = $this->whereop('coupons.company_id');
 
 
             $list = $this->model->with(['company'])

+ 1 - 1
application/admin/controller/Order.php

@@ -54,7 +54,7 @@ class Order extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('order');
+            $where_op = $this->whereop('order.company_id');
 
             $list = $this->model
                     ->with(['company','staff','user','preorder','servicetype'])

+ 1 - 1
application/admin/controller/Package.php

@@ -57,7 +57,7 @@ class Package extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('package');
+            $where_op = $this->whereop('package.company_id');
 
             $list = $this->model
                     ->with(['company','servicetype'])

+ 1 - 1
application/admin/controller/Preorder.php

@@ -52,7 +52,7 @@ class Preorder extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('preorder');
+            $where_op = $this->whereop('preorder.company_id');
 
             $list = $this->model
                     ->with(['company','user','servicetype','order'])

+ 1 - 1
application/admin/controller/RechargeConfig.php

@@ -51,7 +51,7 @@ class RechargeConfig extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('recharge_config');
+            $where_op = $this->whereop('recharge_config.company_id');
 
             $list = $this->model
                     ->with(['company'])

+ 1 - 1
application/admin/controller/UserCouponsLog.php

@@ -51,7 +51,7 @@ class UserCouponsLog extends Backend
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
             //只能看自己的
-            $where_op = $this->whereop('user_coupons_log');
+            $where_op = $this->whereop('user_coupons_log.company_id');
 
             $list = $this->model
                     ->with(['company','user','coupons','staff'])

+ 3 - 3
application/common/controller/Backend.php

@@ -231,7 +231,7 @@ class Backend extends Controller
         $this->assign('admin', Session::get('admin'));
     }
 
-    protected function whereop($alias = ''){
+    protected function whereop($field = ''){
 
         $where_op = [];
 
@@ -240,12 +240,12 @@ class Backend extends Controller
         if($group_id == 9){ //分公司
             $company_ids = Db::name('company')->where('agent_id',$this->auth->id)->column('id');
             if(!empty($company_ids)){
-                $where_op[$alias.'.id'] = ['IN',$company_ids];
+                $where_op[$field] = ['IN',$company_ids];
             }
         }
         if($group_id == 6 || $group_id == 7){ //老板或员工
             if($this->auth->company_id){
-                $where_op[$alias.'.id'] = $this->auth->company_id;
+                $where_op[$field] = $this->auth->company_id;
             }
         }
         return $where_op;