From a53970efcf0a0a1b2de82b995d5fee1c3372b179 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 21 Nov 2019 20:34:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B1=87=E6=80=BB->=E5=85=85=E5=80=BC=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/AutoPackController.class.php | 12 +- .../Admin/Controller/UserController.class.php | 640 ++++++++++-------- .../Admin/Controller/access_data_foldline.txt | 2 +- .../Home/Controller/QueryController.class.php | 27 + 4 files changed, 386 insertions(+), 295 deletions(-) diff --git a/Application/Admin/Controller/AutoPackController.class.php b/Application/Admin/Controller/AutoPackController.class.php index 48f286288..e4a6b4bb1 100644 --- a/Application/Admin/Controller/AutoPackController.class.php +++ b/Application/Admin/Controller/AutoPackController.class.php @@ -297,17 +297,17 @@ class AutoPackController extends Think $map = []; $map['status'] = 1; $map['enable_status'] = ['in', '0,2']; - + $applys = M('apply', 'tab_')->field('id,game_id,game_name,promote_id,promote_account,sdk_version') ->where($map) ->order('bale_sort desc,id desc') ->limit(200) ->select(); - + if (count($applys) == 0) { Printer::export('无等待队列', true); } - + $applyIds = array_column($applys, 'id'); M('apply', 'tab_')->where(['id' => ['in', $applyIds]])->save(['enable_status' => 3]); @@ -353,7 +353,7 @@ class AutoPackController extends Think ->field('a.id,a.game_id,a.game_name,a.promote_account,a.pack_url,a.plist_url,a.promote_id,a.sdk_version,a.enable_status') ->join('tab_apply_launch as al on (al.apply_id=a.id) ') ->where($map) - ->limit(300) + ->limit(300) ->group('a.id') ->select(); foreach ($apply as $key => $value) { @@ -367,7 +367,7 @@ class AutoPackController extends Think $launchmodel -> where(['apply_id' => $value['id']]) -> setField('launch_packge', 0); continue; } - + if (!empty($gameSourceUrl) && is_file($gameSourceUrl)) { $launch = $launchmodel -> where(['apply_id' => $value['id'], 'launch_packge' => array('in', [0, 2, 3])]) -> select(); @@ -1054,6 +1054,4 @@ class AutoPackController extends Think return ''; } } - - } diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index 14fac80d8..8c95a0240 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -8,6 +8,7 @@ // +---------------------------------------------------------------------- namespace Admin\Controller; + use User\Api\UserApi; use Com\Wechat; use Com\WechatAuth; @@ -16,32 +17,34 @@ use Com\WechatAuth; * 后台用户控制器 * @author 麦当苗儿 */ -class UserController extends AdminController { +class UserController extends AdminController +{ /** * 用户管理首页 * @author 麦当苗儿 */ - public function index(){ - $nickname = I('nickname'); - if(isset($_REQUEST['status'])){ - $map['status'] = $_REQUEST['status']; - } - if(is_numeric($nickname)){ - $map['uid|nickname']= array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true); - }else{ - $map['nickname'] = array('like', '%'.(string)$nickname.'%'); - } - - $list = $this->lists('Member', $map); + public function index() + { + $nickname = I('nickname'); + if (isset($_REQUEST['status'])) { + $map['status'] = $_REQUEST['status']; + } + if (is_numeric($nickname)) { + $map['uid|nickname'] = array(intval($nickname), array('like', '%' . $nickname . '%'), '_multi' => true); + } else { + $map['nickname'] = array('like', '%' . (string)$nickname . '%'); + } + + $list = $this->lists('Member', $map); int_to_string($list); $this->assign('_list', $list); $this->meta_title = '管理员列表'; - - $this->m_title = '管理员列表'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); - + + $this->m_title = '管理员列表'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find()); + $this->display(); } @@ -49,7 +52,8 @@ class UserController extends AdminController { * 修改昵称初始化 * @author huajie */ - public function updateNickname(){ + public function updateNickname() + { $nickname = M('Member')->getFieldByUid(UID, 'nickname'); $this->assign('nickname', $nickname); $this->meta_title = '修改昵称'; @@ -60,7 +64,8 @@ class UserController extends AdminController { * 修改昵称提交 * @author huajie */ - public function submitNickname(){ + public function submitNickname() + { //获取参数 $nickname = I('post.nickname'); $password = I('post.password'); @@ -68,25 +73,25 @@ class UserController extends AdminController { empty($password) && $this->error('请输入密码'); //密码验证 - $User = new UserApi(); - $uid = $User->login(UID, $password, 4); + $User = new UserApi(); + $uid = $User->login(UID, $password, 4); ($uid == -2) && $this->error('密码不正确'); - $Member = D('Member'); - $data = $Member->create(array('nickname'=>$nickname)); - if(!$data){ + $Member = D('Member'); + $data = $Member->create(array('nickname' => $nickname)); + if (!$data) { $this->error($Member->getError()); } - $res = $Member->where(array('uid'=>$uid))->save($data); + $res = $Member->where(array('uid' => $uid))->save($data); - if($res){ - $user = session('user_auth'); - $user['username'] = $data['nickname']; + if ($res) { + $user = session('user_auth'); + $user['username'] = $data['nickname']; session('user_auth', $user); session('user_auth_sign', data_auth_sign($user)); $this->success('修改昵称成功!'); - }else{ + } else { $this->error('修改昵称失败!'); } } @@ -95,7 +100,8 @@ class UserController extends AdminController { * 修改密码初始化 * @author huajie */ - public function updatePassword(){ + public function updatePassword() + { $this->meta_title = '修改密码'; $this->display('updatepassword'); } @@ -104,24 +110,25 @@ class UserController extends AdminController { * 修改密码提交 * @author huajie */ - public function submitPassword(){ + public function submitPassword() + { //获取参数 - $password = I('post.old'); + $password = I('post.old'); empty($password) && $this->error('请输入原密码'); $data['password'] = I('post.password'); empty($data['password']) && $this->error('请输入新密码'); $repassword = I('post.repassword'); empty($repassword) && $this->error('请输入确认密码'); - if($data['password'] !== $repassword){ + if ($data['password'] !== $repassword) { $this->error('您输入的新密码与确认密码不一致'); } - $Api = new UserApi(); - $res = $Api->updateInfo(UID, $password, $data); - if($res['status']){ + $Api = new UserApi(); + $res = $Api->updateInfo(UID, $password, $data); + if ($res['status']) { $this->success('修改密码成功!'); - }else{ + } else { $this->error($res['info']); } } @@ -130,13 +137,14 @@ class UserController extends AdminController { * 用户行为列表 * @author huajie */ - public function action(){ + public function action() + { //获取列表数据 - $Action = M('Action')->where(array('status'=>array('gt',-1))); - $list = $this->lists($Action); + $Action = M('Action')->where(array('status' => array('gt', -1))); + $list = $this->lists($Action); int_to_string($list); // 记录当前列表页的cookie - Cookie('__forward__',$_SERVER['REQUEST_URI']); + Cookie('__forward__', $_SERVER['REQUEST_URI']); $this->assign('_list', $list); $this->meta_title = '用户行为'; @@ -147,9 +155,10 @@ class UserController extends AdminController { * 新增行为 * @author huajie */ - public function addAction(){ + public function addAction() + { $this->meta_title = '新增行为'; - $this->assign('data',null); + $this->assign('data', null); $this->display('editaction'); } @@ -157,12 +166,13 @@ class UserController extends AdminController { * 编辑行为 * @author huajie */ - public function editAction(){ + public function editAction() + { $id = I('get.id'); empty($id) && $this->error('参数不能为空!'); $data = M('Action')->field(true)->find($id); - $this->assign('data',$data); + $this->assign('data', $data); $this->meta_title = '编辑行为'; $this->display('editaction'); } @@ -171,12 +181,13 @@ class UserController extends AdminController { * 更新行为 * @author huajie */ - public function saveAction(){ + public function saveAction() + { $res = D('Action')->update(); - if(!$res){ + if (!$res) { $this->error(D('Action')->getError()); - }else{ - $this->success($res['id']?'更新成功!':'新增成功!', Cookie('__forward__')); + } else { + $this->success($res['id'] ? '更新成功!' : '新增成功!', Cookie('__forward__')); } } @@ -184,23 +195,24 @@ class UserController extends AdminController { * 会员状态修改 * @author 朱亚杰 */ - public function changeUserStatus($method=null){ - $id = array_unique((array)I('id',0)); - if( in_array(C('USER_ADMINISTRATOR'), $id)){ + public function changeUserStatus($method = null) + { + $id = array_unique((array)I('id', 0)); + if (in_array(C('USER_ADMINISTRATOR'), $id)) { $this->error("不允许对超级管理员执行该操作!"); } - $id = is_array($id) ? implode(',',$id) : $id; - if ( empty($id) ) { + $id = is_array($id) ? implode(',', $id) : $id; + if (empty($id)) { $this->error('请选择要操作的数据!'); } - $map['uid'] = array('in',$id); - $map1['id'] = array('in',$id); - $status=I('method')=='forbidUser'?0:1; - $res= M('UcenterMember')->where($map1)->setField('status',$status); - $res1= M('Member')->where($map)->setField('status',$status); - if($res&&$res1){ + $map['uid'] = array('in', $id); + $map1['id'] = array('in', $id); + $status = I('method') == 'forbidUser' ? 0 : 1; + $res = M('UcenterMember')->where($map1)->setField('status', $status); + $res1 = M('Member')->where($map)->setField('status', $status); + if ($res && $res1) { $this->success('更新成功!'); - }else{ + } else { $this->error('更新失败!'); } @@ -211,43 +223,45 @@ class UserController extends AdminController { * 会员状态修改 * @author 朱亚杰 */ - public function changeStatus($method=null){ - $id = array_unique((array)I('id',0)); - if( in_array(C('USER_ADMINISTRATOR'), $id)){ + public function changeStatus($method = null) + { + $id = array_unique((array)I('id', 0)); + if (in_array(C('USER_ADMINISTRATOR'), $id)) { $this->error("不允许对超级管理员执行该操作!"); } - $id = is_array($id) ? implode(',',$id) : $id; - if ( empty($id) ) { + $id = is_array($id) ? implode(',', $id) : $id; + if (empty($id)) { $this->error('请选择要操作的数据!'); } - $map['uid'] = array('in',$id); - switch ( strtolower($method) ){ + $map['uid'] = array('in', $id); + switch (strtolower($method)) { case 'forbiduser': - \Think\Log::actionLog('User/changeStatus?method=forbidUser','user',1); - $this->forbid('Member', $map ); + \Think\Log::actionLog('User/changeStatus?method=forbidUser', 'user', 1); + $this->forbid('Member', $map); break; case 'resumeuser': - \Think\Log::actionLog('User/changeStatus?method=resumeuser','user',1); - $this->resume('Member', $map ); + \Think\Log::actionLog('User/changeStatus?method=resumeuser', 'user', 1); + $this->resume('Member', $map); break; case 'deleteuser': - \Think\Log::actionLog('User/changeStatus?method=deleteuser','user',1); - $this->delete('Member', $map ); + \Think\Log::actionLog('User/changeStatus?method=deleteuser', 'user', 1); + $this->delete('Member', $map); break; default: $this->error('参数非法'); } } - public function add($username = '', $password = '', $repassword = '', $email = '',$second_pwd=''){ + public function add($username = '', $password = '', $repassword = '', $email = '', $second_pwd = '') + { - if(IS_POST){ + if (IS_POST) { /*检测用户名是否为空*/ - if (empty($username)){ + if (empty($username)) { $this->error('管理员账号不能为空!'); } /* 检测密码 */ - if($password != $repassword){ + if ($password != $repassword) { $this->error('管理员密码和确认密码不一致!'); } $usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find(); @@ -259,84 +273,87 @@ class UserController extends AdminController { $this->error('邮箱已存在!'); } /* 调用注册接口注册用户 */ - $User = new UserApi; - $uid = $User->register($username, $password, $email,$second_pwd); - if(0 < $uid){ //注册成功 + $User = new UserApi; + $uid = $User->register($username, $password, $email, $second_pwd); + if (0 < $uid) { //注册成功 $user = array('uid' => $uid, 'nickname' => $username, 'status' => 1); $data['uid'] = $uid; $data['group_id'] = I('auth'); M('auth_group_access')->data($data)->add(); - if(!M('Member')->add($user)){ + if (!M('Member')->add($user)) { $this->error('用户添加失败!'); } else { - \Think\Log::actionLog('User/add','Member',$uid); - $this->success('用户添加成功!',U('index')); + \Think\Log::actionLog('User/add', 'Member', $uid); + $this->success('用户添加成功!', U('index')); } } else { //注册失败,显示错误信息 $this->error($this->showRegError($uid)); } } else { - $list=D('AuthGroup')->where(array('status'=>1))->select(); - $this->assign('lists',$list); + $list = D('AuthGroup')->where(array('status' => 1))->select(); + $this->assign('lists', $list); $this->meta_title = '新增管理员'; - - - $this->m_title = '管理员列表'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); - - + + $this->m_title = '管理员列表'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find()); + + $this->display(); } } -/** - * 系统非常规MD5加密方法 - * @param string $str 要加密的字符串 - * @return string - */ -function think_ucenter_md5($str, $key = 'ThinkUCenter'){ - return '' === $str ? '' : md5(sha1($str) . $key); -} - public function edit($id){ + + /** + * 系统非常规MD5加密方法 + * @param string $str 要加密的字符串 + * @return string + */ + function think_ucenter_md5($str, $key = 'ThinkUCenter') + { + return '' === $str ? '' : md5(sha1($str) . $key); + } + + public function edit($id) + { // var_dump(session());exit; - if(IS_POST){ - if(isset($_POST['bind_wx'])){ - if($_POST['bind_wx']=='unbind_wx'){ - $info['admin_openid']=''; - }else{ - $info['admin_openid']=session('admin_openid'); - if($info['admin_openid']==''){ + if (IS_POST) { + if (isset($_POST['bind_wx'])) { + if ($_POST['bind_wx'] == 'unbind_wx') { + $info['admin_openid'] = ''; + } else { + $info['admin_openid'] = session('admin_openid'); + if ($info['admin_openid'] == '') { $this->error('请在30分钟内扫描并关注微信公众号!'); } } } - if($_POST['auth']==''&&$id!=1){ + if ($_POST['auth'] == '' && $id != 1) { $this->error('请选择用户权限!'); } - if($_POST['password']==''){ + if ($_POST['password'] == '') { //$this->error('请填写管理员密码!'); } - if(!empty($_POST['password']) && (strlen($_POST['password'])<6 || strlen($_POST['password']) > 30)){ + if (!empty($_POST['password']) && (strlen($_POST['password']) < 6 || strlen($_POST['password']) > 30)) { $this->error('管理员密码长度必须在6-30个字符之间!'); } - if($_POST['second_pwd']==''){ + if ($_POST['second_pwd'] == '') { //$this->error('请填写二级密码!'); } - if(!empty($_POST['second_pwd']) && (strlen($_POST['second_pwd'])<6 || strlen($_POST['second_pwd']) > 30)){ + if (!empty($_POST['second_pwd']) && (strlen($_POST['second_pwd']) < 6 || strlen($_POST['second_pwd']) > 30)) { $this->error('二级密码长度必须在6-30个字符之间!'); } - if($_POST['email']==''){ + if ($_POST['email'] == '') { $this->error('请填写邮箱!'); } - - $pattern = "/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i"; - - if(!preg_match( $pattern, $_POST['email'])) { - $this->error('邮箱格式不正确!'); - } - if(isset($_POST['mobile'])&&$_POST['mobile']!=''){ + + $pattern = "/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i"; + + if (!preg_match($pattern, $_POST['email'])) { + $this->error('邮箱格式不正确!'); + } + if (isset($_POST['mobile']) && $_POST['mobile'] != '') { $dx = A('Phone'); - $res = $dx->check_tel_code($_POST['mobile'],$_POST['code']); + $res = $dx->check_tel_code($_POST['mobile'], $_POST['code']); switch ($res) { case '-1': $this->error('短信验证码无效,请重新获取'); @@ -349,27 +366,27 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ break; } } - $Member=D('UcenterMember'); - $mem=D('Member'); - $au=D('AuthGroupAccess'); - $map['id']=$id; - $maps['uid']=$id; - $info['username']=$_POST['username']; - $in['nickname']=$_POST['username']; - $pwd=$this->think_ucenter_md5($_POST['password'],UC_AUTH_KEY); - $spwd=$this->think_ucenter_md5($_POST['second_pwd'],UC_AUTH_KEY); - $rpwd=$Member->where(array('id'=>$id))->find(); - $oldpwd=$rpwd['password']; - $oldspwd=$rpwd['second_pwd']; + $Member = D('UcenterMember'); + $mem = D('Member'); + $au = D('AuthGroupAccess'); + $map['id'] = $id; + $maps['uid'] = $id; + $info['username'] = $_POST['username']; + $in['nickname'] = $_POST['username']; + $pwd = $this->think_ucenter_md5($_POST['password'], UC_AUTH_KEY); + $spwd = $this->think_ucenter_md5($_POST['second_pwd'], UC_AUTH_KEY); + $rpwd = $Member->where(array('id' => $id))->find(); + $oldpwd = $rpwd['password']; + $oldspwd = $rpwd['second_pwd']; $User = new UserApi; - $info['password']= (empty($pwd) || $pwd==$oldpwd)?$oldpwd:$pwd; - $info['second_pwd']= (empty($spwd) || $spwd==$oldspwd)?$oldspwd:$spwd; - $info['email']=$_POST['email']; - $info['mobile']=isset($_POST['mobile'])?$_POST['mobile']:''; - $ss['group_id']=$_POST['auth']; - $ss['houtai']=$_POST['houtai']; - $smember=$Member->where($map)->save($info); - $meb=$mem->where($maps)->save($in); + $info['password'] = (empty($pwd) || $pwd == $oldpwd) ? $oldpwd : $pwd; + $info['second_pwd'] = (empty($spwd) || $spwd == $oldspwd) ? $oldspwd : $spwd; + $info['email'] = $_POST['email']; + $info['mobile'] = isset($_POST['mobile']) ? $_POST['mobile'] : ''; + $ss['group_id'] = $_POST['auth']; + $ss['houtai'] = $_POST['houtai']; + $smember = $Member->where($map)->save($info); + $meb = $mem->where($maps)->save($in); if ($au->where(array('uid' => $id))->find()) { if ($ss['group_id'] == '') { unset($ss['group_id']); @@ -379,178 +396,223 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ $ss['uid'] = $id; $ag = $au->add($ss); } - - if($smember !== false||$meb||$ag){ - M('user_pwd')->where($maps)->setField('password',think_encrypt($info['password'])); - $this->success('修改成功!',U('User/index')); - }else{ - $this->error('修改失败!',U('User/index')); + + if ($smember !== false || $meb || $ag) { + M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password'])); + $this->success('修改成功!', U('User/index')); + } else { + $this->error('修改失败!', U('User/index')); } - }else{ - $map['id']=$_GET['id']; - $Member=D('UcenterMember')->where($map)->find(); - $au=D('AuthGroupAccess')->where(array('uid'=>$_GET['id']))->find(); - $this->assign("authid",$au["group_id"]); - $this->assign("houtai",$au["houtai"]); - $list=D('AuthGroup')->where(array('status'=>1))->select(); - $username=$_POST['username']; - $password=$_POST['password']; - $this->assign('lists',$list); - $this->assign('list',$Member); - $this->assign('sd',$group); - $this->meta_title = '编辑管理员'; - - $this->m_title = '管理员列表'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); - - + } else { + $map['id'] = $_GET['id']; + $Member = D('UcenterMember')->where($map)->find(); + $au = D('AuthGroupAccess')->where(array('uid' => $_GET['id']))->find(); + $this->assign("authid", $au["group_id"]); + $this->assign("houtai", $au["houtai"]); + $list = D('AuthGroup')->where(array('status' => 1))->select(); + $username = $_POST['username']; + $password = $_POST['password']; + $this->assign('lists', $list); + $this->assign('list', $Member); + $this->assign('sd', $group); + $this->meta_title = '编辑管理员'; + + $this->m_title = '管理员列表'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find()); + + $this->display(); } } - public function bdwx(){ - $map['id']=UID; - $Member=D('UcenterMember')->field('id,username,admin_openid,openid_sign')->where($map)->find(); - $this->assign('id',$map['id']); - $this->assign('list',$Member); + + public function bdwx() + { + $map['id'] = UID; + $Member = D('UcenterMember')->field('id,username,admin_openid,openid_sign')->where($map)->find(); + $this->assign('id', $map['id']); + $this->assign('list', $Member); $this->meta_title = '绑定微信'; $this->display(); } - public function updatelist($p=0){ + + public function updatelist($p = 0) + { $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} - if(isset($_REQUEST['op_account'])){ - if ($_REQUEST['op_account']=='全部') { + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + if (isset($_REQUEST['op_account'])) { + if ($_REQUEST['op_account'] == '全部') { unset($_REQUEST['op_account']); - }else{ - $map['op_account'] = trim($_REQUEST['op_account']); + } else { + $map['op_account'] = trim($_REQUEST['op_account']); unset($_REQUEST['op_account']); } } - if(isset($_REQUEST['game_name'])){ - $map['game_name'] = trim($_REQUEST['game_name']); + if (isset($_REQUEST['game_name'])) { + $map['game_name'] = trim($_REQUEST['game_name']); unset($_REQUEST['game_name']); } - if(isset($_REQUEST['account'])){ - $map['user_account'] = array('like','%'.trim($_REQUEST['account']).'%'); + if (isset($_REQUEST['account'])) { + $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%'); unset($_REQUEST['account']); } - if(isset($_REQUEST['huobi'])){ - $map['type'] = $_REQUEST['huobi']; + if (isset($_REQUEST['huobi'])) { + $map['type'] = $_REQUEST['huobi']; unset($_REQUEST['huobi']); } - if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){ - $map['create_time'] = array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); - unset($_REQUEST['timestart']);unset($_REQUEST['timeend']); - }elseif(isset($_REQUEST['timestart'])){ - $map['create_time'] = ['GT',strtotime(I('timestart'))]; + if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1)); unset($_REQUEST['timestart']); - }elseif(isset($_REQUEST['timeend'])){ - $map['create_time'] = ['LT',strtotime(I('timeend'))+86399]; + unset($_REQUEST['timeend']); + } elseif (isset($_REQUEST['timestart'])) { + $map['create_time'] = ['GT', strtotime(I('timestart'))]; + unset($_REQUEST['timestart']); + } elseif (isset($_REQUEST['timeend'])) { + $map['create_time'] = ['LT', strtotime(I('timeend')) + 86399]; unset($_REQUEST['timeend']); } - $list=M('balance_edit','tab_') + $list = M('balance_edit', 'tab_') ->where($map) ->order('create_time desc') ->page($page, $row) ->select(); - $count = M('balance_edit','tab_')->where($map)->count(); + $count = M('balance_edit', 'tab_')->where($map)->count(); //分页 - $page = set_pagination($count,$row); - if($page) {$this->assign('_page', $page);} - - $this->assign('list',$list); + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + + $this->assign('list', $list); $this->meta_title = '修改记录'; - - $this->m_title = '账户修改记录'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Member/login_record','status'=>1])->find()); - - + + $this->m_title = '账户修改记录'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Member/login_record', 'status' => 1])->find()); + + $this->display('updatelist'); } + /** * 获取用户注册错误信息 - * @param integer $code 错误编码 + * @param integer $code 错误编码 * @return string 错误信息 */ - private function showRegError($code = 0){ + private function showRegError($code = 0) + { switch ($code) { - case -1: $error = '管理员账号长度必须在16个字符以内!'; break; - case -2: $error = '管理员账号被禁止注册!'; break; - case -3: $error = '管理员账号被占用!'; break; - case -4: $error = '管理员密码长度必须在6-30个字符之间!'; break; - case -5: $error = '邮箱格式不正确!'; break; - case -6: $error = '邮箱长度必须在1-32个字符之间!'; break; - case -7: $error = '邮箱被禁止注册!'; break; - case -8: $error = '邮箱被占用!'; break; - case -9: $error = '手机格式不正确!'; break; - case -10: $error = '手机被禁止注册!'; break; - case -11: $error = '手机号被占用!'; break; - case -12: $error = '二级密码长度必须在6-30个字符之间!';break; - default: $error = '未知错误'; + case -1: + $error = '管理员账号长度必须在16个字符以内!'; + break; + case -2: + $error = '管理员账号被禁止注册!'; + break; + case -3: + $error = '管理员账号被占用!'; + break; + case -4: + $error = '管理员密码长度必须在6-30个字符之间!'; + break; + case -5: + $error = '邮箱格式不正确!'; + break; + case -6: + $error = '邮箱长度必须在1-32个字符之间!'; + break; + case -7: + $error = '邮箱被禁止注册!'; + break; + case -8: + $error = '邮箱被占用!'; + break; + case -9: + $error = '手机格式不正确!'; + break; + case -10: + $error = '手机被禁止注册!'; + break; + case -11: + $error = '手机号被占用!'; + break; + case -12: + $error = '二级密码长度必须在6-30个字符之间!'; + break; + default: + $error = '未知错误'; } return $error; } - public function get_openid(){ + + public function get_openid() + { $User = new UserApi; - if($_POST['id']>999){ - $this->ajaxReturn(array('status'=>0,'msg'=>'管理员id不能大于999')); + if ($_POST['id'] > 999) { + $this->ajaxReturn(array('status' => 0, 'msg' => '管理员id不能大于999')); } $data = $User->verifyPwd($_POST['id'], $_POST['pwd']); - if(!$data){ - $this->ajaxReturn(array('status'=>0,'msg'=>'密码错误,请重新选择')); + if (!$data) { + $this->ajaxReturn(array('status' => 0, 'msg' => '密码错误,请重新选择')); } - $appid = C('wechat.appid'); + $appid = C('wechat.appid'); $appsecret = C('wechat.appsecret'); - $result=auto_get_access_token(dirname(__FILE__).'/access_token_validity.txt'); - if($result['is_validity']){ - session('token',$result['access_token']); - $auth = new WechatAuth($appid, $appsecret,$result['access_token']); - }else{ - $auth = new WechatAuth($appid, $appsecret); + $result = auto_get_access_token(dirname(__FILE__) . '/access_token_validity.txt'); + if ($result['is_validity']) { + session('token', $result['access_token']); + $auth = new WechatAuth($appid, $appsecret, $result['access_token']); + } else { + $auth = new WechatAuth($appid, $appsecret); $token = $auth->getAccessToken(); - $token['expires_in_validity']=time()+$token['expires_in']; - wite_text(json_encode($token),dirname(__FILE__).'/access_token_validity.txt'); - session('token',$token['access_token']); + $token['expires_in_validity'] = time() + $token['expires_in']; + wite_text(json_encode($token), dirname(__FILE__) . '/access_token_validity.txt'); + session('token', $token['access_token']); } - $times=date('s',time()); + $times = date('s', time()); // $scene_id=strrev($_POST['id'].$times); - $scene_id=$_POST['id'].$times.$_POST['type']; - session('scene_id',$scene_id); - $ticket = $auth->qrcodeCreate($scene_id,600);//10分钟 - if($ticket==''){ - $return=array('status'=>0,'data'=>'获取ticket失败!'); + $scene_id = $_POST['id'] . $times . $_POST['type']; + session('scene_id', $scene_id); + $ticket = $auth->qrcodeCreate($scene_id, 600);//10分钟 + if ($ticket == '') { + $return = array('status' => 0, 'data' => '获取ticket失败!'); } $qrcode = $auth->showqrcode($ticket['ticket']); - $return=array('status'=>1,'data'=>$qrcode); + $return = array('status' => 1, 'data' => $qrcode); $this->ajaxReturn($return); } - function checkpwd(){ + + function checkpwd() + { $User = new UserApi; $data = $User->verifyPwd($_POST['id'], $_POST['pwd']); - $this->ajaxReturn(array('data'=>$data)); + $this->ajaxReturn(array('data' => $data)); } - function checkOpenidpic(){ + + function checkOpenidpic() + { sleep(2); - $data=M('ucenter_member')->where(array('id'=>$_REQUEST['id']))->find(); - if($data['openid_sign']==session('scene_id')){ - $this->ajaxReturn(array("status"=>1)); - }else{ - $this->ajaxReturn(array("status"=>0)); + $data = M('ucenter_member')->where(array('id' => $_REQUEST['id']))->find(); + if ($data['openid_sign'] == session('scene_id')) { + $this->ajaxReturn(array("status" => 1)); + } else { + $this->ajaxReturn(array("status" => 0)); } } - public function delete($id){ + public function delete($id) + { M()->startTrans(); $res1 = M('member')->delete($id); $res2 = M('ucenter_member')->delete($id); - $res3 = M('auth_group_access')->where(array('uid'=>$id))->delete(); - if($res1 && $res2 && $res3){ + $res3 = M('auth_group_access')->where(array('uid' => $id))->delete(); + if ($res1 && $res2 && $res3) { M()->commit(); $this->success('删除成功'); - }else{ + } else { M()->rollback(); - $this->error('删除失败'.M()->getError()); + $this->error('删除失败' . M()->getError()); } } @@ -558,7 +620,7 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ { $map = []; if (isset($_REQUEST['game_name'])) { - $map['game_name'] = ['like', trim($_REQUEST['game_name'])."%"]; + $map['game_name'] = ['like', trim($_REQUEST['game_name']) . "%"]; unset($_REQUEST['game_name']); } if (isset($_REQUEST['server_id'])) { @@ -578,19 +640,19 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ $promoter_ids = D("Promote")->where($queryStr)->field('id')->select(); $promoter_ids ? $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; } - + } if (isset($_REQUEST['game_type'])) { $map['sdk_version'] = trim($_REQUEST['game_type']); unset($_REQUEST['game_type']); } - empty(I('user_account')) || $map['user_account'] = ['like',"%".I('user_account')."%"]; + empty(I('user_account')) || $map['user_account'] = ['like', "%" . I('user_account') . "%"]; $list = $this->lists(M('user_play_info', 'tab_'), $map, 'play_time desc'); $this->assign('list', $list); $this->meta_title = '角色数据'; - - $this->m_title = '角色查询'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/rolelist','status'=>1])->find()); + + $this->m_title = '角色查询'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/rolelist', 'status' => 1])->find()); $this->display(); @@ -600,47 +662,51 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ * 更新游戏角色数据 * @param $id */ - public function user_update($ids){ + public function user_update($ids) + { $res = D('User')->update_user_player($ids); $this->success("更新成功:{$res['suc']}个,失败:{$res['ero']}"); } + /** * 更新游戏角色数据 * @param $id */ - public function age(){ - if (IS_POST){ + public function age() + { + if (IS_POST) { $data = $_POST; $a = new ToolController(); $re = $a->save($data); - \Think\Log::actionLog('User/age','User',1); + \Think\Log::actionLog('User/age', 'User', 1); $this->success('保存成功'); - }else{ - $data = I('type',1) == 1? C('age'):C('age_prevent'); - $this->assign('data',$data); - $this->meta_title = I('type',1) == 1?"实名认证设置":'防沉迷设置'; - - $this->m_title = I('type',1)==1?'实名认证设置':'防沉迷设置'; - $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/age/type/'.I('type',1),'status'=>1])->find()); - + } else { + $data = I('type', 1) == 1 ? C('age') : C('age_prevent'); + $this->assign('data', $data); + $this->meta_title = I('type', 1) == 1 ? "实名认证设置" : '防沉迷设置'; + + $this->m_title = I('type', 1) == 1 ? '实名认证设置' : '防沉迷设置'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/age/type/' . I('type', 1), 'status' => 1])->find()); + $this->display(); } - + } - public function update_pwd(){ - if(IS_POST){ - if(strlen($_POST['new_pwd'])<6||strlen($_POST['new_pwd'])>30){ + public function update_pwd() + { + if (IS_POST) { + if (strlen($_POST['new_pwd']) < 6 || strlen($_POST['new_pwd']) > 30) { $this->error('密码格式不正确!'); } - $oldspwd=$this->think_ucenter_md5($_POST['password'],UC_AUTH_KEY); - $newpwd =$this->think_ucenter_md5($_POST['new_pwd'],UC_AUTH_KEY); - $Member=D('UcenterMember'); - $rpwd=$Member->where(array('id'=>session('user_auth.uid')))->find(); - if($oldspwd==$rpwd['password']){ - $Member->where(array('id'=>session('user_auth.uid')))->save(['password'=>$newpwd]); - $this->success('修改成功!',U('User/index')); - }else{ + $oldspwd = $this->think_ucenter_md5($_POST['password'], UC_AUTH_KEY); + $newpwd = $this->think_ucenter_md5($_POST['new_pwd'], UC_AUTH_KEY); + $Member = D('UcenterMember'); + $rpwd = $Member->where(array('id' => session('user_auth.uid')))->find(); + if ($oldspwd == $rpwd['password']) { + $Member->where(array('id' => session('user_auth.uid')))->save(['password' => $newpwd]); + $this->success('修改成功!', U('User/index')); + } else { $this->error('原密码错误!'); } @@ -648,14 +714,14 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ $this->display(); } - public function get_server_lists($game_id=0){ - $server = M("server","tab_"); + public function get_server_lists($game_id = 0) + { + $server = M("server", "tab_"); $map['game_id'] = $game_id; $lists = $server->field('id,server_name,game_name')->where($map)->select(); - if(empty($lists)){ - return $this->ajaxReturn(array('status'=>0,'data'=>'')); + if (empty($lists)) { + return $this->ajaxReturn(array('status' => 0, 'data' => '')); } - return $this->ajaxReturn(array('status'=>1,'data'=>$lists)); + return $this->ajaxReturn(array('status' => 1, 'data' => $lists)); } - } \ No newline at end of file diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt index ea73b15ce..bc484849f 100644 --- a/Application/Admin/Controller/access_data_foldline.txt +++ b/Application/Admin/Controller/access_data_foldline.txt @@ -1 +1 @@ -{"news":[{"time":"0:00","count":16},{"time":"1:00","count":11},{"time":"2:00","count":12},{"time":"3:00","count":8},{"time":"4:00","count":9},{"time":"5:00","count":5},{"time":"6:00","count":6},{"time":"7:00","count":15},{"time":"8:00","count":18},{"time":"9:00","count":28},{"time":"10:00","count":82},{"time":"11:00","count":77},{"time":"12:00","count":33},{"time":"13:00","count":36},{"time":"14:00","count":156},{"time":"15:00","count":136},{"time":"16:00","count":108},{"time":"17:00","count":71},{"time":"18:00","count":75},{"time":"19:00","count":99},{"time":"20:00","count":104},{"time":"21:00","count":82},{"time":"22:00","count":84},{"time":"23:00","count":45}],"sum":{"news":1316,"active":6633,"player":1359,"money":132537.03},"active":[{"time":"0:00","count":833},{"time":"1:00","count":294},{"time":"2:00","count":144},{"time":"3:00","count":101},{"time":"4:00","count":84},{"time":"5:00","count":150},{"time":"6:00","count":410},{"time":"7:00","count":590},{"time":"8:00","count":452},{"time":"9:00","count":438},{"time":"10:00","count":399},{"time":"11:00","count":299},{"time":"12:00","count":250},{"time":"13:00","count":174},{"time":"14:00","count":309},{"time":"15:00","count":269},{"time":"16:00","count":204},{"time":"17:00","count":174},{"time":"18:00","count":175},{"time":"19:00","count":222},{"time":"20:00","count":206},{"time":"21:00","count":161},{"time":"22:00","count":181},{"time":"23:00","count":114}],"player":[{"time":"0:00","count":174},{"time":"1:00","count":54},{"time":"2:00","count":34},{"time":"3:00","count":19},{"time":"4:00","count":17},{"time":"5:00","count":18},{"time":"6:00","count":31},{"time":"7:00","count":54},{"time":"8:00","count":54},{"time":"9:00","count":48},{"time":"10:00","count":53},{"time":"11:00","count":63},{"time":"12:00","count":45},{"time":"13:00","count":52},{"time":"14:00","count":40},{"time":"15:00","count":107},{"time":"16:00","count":90},{"time":"17:00","count":56},{"time":"18:00","count":47},{"time":"19:00","count":66},{"time":"20:00","count":62},{"time":"21:00","count":66},{"time":"22:00","count":66},{"time":"23:00","count":43}],"money":[{"time":"0:00","count":"21663.00"},{"time":"1:00","count":"3664.00"},{"time":"2:00","count":"2245.00"},{"time":"3:00","count":"734.00"},{"time":"4:00","count":"1526.00"},{"time":"5:00","count":"1506.00"},{"time":"6:00","count":"3141.00"},{"time":"7:00","count":"3900.00"},{"time":"8:00","count":"5225.00"},{"time":"9:00","count":"5350.02"},{"time":"10:00","count":"3657.00"},{"time":"11:00","count":"5008.00"},{"time":"12:00","count":"2899.00"},{"time":"13:00","count":"7167.00"},{"time":"14:00","count":"13457.00"},{"time":"15:00","count":"6680.00"},{"time":"16:00","count":"4772.00"},{"time":"17:00","count":"4365.01"},{"time":"18:00","count":"3683.00"},{"time":"19:00","count":"3187.00"},{"time":"20:00","count":"5599.00"},{"time":"21:00","count":"10597.00"},{"time":"22:00","count":"7201.00"},{"time":"23:00","count":"5311.00"}]} \ No newline at end of file +{"news":[{"time":"0:00","count":1},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":1},{"time":"11:00","count":1},{"time":"12:00","count":1},{"time":"13:00","count":1},{"time":"14:00","count":12},{"time":"15:00","count":1},{"time":"16:00","count":3},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":2},{"time":"20:00","count":6},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":29,"active":49,"player":7,"money":13.17},"active":[{"time":"0:00","count":2},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":1},{"time":"9:00","count":4},{"time":"10:00","count":7},{"time":"11:00","count":1},{"time":"12:00","count":4},{"time":"13:00","count":2},{"time":"14:00","count":12},{"time":"15:00","count":3},{"time":"16:00","count":5},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":2},{"time":"20:00","count":6},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":1},{"time":"14:00","count":2},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":1},{"time":"20:00","count":2},{"time":"21:00","count":1},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":"6.01"},{"time":"14:00","count":"3.08"},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":"4.02"},{"time":"20:00","count":"0.05"},{"time":"21:00","count":"0.01"},{"time":"22:00","count":0},{"time":"23:00","count":0}]} \ No newline at end of file diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 2529f6bd4..2eef90db1 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2098,4 +2098,31 @@ class QueryController extends BaseController $this->ajaxReturn($data); } + + public function userPlayDataCount() + { + $time = strtotime(date('Y-m-d 00:00:00',time() - (3600 * 24))); + $spendMap['pay_status'] = 1; + $spendMap['pay_game_status'] = 1; + $spendMap['game_player_id'] = ['gt', 0]; + $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]]; + + $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count'; + $spendCostData = M('spend', 'tab_')->field($field) + ->where($spendMap) + ->group('day,game_player_id,server_id,game_id') + ->select(); + + $data = []; + foreach ($spendCostData as $list) { + $save['game_id'] = $list['game_id']; + $save['server_id'] = $list['server_id']; + $save['role_id'] = $list['game_player_id']; + $save['recharge_cost'] = $list['recharge_cost']; + $save['recharge_count'] = $list['recharge_count']; + $save['create_time'] = strtotime($list['day']); + $data[] = $save; + } + M('user_play_data_count', 'tab_')->addAll($data); + } }