Ver Fonte

公会列表,公会成员列表 分配权限

lizhen_gitee há 2 anos atrás
pai
commit
19020d3765

+ 14 - 1
application/admin/controller/Ghuser.php

@@ -68,14 +68,27 @@ class Ghuser extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //公会分权限
+            $gh_map = [];
+            $gh_ids = db('admin')->where('id',$this->auth->id)->value('gh_ids');
+            if(empty($gh_ids)){
+                $gh_map = ['ghuser.gh_id' => '-1'];
+            }else{
+                $gh_map = ['ghuser.gh_id' => ['IN',$gh_ids]];
+            }
+            if($gh_ids == '*'){
+                $gh_map = [];
+            }
+
             $list = $this->model
                     ->with(['gonghui'])
                     ->where($where)
+                    ->where($gh_map)
                     ->order($sort, $order)
+                   // ->select(false);dump($list);exit;
                     ->paginate($limit);
 
             foreach ($list as $row) {
-                
                 $row->getRelation('gonghui')->visible(['name']);
             }
 

+ 14 - 0
application/admin/controller/Gonghui.php

@@ -44,9 +44,23 @@ class Gonghui extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            //公会分权限
+            $gh_map = [];
+            $gh_ids = db('admin')->where('id',$this->auth->id)->value('gh_ids');
+            if(empty($gh_ids)){
+                $gh_map = ['id' => '-1'];
+            }else{
+                $gh_map = ['id' => ['IN',$gh_ids]];
+            }
+            if($gh_ids == '*'){
+                $gh_map = [];
+            }
+
             $list = $this->model
                 ->where($where)
+                ->where($gh_map)
                 ->order($sort, $order)
+                //->select(false);dump($list);exit;
                 ->paginate($limit);
 
             $rows = collection($list->items())->toArray();

+ 1 - 1
application/admin/view/auth/admin/add.html

@@ -33,7 +33,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">公会:</label>
         <div class="col-xs-12 col-sm-8">
-            {:build_select('gh[]', $gh, null, ['class'=>'form-control selectpicker', 'multiple'=>'', 'data-rule'=>'required'])}
+            {:build_select('gh[]', $gh, null, ['class'=>'form-control selectpicker', 'multiple'=>''])}
         </div>
     </div>
     <div class="form-group">

+ 1 - 1
application/admin/view/auth/admin/edit.html

@@ -39,7 +39,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">公会:</label>
         <div class="col-xs-12 col-sm-8">
-            {:build_select('gh[]', $gh, $gh_ids, ['class'=>'form-control selectpicker', 'multiple'=>'', 'data-rule'=>'required'])}
+            {:build_select('gh[]', $gh, $gh_ids, ['class'=>'form-control selectpicker', 'multiple'=>''])}
         </div>
     </div>
     <div class="form-group">

+ 3 - 1
二期修改数据库.txt

@@ -17,4 +17,6 @@ mt_order_wechataccount 新增全表                            已同步到线
 mt_basedata 新增一行  聊天规范                               已同步到线上
 网站配置新增  解锁微信号,解锁私密视频                      已同步到线上
 mt_user_wallet   新增字段 vip_level                       已同步到线上
-mt_payvip_config 新增字段 vip_level                       已同步到线上
+mt_payvip_config 新增字段 vip_level                       已同步到线上
+
+mt_admin 新增字段 gh_ids