diff --git a/Application/Admin/Controller/PromoteCoinController.class.php b/Application/Admin/Controller/PromoteCoinController.class.php index a7103c06f..d120b1be5 100644 --- a/Application/Admin/Controller/PromoteCoinController.class.php +++ b/Application/Admin/Controller/PromoteCoinController.class.php @@ -215,4 +215,160 @@ class PromoteCoinController extends ThinkController { $this->display(); } + //获取线下充值列表 + public function offlineList($p=0) + { + //获取记录 + $map = array(); + $map['pay_type'] = 2; + $map['is_del'] = 0; + //其他条件查询 + if(isset($_REQUEST['promote_account'])){ + $map['promote_account']=array('like','%'.trim($_REQUEST['promote_account']).'%'); + unset($_REQUEST['promote_account']); + } + if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + unset($_REQUEST['time-start']);unset($_REQUEST['time-end']); + }elseif(isset($_REQUEST['time-start'])){ + $map['create_time'] = ['GT',strtotime(I('time-start'))]; + unset($_REQUEST['time-start']); + }elseif(isset($_REQUEST['time-end'])){ + $map['create_time'] = ['LT',strtotime(I('time-end'))+86399]; + unset($_REQUEST['time-end']); + } + if(isset($_REQUEST['order_status'])){ + $map['order_status']=$_REQUEST['order_status']; + unset($_REQUEST['order_status']); + } + $data = D("CoinPayOrder")->lists($_GET["p"], $map, $order); + // dump($data); + //执行查询 + // parent::order_lists("CoinPayOrder",$_GET["p"],$extend); + $this->meta_title = '线下充值审核列表'; + $this->assign('list_data',$data['data']); + $this->assign('_page',$data['page']); + $this->display(); + # code... + } + public function offlineOrderInfo() + { + if(!isset($_REQUEST['id'])){ + exit("参数错误"); + } + $id = $_REQUEST['id']; + $data = D("CoinPayOrder")->info($id); + $this->meta_title = '线下充值审核详情'; + $this->assign('data', $data); + $this->display(); + # code... + } + //审核通过 + public function offlineAgree() + { + if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){ + exit("参数错误"); + } + $ids = I("ids"); + $count = count($ids); + //执行操作 + for ($i=0; $i <$count; $i++) { + $this->doOfflineAgree($ids[$i]); + } + $this->success("批量通过成功"); + # code... + } + //批量审核拒绝 + public function offlineReject() + { + if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){ + exit("参数错误"); + } + $ids = I("ids"); + $count = count($ids); + //执行操作 + for ($i=0; $i <$count; $i++) { + $this->orderReject($ids[$i]); + } + $this->success("批量拒绝成功"); + # code... + } + + public function doOfflineAgree($id) + { + //获取记录 + $order = D("CoinPayOrder")->info($id); + if($order['order_status'] != 2){ + return; + } + // + $balance_map['promote_id'] = $order['promote_id']; + $balance_map['game_id'] = 0; + $balance = M('promote_balance_coin', 'tab_')->where($balance_map)->find(); + $this->balance_coin_update($order,$balance);//更新汇总 + $this->coin_record_add($order,$balance); //添加流水 + $this->promote_balance_coin_update($order); //更新推广员平台币余额 + $this->orderAgree($id);//更新表 + } + public function orderReject($id) + { + $order = D("CoinPayOrder")->info($id); + if($order['order_status'] != 2){ + return; + } + $savedata = array(); + $auth = $_SESSION['onethink_admin']['user_auth']; + $savedata['auditor_id']=$auth['uid']; + $savedata['auditor_account']=$auth['username']; + $savedata['auditor_time']=time(); + $savedata['order_status']=-1; + D("CoinPayOrder")->updateData($savedata,$id); + # code... + } + public function orderAgree($id) + { + $savedata = array(); + $auth = $_SESSION['onethink_admin']['user_auth']; + $savedata['auditor_id']=$auth['uid']; + $savedata['auditor_account']=$auth['username']; + $savedata['auditor_time']=time(); + $savedata['order_status']=4; + D("CoinPayOrder")->updateData($savedata,$id); + # code... + } + // 添加流水 + public function coin_record_add($order,$balance){ + $data['sn']=date('Ymd') . date('His') . sp_random_num(6); + $data['type']=1; + $data['sub_type'] =1; + $data['target_id'] = $order['promote_id']; + $data['target_type'] = 1; + $data['ref_id'] = $order['id']; + $data['coin'] = $order['real_amount']; + $data['balance_coin'] = $balance['num']+$order['coin_num']; + $data['remark'] = $order['remark']; + $data['create_time']=time(); + $data['description']='线下充值'; + M('promote_coin_record', 'tab_')->data($data)->add(); + } + + //更新汇总 + public function balance_coin_update($order,$balance){ + if(!empty($balance)){ + $map['promote_id'] = $order['promote_id']; + $map['game_id'] = 0; + M('promote_balance_coin', 'tab_')->where($map)->setInc('num',$order['coin_num']); + }else{ + $balance['promote_id']= $order['promote_id']; + $balance['game_id'] = 0; + $balance['num']=$order['coin_num']; + M('promote_balance_coin', 'tab_')->data($balance)->add(); + } + } + + //更新推广员平台币余额 + public function promote_balance_coin_update($order){ + $map['id'] = $order['promote_id']; + M('promote', 'tab_')->where($map)->setInc('balance_coin',$order['coin_num']); + } } diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index c16003a1b..db3697742 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1,5 +1,6 @@ meta_title = '快捷菜单管理'; + $this->m_title = '站点设置(推广员后台)'; + + $list = M("quick_menu","tab_")->page($page,$row)->select(); + + $count = M("quick_menu","tab_")->count(); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('list',$list); + $this->display(); + + } + + public function shortCutMenuEdit() { + + $id = I("id"); + $where['id'] = $id; + + $data = M("quick_menu","tab_")->where($where)->find(); + + $this->assign("data",$data); + $this->meta_title = '快捷菜单管理编辑'; + $this->m_title = '站点设置(推广员后台)'; + $this->display(); + } + + public function shortCutMenuSave() { + + $where['id'] = I("id"); + $save['icon'] = I("icon"); + + M('quick_menu', 'tab_')->startTrans(); //事物 + try{ + M('quick_menu', 'tab_')->where($where)->save($save); + }catch (Exception $e) { + M('quick_menu', 'tab_')->rollback();//回滚 + } + M('quick_menu', 'tab_')->commit(); //提交事物 + + $this->success('保存成功',U("promote/shortCutMenu")); + + } + } diff --git a/Application/Admin/Controller/TestResourceController.class.php b/Application/Admin/Controller/TestResourceController.class.php index bfe155bea..e05b25b6c 100644 --- a/Application/Admin/Controller/TestResourceController.class.php +++ b/Application/Admin/Controller/TestResourceController.class.php @@ -199,9 +199,14 @@ class TestResourceController extends ThinkController $arrUserId = array_column($data,'id'); $logId = implode(',',$arrUserId); - $logRead = M('protect_log_read','tab_') - ->where("log_id IN({$logId}) and promote_id = {$promote_id}") - ->select(); + if ($logId) { + $logRead = M('protect_log_read','tab_') + ->where("log_id IN({$logId}) and promote_id = {$promote_id}") + ->select(); + } + else { + $logRead = []; + } $upsetData = array_column($logRead,'log_id'); diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt deleted file mode 100644 index f2bc7fb38..000000000 --- a/Application/Admin/Controller/access_data_foldline.txt +++ /dev/null @@ -1 +0,0 @@ -{"news":[{"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":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":0,"player":0,"money":0},"active":[{"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":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"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":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"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":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]} \ No newline at end of file diff --git a/Application/Admin/Model/CoinPayOrderModel.class.php b/Application/Admin/Model/CoinPayOrderModel.class.php new file mode 100644 index 000000000..b5bd300cb --- /dev/null +++ b/Application/Admin/Model/CoinPayOrderModel.class.php @@ -0,0 +1,82 @@ + +// +---------------------------------------------------------------------- + +namespace Admin\Model; +use Think\Model; + +/** + * 文档基础模型 + */ +class CoinPayOrderModel extends Model{ + /** + * 构造函数 + * @param string $name 模型名称 + * @param string $tablePrefix 表前缀 + * @param mixed $connection 数据库连接信息 + */ + public function __construct($name = '', $tablePrefix = '', $connection = '') { + /* 设置默认的表前缀 */ + $this->tablePrefix ='tab_'; + /* 执行构造方法 */ + parent::__construct($name, $tablePrefix, $connection); + } + public function lists($p=1, $map=array(), $order, $field=true) + { + + $page = intval($p); + + $page = $page ? $page : 1; //默认显示第一页数据 + + if(isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $list = $this->field($field?:true) + ->where($map) + ->page($page, $row) + ->order($order?$order:'pay_time desc') + ->select(); + + $count = $this->where($map)->count(); + + $data['data'] = $list; + + $page = set_pagination($count,$row); + + if($page) { + $data['page']=$page; + } + + return $data; + } + //获取单个信息 + public function info($id) + { + $info = $this->field($field?:true) + ->where("id = '".$id."'") + ->find(); + if(!empty($info['voucher_img'])){ + $info['voucher_img'] = get_cover($info['voucher_img'])['path']; + } + + return $info; + # code... + } + //更新 + public function updateData($save,$id) + { + if(!empty($save['id'])){ + return false; + } + return $this->where("id = {$id}")->save($save); + # code... + } +} \ No newline at end of file diff --git a/Application/Admin/Model/UserModel.class.php b/Application/Admin/Model/UserModel.class.php index e031fb6a5..1dc8c4bdf 100644 --- a/Application/Admin/Model/UserModel.class.php +++ b/Application/Admin/Model/UserModel.class.php @@ -1051,16 +1051,31 @@ class UserModel extends Model{ } } - public function login_sdk($account,$password,$type=1,$game_id,$game_name,$sdk_version){ + public function login_sdk($account,$password,$type=1,$game_id,$game_name,$sdk_version,$unique_code){ $map['account'] = $account; /* 获取用户数据 */ $user = $this->where($map)->find(); if(is_array($user) && $user['lock_status'] && $user['check_status']){ /* 验证用户密码 */ if(think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']||$type==2){ - $token = $this->updateLogin_($user['id'],$account,$password,$user['fgame_id'],$game_id,$game_name); //更新用户登录信息 - $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version); - return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID + $test_resource = M('test_resource','tab_')->where("user_id=%s and apply_status=2",$user['id'])->find();//测试资源(扶持号) + if($test_resource){ //扶持号 + if($user['device_number'] && $unique_code && $user['device_number'] !=$unique_code){ //#当前登录设备信息与历史登录设备信息不一致,触发账户冻结 + $this->sdklogin_device_error($user,$test_resource,$unique_code); + $this->sdklogin_ip_error($user,$test_resource,get_client_ip()); + return -1;//扶持号被禁用 + }else{ + $token = $this->sdklogin_update($user,$account,$password,$user['fgame_id'],$game_id,$game_name,$unique_code); //更新用户登录信息 + $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version); + $this->sdklogin_ip_error($user,$test_resource,get_client_ip()); + return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID + } + }else{ + $token = $this->sdklogin_update($user,$account,$password,$user['fgame_id'],$game_id,$game_name,$unique_code); //更新用户登录信息 + $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version); + return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID + } + } else { return -2; //密码错误 } @@ -1070,6 +1085,79 @@ class UserModel extends Model{ } + //更新用户登录信息 + protected function sdklogin_update($user,$account,$password,$user_fgame_id,$game_id,$game_name,$unique_code=''){ + $model = M('User','tab_'); + $uid = $user['id']; + $data["id"] = $uid; + $data["login_time"] = NOW_TIME; + $data["login_ip"] = get_client_ip(); + $data["device_number"] = $unique_code; + $data["last_login_ip"] = $user['login_ip']; + $data["last_device_number"] = $user['device_number']; + $data["token"] = $this->generateToken($uid,$account,$password); + if($user_fgame_id){ + $model->save($data); + }else{ + $data['fgame_id']=$game_id; + $data['fgame_name']=$game_name; + $model->save($data); + } + return $data["token"]; + } + + // 扶持号登录设备异常 + protected function sdklogin_device_error($user,$resource,$unique_code){ + $model = M('User','tab_'); + $uid = $user['id']; + $data["id"] = $uid; + $data["device_number"] = $unique_code; + $data["last_device_number"] = $user['device_number']; + $data["lock_status"] = 0 ; + $model->save($data); + $protect_data['user_id']= $uid; + $protect_data['user_account']= $resource['user_account']; + $protect_data['server_id'] = $resource['server_id']; + $protect_data['server_name']= $resource['server_name']; + $protect_data['game_id']=$resource['game_id']; + $protect_data['game_name']=$resource['game_name']; + $protect_data['nickname']=$resource['role_name']; + $protect_data['promote_id']=$resource['promote_id']; + $protect_data['promote_account']=$resource['promote_account']; + $protect_data['type']=2; + $protect_data['detail']="登录设备号异常,本次异常设备号:".$unique_code.",历史登录设备号:".$user['device_number']; + $protect_data['create_time'] = NOW_TIME; + M('protect_log','tab_')->add($protect_data); + } + + // 扶持号登录IP异常 + protected function sdklogin_ip_error($user,$resource,$ip){ + $newloginip_source = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=".$ip); + $aldloginip_source = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=".$user['login_ip']); + + $newloginip_source = json_decode($newloginip_source,true); + $aldloginip_source = json_decode($aldloginip_source,true); + + if($newloginip_source['data']['city']!=$aldloginip_source['data']['city']){ //登录城市不一致时触发IP异常 + $uid = $user['id']; + $protect_data['user_id']= $uid; + $protect_data['user_account']= $resource['user_account']; + $protect_data['server_id'] = $resource['server_id']; + $protect_data['server_name']= $resource['server_name']; + $protect_data['game_id']=$resource['game_id']; + $protect_data['game_name']=$resource['game_name']; + $protect_data['nickname']=$resource['role_name']; + $protect_data['promote_id']=$resource['promote_id']; + $protect_data['promote_account']=$resource['promote_account']; + $protect_data['type']=1; + $protect_data['detail']="登录IP异常,本次异常IP:".$ip.",历史登录IP:".$user['login_ip']; + $protect_data['create_time'] = NOW_TIME; + M('protect_log','tab_')->add($protect_data); + } + } + + + //判断game_id是否有值 protected function updateLogin_($uid,$account,$password,$user_fgame_id,$game_id,$game_name){ $model = M('User','tab_'); diff --git a/Application/Admin/View/Promote/shortCutMenu.html b/Application/Admin/View/Promote/shortCutMenu.html new file mode 100644 index 000000000..f72fd9812 --- /dev/null +++ b/Application/Admin/View/Promote/shortCutMenu.html @@ -0,0 +1,59 @@ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ID菜单名称菜单跳转地址菜单图标操作
{$list.id}{$list.name}{$list.url}编辑
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + +
+ + + + \ No newline at end of file diff --git a/Application/Admin/View/Promote/shortCutMenuEdit.html b/Application/Admin/View/Promote/shortCutMenuEdit.html new file mode 100644 index 000000000..17cdc2b81 --- /dev/null +++ b/Application/Admin/View/Promote/shortCutMenuEdit.html @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + +
菜单名称: + +
菜单跳转地址: + +
角色名称: +
+ + + + +
+ +
+ +
+
+
+ + +
+ +
+
+ + + +
+ + + 返回 + +
+
+
+
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + diff --git a/Application/Admin/View/PromoteCoin/offlineList.html b/Application/Admin/View/PromoteCoin/offlineList.html new file mode 100644 index 000000000..ef6e8927a --- /dev/null +++ b/Application/Admin/View/PromoteCoin/offlineList.html @@ -0,0 +1,342 @@ + + + + + + + + + + + +
+ + +
+
+ +
+ +
+ +
+
+ + - +
+ + +
+
+
+ +
+ + +
+ 搜索 +
+
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 充值账号提交时间平台币数量付款金额汇入银行支付凭证备注审核状态操作
aOh! 暂时还没有内容!
{$data.promote_account}{:set_show_time($data['create_time'])}{$data.coin_num}{$data.real_amount}— —{$data.pay_order_number}{$data.remark} + 待审核 + 审核通过 + 审核不通过 + + + 查看 +
+
+
+
+ + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/PromoteCoin/offlineOrderInfo.html b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html new file mode 100644 index 000000000..30f8c2aed --- /dev/null +++ b/Application/Admin/View/PromoteCoin/offlineOrderInfo.html @@ -0,0 +1,154 @@ + + + + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
充值账号: + {$data['promote_account']} +
平台币数量: + {$data['coin_num']} +
购买金额: + {$data['real_amount']} +
汇入银行: + -- +
支付凭证: + {$data['pay_order_number']} +
支付截图: + +
备注: + {$data['remark']} +
+
+ + +
+
+
+
+
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + \ No newline at end of file diff --git a/Application/Admin/View/TestResource/add.html b/Application/Admin/View/TestResource/add.html index 2e8c30fc9..03b4751ba 100644 --- a/Application/Admin/View/TestResource/add.html +++ b/Application/Admin/View/TestResource/add.html @@ -31,10 +31,9 @@ @@ -152,7 +151,7 @@ + diff --git a/Application/Admin/View/TestResource/supportNumberList.html b/Application/Admin/View/TestResource/supportNumberList.html index 1e3f0ecd0..1fcc6611c 100644 --- a/Application/Admin/View/TestResource/supportNumberList.html +++ b/Application/Admin/View/TestResource/supportNumberList.html @@ -183,14 +183,14 @@ $('.froze-btn').on({ click: function() { var id = $(this).parents('tr').eq(0).attr('data-id') - layer.confirm('是否确认冻结帐号?', {icon: 3, title:'提示'}, function(index){ + layer.confirm('是否确认冻结帐号?', {icon: 3, title:'提示',skin:'textColor'}, function(index){ $.ajax({ url: "{:U('TestResource/freezeSupport')}", data: {support_id: id}, type: 'post', dataType: 'json', success: function(response) { - layer.msg(response.msg, {time: 1000}, function() { + layer.msg(response.msg, {time: 1000,skin:'msgClolor'}, function() { window.location.href = window.location.href }) } @@ -202,14 +202,14 @@ $('.unfroze-btn').on({ click: function() { var id = $(this).parents('tr').eq(0).attr('data-id') - layer.confirm('是否确认启用帐号?', {icon: 3, title:'提示'}, function(index){ + layer.confirm('是否确认启用帐号?', {icon: 3, title:'提示',skin:'textColor'}, function(index){ $.ajax({ url: "{:U('TestResource/unfreezeSupport')}", data: {support_id: id}, type: 'post', dataType: 'json', success: function(response) { - layer.msg(response.msg, {time: 1000}, function() { + layer.msg(response.msg, {time: 1000,skin:'msgClolor'}, function() { window.location.href = window.location.href }) } @@ -222,7 +222,7 @@ click: function() { var id = $(this).attr('data-id') console.log(id); - layer.confirm('是否确认重置账号密码?', {icon: 3, title:'提示'}, function(index){ + layer.confirm('是否确认重置账号密码?', {icon: 3, title:'提示',skin:'textColor'}, function(index){ $.ajax({ url: "{:U('TestResource/rechangePassward')}", data: {support_id: id}, @@ -230,7 +230,7 @@ dataType: 'json', success: function(response) { console.log(response) - layer.confirm(response.msg, {icon: 3, title:'提示'}, function() { + layer.confirm(response.msg, {icon: 3, title:'提示',skin:'textColor'}, function() { window.location.href = window.location.href }) } @@ -333,6 +333,7 @@ + + diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 890c04244..10c8c8194 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -100,24 +100,48 @@ class PromoteController extends BaseController $page = $this->ajax_page($count, 20, 'seach'); $this->assign("_page", $page); - $user_count = M("user", "tab_")->where("promote_id=" . get_pid())->count(); - $total_money = $this->pay_total(0, 0); - $today_add_user_money = $this->pay_total(1); - $month_add_user_money = $this->pay_total(3); + + $promote = M("promote","tab_")->field("parent_id,grand_id")->where("id=".get_pid())->find(); + $promoteId = array(get_pid()); + + if ($promote['parent_id'] == 1) { + $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid()." or grand_id=". get_pid())->select(); + $promoteId = array_column($promoteId,'id'); + array_push($promoteId,get_pid()); + } elseif ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) { + $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid())->select(); + $promoteId = array_column($promoteId,'id'); + array_push($promoteId,get_pid()); + } + $promoteId = implode(',',$promoteId); + if ($promoteId) { + $user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count(); + } else { + $user_count = 0; + } + + + $total_money = $this->pay_total(0, 0,$promoteId); + $today_add_user_money = $this->pay_total(1,1,$promoteId); + $month_add_user_money = $this->pay_total(3,1,$promoteId); $yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $yesterday_user_regist_count = M("user", "tab_")->where( - array("promote_id" => get_pid(), + array("promote_id" => array('in',$promoteId), "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) ->count(); - $yesterday_total_money = $this->pay_total(5, 0); - $yesterday_regist_user_count = M("user", "tab_") - ->where(array("promote_id" => get_pid(), - "register_time" => array("BETWEEN", array($yesterday_start, $yesterday_end)))) + + $yesterday_total_money = $this->pay_total(5, 0,$promoteId); + + $today_start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); + $today_end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; + $today_regist_user_count = M("user", "tab_") + ->where(array("promote_id" => array('in',$promoteId), + "register_time" => array("BETWEEN", array($today_start, $today_end)))) ->count(); + $today_total_money = $this->pay_total(1, 0,$promoteId); - $yesterday_total_money = $this->pay_total(1, 0); $this->assign("user_count", $user_count); $this->assign("total_money", $total_money); $this->assign("today_add_user_money", $today_add_user_money); @@ -126,6 +150,8 @@ class PromoteController extends BaseController $this->assign("yesterday_total_money", $yesterday_total_money); $this->assign("yesterday_regist_user_count", $yesterday_regist_user_count); $this->assign("yesterday_total_money", $yesterday_total_money); + $this->assign("today_regist_user_count", $today_regist_user_count); + $this->assign("today_total_money", $today_total_money); $this->assign("menu_list", $quick_menu_list); $this->assign("gg_list", $gg_list); @@ -141,7 +167,7 @@ class PromoteController extends BaseController $this->display(); } - private function pay_total($type = 0, $newadd = 1) + private function pay_total($type = 0, $newadd = 1,$promoteId="") { if ($_REQUEST['promote_id'] === null || $_REQUEST['promote_id'] === '0') { $map['parent_id'] = get_pid(); @@ -155,7 +181,7 @@ class PromoteController extends BaseController } else { $ids = array($_REQUEST['promote_id']); } - $where['spend.promote_id'] = array('in', $ids); + $where['spend.promote_id'] = array('in', $promoteId); $where['spend.pay_status'] = 1; $where['spend.is_check'] = array('NEQ', 2); switch ($type) { @@ -206,6 +232,7 @@ class PromoteController extends BaseController $where['user.register_time'] = array("BETWEEN", array($start, $end)); } } + if ($newadd == 1) { $total = M('spend as spend', "tab_")->field("SUM(spend.pay_amount) as amount")->join("right join tab_user user on user.id=spend.user_id")->where($where)->select(); } else { @@ -860,6 +887,15 @@ class PromoteController extends BaseController $this->ajaxReturn(array('status' => -1, 'msg' => '身份证格式错误')); } } + if (mb_strlen($_POST['account']) < 6 || mb_strlen($_POST['account']) > 15) { + $this->error('账号长度为6-15个字符', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); + return false; + } + + if (mb_strlen($_POST['real_name']) < 2 || mb_strlen($_POST['real_name']) > 4) { + $this->error('姓名长度为2-4个字符', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0)))); + return false; + } $res = $user->promote_add($_POST); if (is_numeric($res)) { diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index bf67b43ab..ab3dc63cd 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -101,7 +101,7 @@ class QueryController extends BaseController empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version'); empty(I('server_id')) || $map['tab_spend.server_id'] = I('server_id'); empty(I('game_player_name')) || $map['tab_spend.game_player_name'] = ['like', '%' . I('game_player_name') . '%']; - empty(I('user_account')) || $map['tab_spend.user_account'] = ['like', '%' . I('user_account') . '%']; + empty(I('user_account')) || $map['tab_spend.user_account'] = I('user_account'); empty(I('order_number')) || $map['tab_spend.order_number'] = I('order_number'); $map['tab_spend.pay_status'] = 1; $map['tab_spend.is_check'] = ['neq', 2]; @@ -231,7 +231,7 @@ class QueryController extends BaseController $map['tab_user.register_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]]; } - empty(I('account')) || $map['tab_user.account'] = ['like', '%' . I('account') . '%']; + empty(I('account')) || $map['tab_user.account'] = I('account'); empty(I('id')) || $map['tab_user.id'] = intval(I('id')); $data = M('User', 'tab_') @@ -1155,7 +1155,9 @@ class QueryController extends BaseController $newUserNumData = $userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as num') + ->join($join) ->where($userPlayInfoWhere2) + ->where($map) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->order('tab_user_play_info.id') ->find(); @@ -1163,7 +1165,9 @@ class QueryController extends BaseController $newDeviceData = $userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_device_number) as num') + ->join($join) ->where($userPlayInfoWhere2) + ->where($map) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->order('tab_user_play_info.id') ->find(); @@ -1171,7 +1175,9 @@ class QueryController extends BaseController $newIpNumData = $userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_ip) as num') + ->join($join) ->where($userPlayInfoWhere2) + ->where($map) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->order('tab_user_play_info.id') ->find(); diff --git a/Application/Home/View/default/Promote/add_chlid.html b/Application/Home/View/default/Promote/add_chlid.html index e87d01b21..5d9d63c2a 100644 --- a/Application/Home/View/default/Promote/add_chlid.html +++ b/Application/Home/View/default/Promote/add_chlid.html @@ -37,13 +37,13 @@ *帐号: - + *姓名: - + @@ -141,8 +141,14 @@ if($('#account').val()==""){ return json_data = {'status':0,'msg':'子渠道账号不能为空'} } - if($.trim($('#account').val()).length < 6){ - return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'} + // if($.trim($('#account').val()).length < 6){ + // return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'} + // } + if($.trim($('#account').val()).length < 6 || $.trim($('#account').val()).length > 15){ + return json_data = {'status':0,'msg':'子渠道账号长度为6-15位字符'} + } + if($.trim($('#real_name').val()).length < 2 || $.trim($('#real_name').val()).length > 4){ + return json_data = {'status':0,'msg':'子渠道姓名长度为2-4位字符'} } if($('#password').val()==""){ return json_data = {'status':0,'msg':'子渠道密码不能为空'} diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index 4e2065a3c..1fa99f383 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -13,8 +13,8 @@
  • 昨日注册用户

    {$yesterday_user_regist_count}
  • 昨日充值金额

    ¥{$yesterday_total_money}
  • -
  • 今日注册用户

    {$yesterday_regist_user_count}
  • -
  • 今日充值金额

    ¥{$yesterday_total_money}
  • +
  • 今日注册用户

    {$today_regist_user_count}
  • +
  • 今日充值金额

    ¥{$today_total_money}
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 21ceebfe2..0050c3781 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -48,7 +48,7 @@
diff --git a/Application/Home/View/default/Query/recharge.html b/Application/Home/View/default/Query/recharge.html index 842af2012..83eb497cd 100644 --- a/Application/Home/View/default/Query/recharge.html +++ b/Application/Home/View/default/Query/recharge.html @@ -203,7 +203,7 @@ - {$vo.user_account} + {$vo.user_account} {$vo.order_number} {:get_pay_way($vo['pay_way'])} {$vo.pay_amount} diff --git a/Application/Home/View/default/Query/register.html b/Application/Home/View/default/Query/register.html index 0d2a5cbf9..169dca9da 100644 --- a/Application/Home/View/default/Query/register.html +++ b/Application/Home/View/default/Query/register.html @@ -124,7 +124,7 @@ - {$vo.account} + {$vo.account} {$vo.promote_account}({$vo.pro_real_name}) {$vo.device_number} {$vo.register_time|date='Y-m-d H:i:s',###} diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 7e32cf78e..674d9ea2d 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -370,7 +370,7 @@ class UserController extends BaseController break; } - if (!preg_match("/^1[34578]\d{9}$/", $phone)) { + if (!preg_match("/^1[345789]\d{9}$/", $phone)) { echo json_encode(['status' => 0, 'msg' => '手机号格式不正确']); die; } diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index d8a701d54..3fcb8157c 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -40,7 +40,7 @@ class UserController extends BaseController //1.登录成功,验证在本地是否有此账号 $user_res = M('user', 'tab_') -> where(['account' => $uc_username]) -> find(); if (!empty($user_res)) {//本地存在账号,验证密码直接登录 - $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version']);#调用登录 + $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version'],$user['unique_code']);#调用登录 $res_msg = array(); switch ($result) { case - 1: @@ -112,7 +112,7 @@ class UserController extends BaseController if ($res > 0) { - $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version']);#调用登录 + $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version'],$user['unique_code']);#调用登录 $res_msg = array(); switch ($result) { case - 1: @@ -173,7 +173,7 @@ class UserController extends BaseController } elseif ($uc_uid == - 1) { //用户不存在,验证本地用户账号密码 - $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version']);#调用登录 + $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version'],$user['unique_code']);#调用登录 $res_msg = array(); switch ($result) { case - 1: @@ -236,7 +236,7 @@ class UserController extends BaseController } #实例化用户接口 $userApi = new MemberApi(); - $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version']);#调用登录 + $result = $userApi -> login_sdk($user["account"], $user['password'], 1, $user["game_id"], get_game_name($user["game_id"]), $user['sdk_version'],$user['unique_code']);#调用登录 $res_msg = array(); switch ($result) { @@ -1196,7 +1196,13 @@ class UserController extends BaseController $data['create_ip'] = get_client_ip(); // $data['create_device_number'] = time(); - $user_play->add($data); + // 修改重复插入问题 增加唯一索引 记录重复插入异常 + try { + $user_play->add($data); + } catch (\Exception $e) { + Log::write('Duplicate Exception:' .json_encode($e->getMessage()), Log::ERR); + } + $this->updateLoginRecord($data); } diff --git a/Application/User/Api/MemberApi.class.php b/Application/User/Api/MemberApi.class.php index 6df0a929c..97baf85f0 100644 --- a/Application/User/Api/MemberApi.class.php +++ b/Application/User/Api/MemberApi.class.php @@ -111,12 +111,12 @@ class MemberApi extends Api{ public function login_($account, $password,$type=2,$game_id=0,$game_name='',$sdk_version){ return $this->model->login_1($account, $password,$type,$game_id,$game_name,$sdk_version); } - - public function login_sdk($account, $password,$type=2,$game_id=0,$game_name='',$sdk_version){ - return $this->model->login_sdk($account, $password,$type,$game_id,$game_name,$sdk_version); + + public function login_sdk($account, $password,$type=2,$game_id=0,$game_name='',$sdk_version,$unique_code=''){ + return $this->model->login_sdk($account, $password,$type,$game_id,$game_name,$sdk_version,$unique_code); } - - + + /** *修改数据 */ diff --git a/Data/update.sql b/Data/update.sql index 754f485ea..054c3c2e5 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -180,3 +180,5 @@ MODIFY COLUMN `promote_account` varchar(30) BINARY CHARACTER SET utf8 COLLATE u -- 2019-10-22 cxj UPDATE `sys_model` SET list_grid = "id:编号\r\nsort:排序\r\ngame_name:游戏名称\r\ngame_type_name:游戏类型\r\ngame_type_id:游戏类型\r\ngame_appid:游戏appid\r\ngame_status|get_info_status:显示状态\r\npay_status|get_info_status:支付状态\r\nicon:图片id\r\napply_status:审核状态\r\ncategory:开放类型\r\nrecommend_status|get_info_status*1:推荐状态\r\nrelation_game_id:关联游戏id\r\nrelation_game_name:关联游戏名称\r\nsdk_version:运营平台\r\ndevelopers:开发商\r\ndow_num:下载\r\nonline_status:上线状态\r\ncreate_time:创建时间\r\nserver_type:混服管理\r\nid:操作:[EDIT]&id=[id]|编辑,Game/del?ids=[id]|删除" where id = 15; +-- 2019-10-23 zcl +ALTER TABLE `tab_coin_pay_order` CHANGE COLUMN `currency_num` `coin_num` int(11) NULL DEFAULT 0 COMMENT '代币数量' AFTER `auditor_time`; \ No newline at end of file