diff --git a/Application/Admin/Controller/AdminController.class.php b/Application/Admin/Controller/AdminController.class.php index 97bfe625a..c3e303e15 100644 --- a/Application/Admin/Controller/AdminController.class.php +++ b/Application/Admin/Controller/AdminController.class.php @@ -567,71 +567,100 @@ class AdminController extends Controller { } - public function addShortcutIcon() { - - $Kuaijieicon = M('Kuaijieicon'); - - $result = $Kuaijieicon->where(['url'=>$_REQUEST['url']])->find(); - - if ($result) { - - if ($result['status'] == 0) { - - $data = array('status'=>1,'id'=>$result['id']); - - $id = $Kuaijieicon->save($data); - - if($id){ - //记录行为 - action_log('Kuaijie/edit', 'Kuaijieicon', $result['id'], UID); - $this->success('添加成功'); - } else { - $this->error('添加失败'); - } - - } else { - - $this->error('已添加过常用设置'); - - } - - } else { + public function addShortcutIcon() { + + $Kuaijieicon = M('Kuaijieicon'); + + $result = $Kuaijieicon->where(['url'=>$_REQUEST['url']])->find(); + + if ($result) { + + if ($result['status'] == 0) { + + $data = array('status'=>1,'id'=>$result['id']); + + $id = $Kuaijieicon->save($data); + + if($id){ + //记录行为 + action_log('Kuaijie/edit', 'Kuaijieicon', $result['id'], UID); + $this->success('添加成功'); + } else { + $this->error('添加失败'); + } + + } else { + + $this->error('已添加过常用设置'); + + } + + } else { + + $data = array('title'=>$_REQUEST['title'],'status'=>1,'url'=>$_REQUEST['url'],'value'=>0); + + $id = $Kuaijieicon->add($data); + + if($id){ + //记录行为 + action_log('Kuaijie/add', 'Kuaijieicon', $id, UID); + $this->success('添加成功'); + } else { + $this->error('添加失败'); + } + + } + } + public function delShortcutIcon($id=0) { + + if (!is_numeric($id) || $id<1) {$this->error('参数错误');} + + $Kuaijieicon = M('Kuaijieicon'); - $data = array('title'=>$_REQUEST['title'],'status'=>1,'url'=>$_REQUEST['url'],'value'=>0); - - $id = $Kuaijieicon->add($data); - - if($id){ - //记录行为 - action_log('Kuaijie/add', 'Kuaijieicon', $id, UID); - $this->success('添加成功'); - } else { - $this->error('添加失败'); - } - - } - } - - - public function delShortcutIcon($id=0) { - - if (!is_numeric($id) || $id<1) {$this->error('参数错误');} - - $Kuaijieicon = M('Kuaijieicon'); - - $data = array('status'=>0,'id'=>$id); - - $res = $Kuaijieicon->save($data); - - if($res){ - //记录行为 - action_log('Kuaijie/del', 'Kuaijieicon', $id, UID); - $this->success('删除成功'); - } else { - $this->error('删除失败'); - } - - - } + $data = array('status'=>0,'id'=>$id); + + $res = $Kuaijieicon->save($data); + + if($res){ + //记录行为 + action_log('Kuaijie/del', 'Kuaijieicon', $id, UID); + $this->success('删除成功'); + } else { + $this->error('删除失败'); + } + + + } + /** + * 验证列表的展示或者统计权限 + * @param [type] $type 0:"_list_check",1:"_count_check" + * @return void + */ + public function checkListOrCountAuthRestMap(&$map,$checkarr = false,$countfield = "rule_count_check"){ + //验证count + if(IS_ROOT){ + $this->assign($countfield,true); + }else{ + $countRule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME."_count_check"); + $this->assign($countfield,$this->checkRule($countRule,array('in','1,2'))); + //验证list + $listrule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME."_list_check"); + $listflag = $this->checkRule($listrule,array('in','1,2')); + if(!$listflag && $checkarr){ + foreach ($checkarr as $v) { + if(isset($map[$v])){ + //如果有模糊查询改精准查询 + if($map[$v][0] == "like"){ + $map[$v] = trim($map[$v][1],"%"); + } + $listflag = true; + }; + } + } + if(!$listflag){ + $map["_string"] = "1=0"; + } + } + } } diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index c7b731c89..e297cb8f3 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -12,11 +12,12 @@ class MemberController extends ThinkController /** *玩家列表信息 */ + public function user_info($p=0){ //设定默认时间 - if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ - $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); - } + // if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ + // $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); + // } //基础信息 $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 @@ -98,15 +99,6 @@ class MemberController extends ThinkController $map['tab_user.device_number'] = $_REQUEST['device_number']; } $promoteRoot = getPowerPromoteIds(); - -// $data_empower_type = session('user_auth')['data_empower_type']; -//// var_dump($promoteRoot);die(); -// -// if ($promoteRoot) { -// $map['tab_user.promote_id'] =array('in',$promoteRoot); -// } else if(!$promoteRoot&&$data_empower_type!=1){ -// $map['tab_user.id'] = array('lt',1); -// } setPowerPromoteIds($map,'tab_user.promote_id'); //1.3 与推广员相关 @@ -135,6 +127,8 @@ class MemberController extends ThinkController } } } + //判断是否有列表和统计的权限 + $this->checkListOrCountAuthRestMap($map,["tab_user.id","tab_user.account","tab_user.device_number"]); //计算用户列表 $data = M("user","tab_") @@ -304,8 +298,6 @@ class MemberController extends ThinkController $history_count = $history_count->find()['recharge_total']; $this->assign('history_count', $history_count?:0); } - - $this->assign('user_count',$user_count); $this->assign('now_count', $now_count?:0); @@ -1175,6 +1167,9 @@ class MemberController extends ThinkController } // $map['type'] = 1; // $map['login_time'] = ['exp', 'login_time<>0']; + //判断是否有列表和统计的权限 + $this->checkListOrCountAuthRestMap($map,["user_account"]); + $extend = array(); $extend['map'] = $map; $count = M('UserLoginRecord','tab_') diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 0f27e6981..8c008686e 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -111,6 +111,7 @@ class SpendController extends ThinkController // $map = '1 = 2'; // $map1 = $map; // } + $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); $map1 = $map; $map1['pay_status'] = 1; $total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index 9ffabd858..f24028f15 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -631,6 +631,10 @@ class UserController extends AdminController $map['role_name'] = trim($_REQUEST['role_name']); unset($_REQUEST['role_name']); } + if (isset($_REQUEST['role_id'])) { + $map['role_id'] = trim($_REQUEST['role_id']); + unset($_REQUEST['role_id']); + } // $promoteRoot = getPowerPromoteIds(); // $data_empower_type = session('user_auth')['data_empower_type']; @@ -668,6 +672,7 @@ class UserController extends AdminController empty(I('user_account')) || $map['user_account'] = ['like', "%" . I('user_account') . "%"]; + $this->checkListOrCountAuthRestMap($map,["role_id", "role_name", "user_account"]); $list = $this->lists(M('user_play_info', 'tab_'), $map, 'play_time desc'); $this->assign('list', $list); $this->meta_title = '角色数据'; diff --git a/Application/Admin/View/Member/login_record.html b/Application/Admin/View/Member/login_record.html index 111fc7fb7..102143a0b 100644 --- a/Application/Admin/View/Member/login_record.html +++ b/Application/Admin/View/Member/login_record.html @@ -160,10 +160,12 @@ -