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

master
chenzhi 5 years ago
parent 63b99ad198
commit 4e1567f013

@ -565,71 +565,97 @@ class AdminController extends Controller {
}
public function addShortcutIcon() {
public function addShortcutIcon() {
$Kuaijieicon = M('Kuaijieicon');
$Kuaijieicon = M('Kuaijieicon');
$result = $Kuaijieicon->where(['url'=>$_REQUEST['url']])->find();
$result = $Kuaijieicon->where(['url'=>$_REQUEST['url']])->find();
if ($result) {
if ($result) {
if ($result['status'] == 0) {
if ($result['status'] == 0) {
$data = array('status'=>1,'id'=>$result['id']);
$data = array('status'=>1,'id'=>$result['id']);
$id = $Kuaijieicon->save($data);
$id = $Kuaijieicon->save($data);
if($id){
//记录行为
action_log('Kuaijie/edit', 'Kuaijieicon', $result['id'], UID);
$this->success('添加成功');
} else {
$this->error('添加失败');
}
} else {
if($id){
//记录行为
action_log('Kuaijie/edit', 'Kuaijieicon', $result['id'], UID);
$this->success('添加成功');
} else {
$this->error('添加失败');
}
$this->error('已添加过常用设置');
} else {
}
$this->error('已添加过常用设置');
} else {
}
$data = array('title'=>$_REQUEST['title'],'status'=>1,'url'=>$_REQUEST['url'],'value'=>0);
} else {
$id = $Kuaijieicon->add($data);
$data = array('title'=>$_REQUEST['title'],'status'=>1,'url'=>$_REQUEST['url'],'value'=>0);
if($id){
//记录行为
action_log('Kuaijie/add', 'Kuaijieicon', $id, UID);
$this->success('添加成功');
} else {
$this->error('添加失败');
}
$id = $Kuaijieicon->add($data);
}
}
if($id){
//记录行为
action_log('Kuaijie/add', 'Kuaijieicon', $id, UID);
$this->success('添加成功');
} else {
$this->error('添加失败');
}
}
}
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('参数错误');}
$Kuaijieicon = M('Kuaijieicon');
$Kuaijieicon = M('Kuaijieicon');
$data = array('status'=>0,'id'=>$id);
$data = array('status'=>0,'id'=>$id);
$res = $Kuaijieicon->save($data);
$res = $Kuaijieicon->save($data);
if($res){
//记录行为
action_log('Kuaijie/del', 'Kuaijieicon', $id, UID);
$this->success('删除成功');
} else {
$this->error('删除失败');
}
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;
}
}
}
}

@ -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);

@ -235,7 +235,7 @@
<!-- 列表 -->
<tbody>
<empty name ="list_data">
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
<td colspan="18" class="text-center">aOh! 暂时还没有内容!</td>
<else/>
<volist name="list_data" id="data">
<tr>
@ -327,27 +327,30 @@
</tr>
</volist>
</empty>
<tr class="data_summary">
<td colspan="3" style="text-align: center;">汇总:</td>
<if condition="I('promote_id') && I('promote_id') gt 0 ">
<td colspan="8">
当前用户累计充值:{$now_count} &#12288;&#12288;
历史累计充值:{$history_count}&#12288;&#12288;
用户数:{$user_count}
</td>
<td colspan="8" style="font-style: 12px;color: #a9a9a9;text-align: center;">
当前用户累计充值:&#12288;当前属于该推广员的用户的充值累计(不含用户换绑前记录)&#12288;&#12288;/&#12288;&#12288;
历史累计充值:&#12288;历史中属于该推广员的用户的充值累计(含用户换绑前记录)
</td>
<else />
<td colspan="99">
当前用户累计充值:{$now_count}&#12288;&#12288;用户数:{$user_count}
</td>
<if condition="$rule_count_check">
<tr class="data_summary">
<td colspan="3" style="text-align: center;">汇总:</td>
<if condition="I('promote_id') && I('promote_id') gt 0 ">
<td colspan="8">
当前用户累计充值:{$now_count} &#12288;&#12288;
历史累计充值:{$history_count}&#12288;&#12288;
用户数:{$user_count}
</td>
<td colspan="8" style="font-style: 12px;color: #a9a9a9;text-align: center;">
当前用户累计充值:&#12288;当前属于该推广员的用户的充值累计(不含用户换绑前记录)&#12288;&#12288;/&#12288;&#12288;
历史累计充值:&#12288;历史中属于该推广员的用户的充值累计(含用户换绑前记录)
</td>
<else />
<td colspan="99">
当前用户累计充值:{$now_count}&#12288;&#12288;用户数:{$user_count}
</td>
</if>
</if>
</tr>
</if>
</tr>
</tbody>
</table>
</div>

Loading…
Cancel
Save