推广平台->数据汇总->充值玩家--更新

master
chenxiaojun 5 years ago
parent 49270427ee
commit a53970efcf

@ -1054,6 +1054,4 @@ class AutoPackController extends Think
return ''; return '';
} }
} }
} }

@ -8,6 +8,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace Admin\Controller; namespace Admin\Controller;
use User\Api\UserApi; use User\Api\UserApi;
use Com\Wechat; use Com\Wechat;
use Com\WechatAuth; use Com\WechatAuth;
@ -16,31 +17,33 @@ use Com\WechatAuth;
* 后台用户控制器 * 后台用户控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
class UserController extends AdminController { class UserController extends AdminController
{
/** /**
* 用户管理首页 * 用户管理首页
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
public function index(){ public function index()
$nickname = I('nickname'); {
if(isset($_REQUEST['status'])){ $nickname = I('nickname');
$map['status'] = $_REQUEST['status']; if (isset($_REQUEST['status'])) {
$map['status'] = $_REQUEST['status'];
} }
if(is_numeric($nickname)){ if (is_numeric($nickname)) {
$map['uid|nickname']= array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true); $map['uid|nickname'] = array(intval($nickname), array('like', '%' . $nickname . '%'), '_multi' => true);
}else{ } else {
$map['nickname'] = array('like', '%'.(string)$nickname.'%'); $map['nickname'] = array('like', '%' . (string)$nickname . '%');
} }
$list = $this->lists('Member', $map); $list = $this->lists('Member', $map);
int_to_string($list); int_to_string($list);
$this->assign('_list', $list); $this->assign('_list', $list);
$this->meta_title = '管理员列表'; $this->meta_title = '管理员列表';
$this->m_title = '管理员列表'; $this->m_title = '管理员列表';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find());
$this->display(); $this->display();
} }
@ -49,7 +52,8 @@ class UserController extends AdminController {
* 修改昵称初始化 * 修改昵称初始化
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function updateNickname(){ public function updateNickname()
{
$nickname = M('Member')->getFieldByUid(UID, 'nickname'); $nickname = M('Member')->getFieldByUid(UID, 'nickname');
$this->assign('nickname', $nickname); $this->assign('nickname', $nickname);
$this->meta_title = '修改昵称'; $this->meta_title = '修改昵称';
@ -60,7 +64,8 @@ class UserController extends AdminController {
* 修改昵称提交 * 修改昵称提交
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function submitNickname(){ public function submitNickname()
{
//获取参数 //获取参数
$nickname = I('post.nickname'); $nickname = I('post.nickname');
$password = I('post.password'); $password = I('post.password');
@ -68,25 +73,25 @@ class UserController extends AdminController {
empty($password) && $this->error('请输入密码'); empty($password) && $this->error('请输入密码');
//密码验证 //密码验证
$User = new UserApi(); $User = new UserApi();
$uid = $User->login(UID, $password, 4); $uid = $User->login(UID, $password, 4);
($uid == -2) && $this->error('密码不正确'); ($uid == -2) && $this->error('密码不正确');
$Member = D('Member'); $Member = D('Member');
$data = $Member->create(array('nickname'=>$nickname)); $data = $Member->create(array('nickname' => $nickname));
if(!$data){ if (!$data) {
$this->error($Member->getError()); $this->error($Member->getError());
} }
$res = $Member->where(array('uid'=>$uid))->save($data); $res = $Member->where(array('uid' => $uid))->save($data);
if($res){ if ($res) {
$user = session('user_auth'); $user = session('user_auth');
$user['username'] = $data['nickname']; $user['username'] = $data['nickname'];
session('user_auth', $user); session('user_auth', $user);
session('user_auth_sign', data_auth_sign($user)); session('user_auth_sign', data_auth_sign($user));
$this->success('修改昵称成功!'); $this->success('修改昵称成功!');
}else{ } else {
$this->error('修改昵称失败!'); $this->error('修改昵称失败!');
} }
} }
@ -95,7 +100,8 @@ class UserController extends AdminController {
* 修改密码初始化 * 修改密码初始化
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function updatePassword(){ public function updatePassword()
{
$this->meta_title = '修改密码'; $this->meta_title = '修改密码';
$this->display('updatepassword'); $this->display('updatepassword');
} }
@ -104,24 +110,25 @@ class UserController extends AdminController {
* 修改密码提交 * 修改密码提交
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function submitPassword(){ public function submitPassword()
{
//获取参数 //获取参数
$password = I('post.old'); $password = I('post.old');
empty($password) && $this->error('请输入原密码'); empty($password) && $this->error('请输入原密码');
$data['password'] = I('post.password'); $data['password'] = I('post.password');
empty($data['password']) && $this->error('请输入新密码'); empty($data['password']) && $this->error('请输入新密码');
$repassword = I('post.repassword'); $repassword = I('post.repassword');
empty($repassword) && $this->error('请输入确认密码'); empty($repassword) && $this->error('请输入确认密码');
if($data['password'] !== $repassword){ if ($data['password'] !== $repassword) {
$this->error('您输入的新密码与确认密码不一致'); $this->error('您输入的新密码与确认密码不一致');
} }
$Api = new UserApi(); $Api = new UserApi();
$res = $Api->updateInfo(UID, $password, $data); $res = $Api->updateInfo(UID, $password, $data);
if($res['status']){ if ($res['status']) {
$this->success('修改密码成功!'); $this->success('修改密码成功!');
}else{ } else {
$this->error($res['info']); $this->error($res['info']);
} }
} }
@ -130,13 +137,14 @@ class UserController extends AdminController {
* 用户行为列表 * 用户行为列表
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function action(){ public function action()
{
//获取列表数据 //获取列表数据
$Action = M('Action')->where(array('status'=>array('gt',-1))); $Action = M('Action')->where(array('status' => array('gt', -1)));
$list = $this->lists($Action); $list = $this->lists($Action);
int_to_string($list); int_to_string($list);
// 记录当前列表页的cookie // 记录当前列表页的cookie
Cookie('__forward__',$_SERVER['REQUEST_URI']); Cookie('__forward__', $_SERVER['REQUEST_URI']);
$this->assign('_list', $list); $this->assign('_list', $list);
$this->meta_title = '用户行为'; $this->meta_title = '用户行为';
@ -147,9 +155,10 @@ class UserController extends AdminController {
* 新增行为 * 新增行为
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function addAction(){ public function addAction()
{
$this->meta_title = '新增行为'; $this->meta_title = '新增行为';
$this->assign('data',null); $this->assign('data', null);
$this->display('editaction'); $this->display('editaction');
} }
@ -157,12 +166,13 @@ class UserController extends AdminController {
* 编辑行为 * 编辑行为
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function editAction(){ public function editAction()
{
$id = I('get.id'); $id = I('get.id');
empty($id) && $this->error('参数不能为空!'); empty($id) && $this->error('参数不能为空!');
$data = M('Action')->field(true)->find($id); $data = M('Action')->field(true)->find($id);
$this->assign('data',$data); $this->assign('data', $data);
$this->meta_title = '编辑行为'; $this->meta_title = '编辑行为';
$this->display('editaction'); $this->display('editaction');
} }
@ -171,12 +181,13 @@ class UserController extends AdminController {
* 更新行为 * 更新行为
* @author huajie <banhuajie@163.com> * @author huajie <banhuajie@163.com>
*/ */
public function saveAction(){ public function saveAction()
{
$res = D('Action')->update(); $res = D('Action')->update();
if(!$res){ if (!$res) {
$this->error(D('Action')->getError()); $this->error(D('Action')->getError());
}else{ } else {
$this->success($res['id']?'更新成功!':'新增成功!', Cookie('__forward__')); $this->success($res['id'] ? '更新成功!' : '新增成功!', Cookie('__forward__'));
} }
} }
@ -184,23 +195,24 @@ class UserController extends AdminController {
* 会员状态修改 * 会员状态修改
* @author 朱亚杰 <zhuyajie@topthink.net> * @author 朱亚杰 <zhuyajie@topthink.net>
*/ */
public function changeUserStatus($method=null){ public function changeUserStatus($method = null)
$id = array_unique((array)I('id',0)); {
if( in_array(C('USER_ADMINISTRATOR'), $id)){ $id = array_unique((array)I('id', 0));
if (in_array(C('USER_ADMINISTRATOR'), $id)) {
$this->error("不允许对超级管理员执行该操作!"); $this->error("不允许对超级管理员执行该操作!");
} }
$id = is_array($id) ? implode(',',$id) : $id; $id = is_array($id) ? implode(',', $id) : $id;
if ( empty($id) ) { if (empty($id)) {
$this->error('请选择要操作的数据!'); $this->error('请选择要操作的数据!');
} }
$map['uid'] = array('in',$id); $map['uid'] = array('in', $id);
$map1['id'] = array('in',$id); $map1['id'] = array('in', $id);
$status=I('method')=='forbidUser'?0:1; $status = I('method') == 'forbidUser' ? 0 : 1;
$res= M('UcenterMember')->where($map1)->setField('status',$status); $res = M('UcenterMember')->where($map1)->setField('status', $status);
$res1= M('Member')->where($map)->setField('status',$status); $res1 = M('Member')->where($map)->setField('status', $status);
if($res&&$res1){ if ($res && $res1) {
$this->success('更新成功!'); $this->success('更新成功!');
}else{ } else {
$this->error('更新失败!'); $this->error('更新失败!');
} }
@ -211,43 +223,45 @@ class UserController extends AdminController {
* 会员状态修改 * 会员状态修改
* @author 朱亚杰 <zhuyajie@topthink.net> * @author 朱亚杰 <zhuyajie@topthink.net>
*/ */
public function changeStatus($method=null){ public function changeStatus($method = null)
$id = array_unique((array)I('id',0)); {
if( in_array(C('USER_ADMINISTRATOR'), $id)){ $id = array_unique((array)I('id', 0));
if (in_array(C('USER_ADMINISTRATOR'), $id)) {
$this->error("不允许对超级管理员执行该操作!"); $this->error("不允许对超级管理员执行该操作!");
} }
$id = is_array($id) ? implode(',',$id) : $id; $id = is_array($id) ? implode(',', $id) : $id;
if ( empty($id) ) { if (empty($id)) {
$this->error('请选择要操作的数据!'); $this->error('请选择要操作的数据!');
} }
$map['uid'] = array('in',$id); $map['uid'] = array('in', $id);
switch ( strtolower($method) ){ switch (strtolower($method)) {
case 'forbiduser': case 'forbiduser':
\Think\Log::actionLog('User/changeStatus?method=forbidUser','user',1); \Think\Log::actionLog('User/changeStatus?method=forbidUser', 'user', 1);
$this->forbid('Member', $map ); $this->forbid('Member', $map);
break; break;
case 'resumeuser': case 'resumeuser':
\Think\Log::actionLog('User/changeStatus?method=resumeuser','user',1); \Think\Log::actionLog('User/changeStatus?method=resumeuser', 'user', 1);
$this->resume('Member', $map ); $this->resume('Member', $map);
break; break;
case 'deleteuser': case 'deleteuser':
\Think\Log::actionLog('User/changeStatus?method=deleteuser','user',1); \Think\Log::actionLog('User/changeStatus?method=deleteuser', 'user', 1);
$this->delete('Member', $map ); $this->delete('Member', $map);
break; break;
default: default:
$this->error('参数非法'); $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('管理员账号不能为空!'); $this->error('管理员账号不能为空!');
} }
/* 检测密码 */ /* 检测密码 */
if($password != $repassword){ if ($password != $repassword) {
$this->error('管理员密码和确认密码不一致!'); $this->error('管理员密码和确认密码不一致!');
} }
$usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find(); $usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find();
@ -259,84 +273,87 @@ class UserController extends AdminController {
$this->error('邮箱已存在!'); $this->error('邮箱已存在!');
} }
/* 调用注册接口注册用户 */ /* 调用注册接口注册用户 */
$User = new UserApi; $User = new UserApi;
$uid = $User->register($username, $password, $email,$second_pwd); $uid = $User->register($username, $password, $email, $second_pwd);
if(0 < $uid){ //注册成功 if (0 < $uid) { //注册成功
$user = array('uid' => $uid, 'nickname' => $username, 'status' => 1); $user = array('uid' => $uid, 'nickname' => $username, 'status' => 1);
$data['uid'] = $uid; $data['uid'] = $uid;
$data['group_id'] = I('auth'); $data['group_id'] = I('auth');
M('auth_group_access')->data($data)->add(); M('auth_group_access')->data($data)->add();
if(!M('Member')->add($user)){ if (!M('Member')->add($user)) {
$this->error('用户添加失败!'); $this->error('用户添加失败!');
} else { } else {
\Think\Log::actionLog('User/add','Member',$uid); \Think\Log::actionLog('User/add', 'Member', $uid);
$this->success('用户添加成功!',U('index')); $this->success('用户添加成功!', U('index'));
} }
} else { //注册失败,显示错误信息 } else { //注册失败,显示错误信息
$this->error($this->showRegError($uid)); $this->error($this->showRegError($uid));
} }
} else { } else {
$list=D('AuthGroup')->where(array('status'=>1))->select(); $list = D('AuthGroup')->where(array('status' => 1))->select();
$this->assign('lists',$list); $this->assign('lists', $list);
$this->meta_title = '新增管理员'; $this->meta_title = '新增管理员';
$this->m_title = '管理员列表'; $this->m_title = '管理员列表';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find());
$this->display(); $this->display();
} }
} }
/**
* 系统非常规MD5加密方法 /**
* @param string $str 要加密的字符串 * 系统非常规MD5加密方法
* @return string * @param string $str 要加密的字符串
*/ * @return string
function think_ucenter_md5($str, $key = 'ThinkUCenter'){ */
return '' === $str ? '' : md5(sha1($str) . $key); function think_ucenter_md5($str, $key = 'ThinkUCenter')
} {
public function edit($id){ return '' === $str ? '' : md5(sha1($str) . $key);
}
public function edit($id)
{
// var_dump(session());exit; // var_dump(session());exit;
if(IS_POST){ if (IS_POST) {
if(isset($_POST['bind_wx'])){ if (isset($_POST['bind_wx'])) {
if($_POST['bind_wx']=='unbind_wx'){ if ($_POST['bind_wx'] == 'unbind_wx') {
$info['admin_openid']=''; $info['admin_openid'] = '';
}else{ } else {
$info['admin_openid']=session('admin_openid'); $info['admin_openid'] = session('admin_openid');
if($info['admin_openid']==''){ if ($info['admin_openid'] == '') {
$this->error('请在30分钟内扫描并关注微信公众号'); $this->error('请在30分钟内扫描并关注微信公众号');
} }
} }
} }
if($_POST['auth']==''&&$id!=1){ if ($_POST['auth'] == '' && $id != 1) {
$this->error('请选择用户权限!'); $this->error('请选择用户权限!');
} }
if($_POST['password']==''){ if ($_POST['password'] == '') {
//$this->error('请填写管理员密码!'); //$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个字符之间'); $this->error('管理员密码长度必须在6-30个字符之间');
} }
if($_POST['second_pwd']==''){ if ($_POST['second_pwd'] == '') {
//$this->error('请填写二级密码!'); //$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个字符之间'); $this->error('二级密码长度必须在6-30个字符之间');
} }
if($_POST['email']==''){ if ($_POST['email'] == '') {
$this->error('请填写邮箱!'); $this->error('请填写邮箱!');
} }
$pattern = "/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i"; $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'])) { if (!preg_match($pattern, $_POST['email'])) {
$this->error('邮箱格式不正确!'); $this->error('邮箱格式不正确!');
} }
if(isset($_POST['mobile'])&&$_POST['mobile']!=''){ if (isset($_POST['mobile']) && $_POST['mobile'] != '') {
$dx = A('Phone'); $dx = A('Phone');
$res = $dx->check_tel_code($_POST['mobile'],$_POST['code']); $res = $dx->check_tel_code($_POST['mobile'], $_POST['code']);
switch ($res) { switch ($res) {
case '-1': case '-1':
$this->error('短信验证码无效,请重新获取'); $this->error('短信验证码无效,请重新获取');
@ -349,27 +366,27 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
break; break;
} }
} }
$Member=D('UcenterMember'); $Member = D('UcenterMember');
$mem=D('Member'); $mem = D('Member');
$au=D('AuthGroupAccess'); $au = D('AuthGroupAccess');
$map['id']=$id; $map['id'] = $id;
$maps['uid']=$id; $maps['uid'] = $id;
$info['username']=$_POST['username']; $info['username'] = $_POST['username'];
$in['nickname']=$_POST['username']; $in['nickname'] = $_POST['username'];
$pwd=$this->think_ucenter_md5($_POST['password'],UC_AUTH_KEY); $pwd = $this->think_ucenter_md5($_POST['password'], UC_AUTH_KEY);
$spwd=$this->think_ucenter_md5($_POST['second_pwd'],UC_AUTH_KEY); $spwd = $this->think_ucenter_md5($_POST['second_pwd'], UC_AUTH_KEY);
$rpwd=$Member->where(array('id'=>$id))->find(); $rpwd = $Member->where(array('id' => $id))->find();
$oldpwd=$rpwd['password']; $oldpwd = $rpwd['password'];
$oldspwd=$rpwd['second_pwd']; $oldspwd = $rpwd['second_pwd'];
$User = new UserApi; $User = new UserApi;
$info['password']= (empty($pwd) || $pwd==$oldpwd)?$oldpwd:$pwd; $info['password'] = (empty($pwd) || $pwd == $oldpwd) ? $oldpwd : $pwd;
$info['second_pwd']= (empty($spwd) || $spwd==$oldspwd)?$oldspwd:$spwd; $info['second_pwd'] = (empty($spwd) || $spwd == $oldspwd) ? $oldspwd : $spwd;
$info['email']=$_POST['email']; $info['email'] = $_POST['email'];
$info['mobile']=isset($_POST['mobile'])?$_POST['mobile']:''; $info['mobile'] = isset($_POST['mobile']) ? $_POST['mobile'] : '';
$ss['group_id']=$_POST['auth']; $ss['group_id'] = $_POST['auth'];
$ss['houtai']=$_POST['houtai']; $ss['houtai'] = $_POST['houtai'];
$smember=$Member->where($map)->save($info); $smember = $Member->where($map)->save($info);
$meb=$mem->where($maps)->save($in); $meb = $mem->where($maps)->save($in);
if ($au->where(array('uid' => $id))->find()) { if ($au->where(array('uid' => $id))->find()) {
if ($ss['group_id'] == '') { if ($ss['group_id'] == '') {
unset($ss['group_id']); unset($ss['group_id']);
@ -380,177 +397,222 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
$ag = $au->add($ss); $ag = $au->add($ss);
} }
if($smember !== false||$meb||$ag){ if ($smember !== false || $meb || $ag) {
M('user_pwd')->where($maps)->setField('password',think_encrypt($info['password'])); M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password']));
$this->success('修改成功!',U('User/index')); $this->success('修改成功!', U('User/index'));
}else{ } else {
$this->error('修改失败!',U('User/index')); $this->error('修改失败!', U('User/index'));
} }
}else{ } else {
$map['id']=$_GET['id']; $map['id'] = $_GET['id'];
$Member=D('UcenterMember')->where($map)->find(); $Member = D('UcenterMember')->where($map)->find();
$au=D('AuthGroupAccess')->where(array('uid'=>$_GET['id']))->find(); $au = D('AuthGroupAccess')->where(array('uid' => $_GET['id']))->find();
$this->assign("authid",$au["group_id"]); $this->assign("authid", $au["group_id"]);
$this->assign("houtai",$au["houtai"]); $this->assign("houtai", $au["houtai"]);
$list=D('AuthGroup')->where(array('status'=>1))->select(); $list = D('AuthGroup')->where(array('status' => 1))->select();
$username=$_POST['username']; $username = $_POST['username'];
$password=$_POST['password']; $password = $_POST['password'];
$this->assign('lists',$list); $this->assign('lists', $list);
$this->assign('list',$Member); $this->assign('list', $Member);
$this->assign('sd',$group); $this->assign('sd', $group);
$this->meta_title = '编辑管理员'; $this->meta_title = '编辑管理员';
$this->m_title = '管理员列表'; $this->m_title = '管理员列表';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/index','status'=>1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/index', 'status' => 1])->find());
$this->display(); $this->display();
} }
} }
public function bdwx(){
$map['id']=UID; public function bdwx()
$Member=D('UcenterMember')->field('id,username,admin_openid,openid_sign')->where($map)->find(); {
$this->assign('id',$map['id']); $map['id'] = UID;
$this->assign('list',$Member); $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->meta_title = '绑定微信';
$this->display(); $this->display();
} }
public function updatelist($p=0){
public function updatelist($p = 0)
{
$page = intval($p); $page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据 $page = $page ? $page : 1; //默认显示第一页数据
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} if (isset($_REQUEST['row'])) {
if(isset($_REQUEST['op_account'])){ $row = $_REQUEST['row'];
if ($_REQUEST['op_account']=='全部') { } else {
$row = 10;
}
if (isset($_REQUEST['op_account'])) {
if ($_REQUEST['op_account'] == '全部') {
unset($_REQUEST['op_account']); unset($_REQUEST['op_account']);
}else{ } else {
$map['op_account'] = trim($_REQUEST['op_account']); $map['op_account'] = trim($_REQUEST['op_account']);
unset($_REQUEST['op_account']); unset($_REQUEST['op_account']);
} }
} }
if(isset($_REQUEST['game_name'])){ if (isset($_REQUEST['game_name'])) {
$map['game_name'] = trim($_REQUEST['game_name']); $map['game_name'] = trim($_REQUEST['game_name']);
unset($_REQUEST['game_name']); unset($_REQUEST['game_name']);
} }
if(isset($_REQUEST['account'])){ if (isset($_REQUEST['account'])) {
$map['user_account'] = array('like','%'.trim($_REQUEST['account']).'%'); $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%');
unset($_REQUEST['account']); unset($_REQUEST['account']);
} }
if(isset($_REQUEST['huobi'])){ if (isset($_REQUEST['huobi'])) {
$map['type'] = $_REQUEST['huobi']; $map['type'] = $_REQUEST['huobi'];
unset($_REQUEST['huobi']); unset($_REQUEST['huobi']);
} }
if(isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])){ if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
$map['create_time'] = array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1)); $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'))];
unset($_REQUEST['timestart']); unset($_REQUEST['timestart']);
}elseif(isset($_REQUEST['timeend'])){ unset($_REQUEST['timeend']);
$map['create_time'] = ['LT',strtotime(I('timeend'))+86399]; } 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']); unset($_REQUEST['timeend']);
} }
$list=M('balance_edit','tab_') $list = M('balance_edit', 'tab_')
->where($map) ->where($map)
->order('create_time desc') ->order('create_time desc')
->page($page, $row) ->page($page, $row)
->select(); ->select();
$count = M('balance_edit','tab_')->where($map)->count(); $count = M('balance_edit', 'tab_')->where($map)->count();
//分页 //分页
$page = set_pagination($count,$row); $page = set_pagination($count, $row);
if($page) {$this->assign('_page', $page);} if ($page) {
$this->assign('_page', $page);
}
$this->assign('list',$list); $this->assign('list', $list);
$this->meta_title = '修改记录'; $this->meta_title = '修改记录';
$this->m_title = '账户修改记录'; $this->m_title = '账户修改记录';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Member/login_record','status'=>1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Member/login_record', 'status' => 1])->find());
$this->display('updatelist'); $this->display('updatelist');
} }
/** /**
* 获取用户注册错误信息 * 获取用户注册错误信息
* @param integer $code 错误编码 * @param integer $code 错误编码
* @return string 错误信息 * @return string 错误信息
*/ */
private function showRegError($code = 0){ private function showRegError($code = 0)
{
switch ($code) { switch ($code) {
case -1: $error = '管理员账号长度必须在16个字符以内'; break; case -1:
case -2: $error = '管理员账号被禁止注册!'; break; $error = '管理员账号长度必须在16个字符以内';
case -3: $error = '管理员账号被占用!'; break; break;
case -4: $error = '管理员密码长度必须在6-30个字符之间'; break; case -2:
case -5: $error = '邮箱格式不正确!'; break; $error = '管理员账号被禁止注册!';
case -6: $error = '邮箱长度必须在1-32个字符之间'; break; break;
case -7: $error = '邮箱被禁止注册!'; break; case -3:
case -8: $error = '邮箱被占用!'; break; $error = '管理员账号被占用!';
case -9: $error = '手机格式不正确!'; break; break;
case -10: $error = '手机被禁止注册!'; break; case -4:
case -11: $error = '手机号被占用!'; break; $error = '管理员密码长度必须在6-30个字符之间';
case -12: $error = '二级密码长度必须在6-30个字符之间';break; break;
default: $error = '未知错误'; 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; return $error;
} }
public function get_openid(){
public function get_openid()
{
$User = new UserApi; $User = new UserApi;
if($_POST['id']>999){ if ($_POST['id'] > 999) {
$this->ajaxReturn(array('status'=>0,'msg'=>'管理员id不能大于999')); $this->ajaxReturn(array('status' => 0, 'msg' => '管理员id不能大于999'));
} }
$data = $User->verifyPwd($_POST['id'], $_POST['pwd']); $data = $User->verifyPwd($_POST['id'], $_POST['pwd']);
if(!$data){ if (!$data) {
$this->ajaxReturn(array('status'=>0,'msg'=>'密码错误,请重新选择')); $this->ajaxReturn(array('status' => 0, 'msg' => '密码错误,请重新选择'));
} }
$appid = C('wechat.appid'); $appid = C('wechat.appid');
$appsecret = C('wechat.appsecret'); $appsecret = C('wechat.appsecret');
$result=auto_get_access_token(dirname(__FILE__).'/access_token_validity.txt'); $result = auto_get_access_token(dirname(__FILE__) . '/access_token_validity.txt');
if($result['is_validity']){ if ($result['is_validity']) {
session('token',$result['access_token']); session('token', $result['access_token']);
$auth = new WechatAuth($appid, $appsecret,$result['access_token']); $auth = new WechatAuth($appid, $appsecret, $result['access_token']);
}else{ } else {
$auth = new WechatAuth($appid, $appsecret); $auth = new WechatAuth($appid, $appsecret);
$token = $auth->getAccessToken(); $token = $auth->getAccessToken();
$token['expires_in_validity']=time()+$token['expires_in']; $token['expires_in_validity'] = time() + $token['expires_in'];
wite_text(json_encode($token),dirname(__FILE__).'/access_token_validity.txt'); wite_text(json_encode($token), dirname(__FILE__) . '/access_token_validity.txt');
session('token',$token['access_token']); session('token', $token['access_token']);
} }
$times=date('s',time()); $times = date('s', time());
// $scene_id=strrev($_POST['id'].$times); // $scene_id=strrev($_POST['id'].$times);
$scene_id=$_POST['id'].$times.$_POST['type']; $scene_id = $_POST['id'] . $times . $_POST['type'];
session('scene_id',$scene_id); session('scene_id', $scene_id);
$ticket = $auth->qrcodeCreate($scene_id,600);//10分钟 $ticket = $auth->qrcodeCreate($scene_id, 600);//10分钟
if($ticket==''){ if ($ticket == '') {
$return=array('status'=>0,'data'=>'获取ticket失败'); $return = array('status' => 0, 'data' => '获取ticket失败');
} }
$qrcode = $auth->showqrcode($ticket['ticket']); $qrcode = $auth->showqrcode($ticket['ticket']);
$return=array('status'=>1,'data'=>$qrcode); $return = array('status' => 1, 'data' => $qrcode);
$this->ajaxReturn($return); $this->ajaxReturn($return);
} }
function checkpwd(){
function checkpwd()
{
$User = new UserApi; $User = new UserApi;
$data = $User->verifyPwd($_POST['id'], $_POST['pwd']); $data = $User->verifyPwd($_POST['id'], $_POST['pwd']);
$this->ajaxReturn(array('data'=>$data)); $this->ajaxReturn(array('data' => $data));
} }
function checkOpenidpic(){
function checkOpenidpic()
{
sleep(2); sleep(2);
$data=M('ucenter_member')->where(array('id'=>$_REQUEST['id']))->find(); $data = M('ucenter_member')->where(array('id' => $_REQUEST['id']))->find();
if($data['openid_sign']==session('scene_id')){ if ($data['openid_sign'] == session('scene_id')) {
$this->ajaxReturn(array("status"=>1)); $this->ajaxReturn(array("status" => 1));
}else{ } else {
$this->ajaxReturn(array("status"=>0)); $this->ajaxReturn(array("status" => 0));
} }
} }
public function delete($id){ public function delete($id)
{
M()->startTrans(); M()->startTrans();
$res1 = M('member')->delete($id); $res1 = M('member')->delete($id);
$res2 = M('ucenter_member')->delete($id); $res2 = M('ucenter_member')->delete($id);
$res3 = M('auth_group_access')->where(array('uid'=>$id))->delete(); $res3 = M('auth_group_access')->where(array('uid' => $id))->delete();
if($res1 && $res2 && $res3){ if ($res1 && $res2 && $res3) {
M()->commit(); M()->commit();
$this->success('删除成功'); $this->success('删除成功');
}else{ } else {
M()->rollback(); M()->rollback();
$this->error('删除失败'.M()->getError()); $this->error('删除失败' . M()->getError());
} }
} }
@ -558,7 +620,7 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
{ {
$map = []; $map = [];
if (isset($_REQUEST['game_name'])) { 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']); unset($_REQUEST['game_name']);
} }
if (isset($_REQUEST['server_id'])) { if (isset($_REQUEST['server_id'])) {
@ -584,13 +646,13 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
$map['sdk_version'] = trim($_REQUEST['game_type']); $map['sdk_version'] = trim($_REQUEST['game_type']);
unset($_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'); $list = $this->lists(M('user_play_info', 'tab_'), $map, 'play_time desc');
$this->assign('list', $list); $this->assign('list', $list);
$this->meta_title = '角色数据'; $this->meta_title = '角色数据';
$this->m_title = '角色查询'; $this->m_title = '角色查询';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/rolelist','status'=>1])->find()); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/rolelist', 'status' => 1])->find());
$this->display(); $this->display();
@ -600,47 +662,51 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
* 更新游戏角色数据 * 更新游戏角色数据
* @param $id * @param $id
*/ */
public function user_update($ids){ public function user_update($ids)
{
$res = D('User')->update_user_player($ids); $res = D('User')->update_user_player($ids);
$this->success("更新成功:{$res['suc']}个,失败:{$res['ero']}"); $this->success("更新成功:{$res['suc']}个,失败:{$res['ero']}");
} }
/** /**
* 更新游戏角色数据 * 更新游戏角色数据
* @param $id * @param $id
*/ */
public function age(){ public function age()
if (IS_POST){ {
if (IS_POST) {
$data = $_POST; $data = $_POST;
$a = new ToolController(); $a = new ToolController();
$re = $a->save($data); $re = $a->save($data);
\Think\Log::actionLog('User/age','User',1); \Think\Log::actionLog('User/age', 'User', 1);
$this->success('保存成功'); $this->success('保存成功');
}else{ } else {
$data = I('type',1) == 1? C('age'):C('age_prevent'); $data = I('type', 1) == 1 ? C('age') : C('age_prevent');
$this->assign('data',$data); $this->assign('data', $data);
$this->meta_title = I('type',1) == 1?"实名认证设置":'防沉迷设置'; $this->meta_title = I('type', 1) == 1 ? "实名认证设置" : '防沉迷设置';
$this->m_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->assign('commonset', M('Kuaijieicon')->where(['url' => 'User/age/type/' . I('type', 1), 'status' => 1])->find());
$this->display(); $this->display();
} }
} }
public function update_pwd(){ public function update_pwd()
if(IS_POST){ {
if(strlen($_POST['new_pwd'])<6||strlen($_POST['new_pwd'])>30){ if (IS_POST) {
if (strlen($_POST['new_pwd']) < 6 || strlen($_POST['new_pwd']) > 30) {
$this->error('密码格式不正确!'); $this->error('密码格式不正确!');
} }
$oldspwd=$this->think_ucenter_md5($_POST['password'],UC_AUTH_KEY); $oldspwd = $this->think_ucenter_md5($_POST['password'], UC_AUTH_KEY);
$newpwd =$this->think_ucenter_md5($_POST['new_pwd'],UC_AUTH_KEY); $newpwd = $this->think_ucenter_md5($_POST['new_pwd'], UC_AUTH_KEY);
$Member=D('UcenterMember'); $Member = D('UcenterMember');
$rpwd=$Member->where(array('id'=>session('user_auth.uid')))->find(); $rpwd = $Member->where(array('id' => session('user_auth.uid')))->find();
if($oldspwd==$rpwd['password']){ if ($oldspwd == $rpwd['password']) {
$Member->where(array('id'=>session('user_auth.uid')))->save(['password'=>$newpwd]); $Member->where(array('id' => session('user_auth.uid')))->save(['password' => $newpwd]);
$this->success('修改成功!',U('User/index')); $this->success('修改成功!', U('User/index'));
}else{ } else {
$this->error('原密码错误!'); $this->error('原密码错误!');
} }
@ -648,14 +714,14 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
$this->display(); $this->display();
} }
public function get_server_lists($game_id=0){ public function get_server_lists($game_id = 0)
$server = M("server","tab_"); {
$server = M("server", "tab_");
$map['game_id'] = $game_id; $map['game_id'] = $game_id;
$lists = $server->field('id,server_name,game_name')->where($map)->select(); $lists = $server->field('id,server_name,game_name')->where($map)->select();
if(empty($lists)){ if (empty($lists)) {
return $this->ajaxReturn(array('status'=>0,'data'=>'')); return $this->ajaxReturn(array('status' => 0, 'data' => ''));
} }
return $this->ajaxReturn(array('status'=>1,'data'=>$lists)); return $this->ajaxReturn(array('status' => 1, 'data' => $lists));
} }
} }

@ -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"}]} {"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}]}

@ -2098,4 +2098,31 @@ class QueryController extends BaseController
$this->ajaxReturn($data); $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);
}
} }

Loading…
Cancel
Save