From 4e1567f01380606cfefc2689dda4701ef9d49a84 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 13 Jan 2020 18:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8E=A9=E5=AE=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=88=97=E8=A1=A8=E5=8F=8A=E7=BB=9F=E8=AE=A1=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/AdminController.class.php | 156 ++++++++++-------- .../Controller/MemberController.class.php | 24 ++- Application/Admin/View/Member/user_info.html | 43 ++--- 3 files changed, 132 insertions(+), 91 deletions(-) diff --git a/Application/Admin/Controller/AdminController.class.php b/Application/Admin/Controller/AdminController.class.php index d62e3d01a..e05372468 100644 --- a/Application/Admin/Controller/AdminController.class.php +++ b/Application/Admin/Controller/AdminController.class.php @@ -565,71 +565,97 @@ 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 checkListOrCountAuth($type,$checkarr = false) + { + $flag = false; + if(IS_ROOT){ $flag=true; } + $suffix = $type=="list" ? "_list_check" :"_count_check"; + $rule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME.$suffix); + if($this->checkRule($rule,array('in','1,2'))){ + $flag = true; + } + if(!$flag && $checkarr){ + foreach ($checkarr as $v) { + if(isset($_REQUEST[$v])){ + $flag = true; + }; + } + } + if($type == "count"){ + $this->assign("rule_count_check",$flag); + }else{ + return $flag; + } + + } } diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index f4ab7e9c2..40548f3e6 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; //默认显示第一页数据 @@ -53,7 +54,13 @@ class MemberController extends ThinkController $map['tab_user.id'] = $_REQUEST['user_id']; } if (isset($_REQUEST['account'])) { - $map['tab_user.account'] = ['like',I('account') . "%"]; + //列表无权限要精准搜索 + if($this->checkListOrCountAuth("list")){ + $map['tab_user.account'] = ['like',I('account') . "%"]; + }else{ + $map['tab_user.account'] =I('account'); + } + } if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $map['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]]; @@ -135,6 +142,13 @@ class MemberController extends ThinkController } } } + //判断列表权限 + $listauth = $this->checkListOrCountAuth("count"); + $listauth = $this->checkListOrCountAuth("list",["user_id","account","device_number"]); + if(!$listauth){ + //没权限 + $map['tab_user.id'] = 0; + } //计算用户列表 $data = M("user","tab_") @@ -304,8 +318,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); diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index 42450fb62..fb0879e78 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -235,7 +235,7 @@ - aOh! 暂时还没有内容! + aOh! 暂时还没有内容! @@ -327,27 +327,30 @@ - - 汇总: - - - - 当前用户累计充值:{$now_count}    - 历史累计充值:{$history_count}   - 用户数:{$user_count} - - - 当前用户累计充值: 当前属于该推广员的用户的充值累计(不含用户换绑前记录)  /   - 历史累计充值: 历史中属于该推广员的用户的充值累计(含用户换绑前记录) - - - - 当前用户累计充值:{$now_count}  用户数:{$user_count} - + + + 汇总: - + + + 当前用户累计充值:{$now_count}    + 历史累计充值:{$history_count}   + 用户数:{$user_count} + + + 当前用户累计充值: 当前属于该推广员的用户的充值累计(不含用户换绑前记录)  /   + 历史累计充值: 历史中属于该推广员的用户的充值累计(含用户换绑前记录) + + + + 当前用户累计充值:{$now_count}  用户数:{$user_count} + + + + + + -