新增玩家列表列表及统计权限

master
chenzhi 5 years ago
parent 63b99ad198
commit 4e1567f013

@ -609,8 +609,6 @@ class AdminController extends Controller {
} }
} }
public function delShortcutIcon($id=0) { public function delShortcutIcon($id=0) {
if (!is_numeric($id) || $id<1) {$this->error('参数错误');} if (!is_numeric($id) || $id<1) {$this->error('参数错误');}
@ -631,5 +629,33 @@ class AdminController extends Controller {
} }
/**
* 验证列表的展示或者统计权限
* @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;
}
}
} }

@ -12,11 +12,12 @@ class MemberController extends ThinkController
/** /**
*玩家列表信息 *玩家列表信息
*/ */
public function user_info($p=0){ public function user_info($p=0){
//设定默认时间 //设定默认时间
if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ // 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'))); // $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d')));
} // }
//基础信息 //基础信息
$page = intval($p); $page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据 $page = $page ? $page : 1; //默认显示第一页数据
@ -53,7 +54,13 @@ class MemberController extends ThinkController
$map['tab_user.id'] = $_REQUEST['user_id']; $map['tab_user.id'] = $_REQUEST['user_id'];
} }
if (isset($_REQUEST['account'])) { if (isset($_REQUEST['account'])) {
//列表无权限要精准搜索
if($this->checkListOrCountAuth("list")){
$map['tab_user.account'] = ['like',I('account') . "%"]; $map['tab_user.account'] = ['like',I('account') . "%"];
}else{
$map['tab_user.account'] =I('account');
}
} }
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]]; $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_") $data = M("user","tab_")
@ -304,8 +318,6 @@ class MemberController extends ThinkController
$history_count = $history_count->find()['recharge_total']; $history_count = $history_count->find()['recharge_total'];
$this->assign('history_count', $history_count?:0); $this->assign('history_count', $history_count?:0);
} }
$this->assign('user_count',$user_count); $this->assign('user_count',$user_count);
$this->assign('now_count', $now_count?:0); $this->assign('now_count', $now_count?:0);

@ -235,7 +235,7 @@
<!-- 列表 --> <!-- 列表 -->
<tbody> <tbody>
<empty name ="list_data"> <empty name ="list_data">
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td> <td colspan="18" class="text-center">aOh! 暂时还没有内容!</td>
<else/> <else/>
<volist name="list_data" id="data"> <volist name="list_data" id="data">
<tr> <tr>
@ -327,6 +327,7 @@
</tr> </tr>
</volist> </volist>
</empty> </empty>
<if condition="$rule_count_check">
<tr class="data_summary"> <tr class="data_summary">
<td colspan="3" style="text-align: center;">汇总:</td> <td colspan="3" style="text-align: center;">汇总:</td>
@ -348,6 +349,8 @@
</if> </if>
</tr> </tr>
</if>
</tbody> </tbody>
</table> </table>
</div> </div>

Loading…
Cancel
Save