diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index b854f8b2d..ad020d72d 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -8,6 +8,8 @@ namespace Admin\Controller; +use Admin\Model\PromoteModel; + class AjaxController extends ThinkController{ /** @@ -125,4 +127,9 @@ class AjaxController extends ThinkController{ $this->AjaxReturn($return_msg); } } + + public function getPromotersByLevel($level=1) + { + $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>(new PromoteModel)->getPromotersByLevel($level)]); + } } \ No newline at end of file diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index b203db626..98f059052 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -19,9 +19,15 @@ class MemberController extends ThinkController if($_REQUEST['promote_id']=='UC'){ $maps['tab_user.promote_account'] = 'UC用户'; $hav .= "tab_user.promote_account = 'UC用户' "; - }else{ - $maps['tab_user.promote_id'] = I('promote_id'); - $hav .= "tab_user.promote_id = " . I('promote_id'); + } else if ($_REQUEST['promote_id']==0) { + $maps['tab_user.promote_id'] = 0; + $hav .= "tab_user.promote_id = 0"; + } else{ + $promoter_ids = D("Promote")->where("parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}")->field('id')->select(); + if ($promoter_ids) { + $maps['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; + $hav .= "tab_user.promote_id in (".implode(',', array_column($promoter_ids, 'id')).") "; + } } } if(I('type',1) == 1){ @@ -56,8 +62,7 @@ class MemberController extends ThinkController $maps['tab_user.register_type'] = ['in',[0,3,4,5,6]]; } } - - + if (isset($_REQUEST['account'])) { empty($hav) || $hav .= ' AND '; $hav .= "tab_user.account like '%" . I('account') . "%'"; @@ -105,10 +110,10 @@ class MemberController extends ThinkController unset($_REQUEST['status']); } - if (isset($_REQUEST['viplevel'])) { - - $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']); - } + if (isset($_REQUEST['viplevel'])) { + + $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']); + } $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 @@ -158,13 +163,13 @@ class MemberController extends ThinkController ->select(false); $data = $usermodel->table('('.$sql1.') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,(a.deposit_total+IFNULL(sum(ss.pay_amount),0)) as recharge_total,check_status') - ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1') + ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1') + ->join(isset($_REQUEST['game_id']) ? "tab_user_play as up on up.user_id = a.id and up.game_id = {$_REQUEST['game_id']} " : false) ->page($page, $row) ->having($havs) ->group('a.id') ->order($order) ->select(); - // var_dump($data);die; //计数 @@ -172,6 +177,7 @@ class MemberController extends ThinkController $sql = M('user', 'tab_')->field('tab_user.id,(IFNULL(sum(b.pay_amount),0) + IFNULL(sum(ss.pay_amount),0)) AS recharge_total') ->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1') ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1') + ->join(isset($_REQUEST['game_id']) ? "tab_user_play as up on up.user_id = tab_user.id and up.game_id = {$_REQUEST['game_id']} " : false) ->where($map) ->group('tab_user.id') ->where($hav) 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..3762d2e45 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"); + $save['name'] = I("name"); + + 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/RechargeSumController.class.php b/Application/Admin/Controller/RechargeSumController.class.php index 3f6518cfa..84eec8aa7 100644 --- a/Application/Admin/Controller/RechargeSumController.class.php +++ b/Application/Admin/Controller/RechargeSumController.class.php @@ -44,21 +44,23 @@ class RechargeSumController extends ThinkController{ $map['pay_way'] = array('egt',0); } - if(!empty($_REQUEST['promote_id']) && $_REQUEST['promote_id'] != "ALL"){ - switch ($_REQUEST['promote_id']) { - case 'GUANFANG': - $map['promote_id'] = 0; - $rmap['promote_id'] = 0; - break; - case 'PROMOTE': - $map['promote_id'] = array('neq',0); - $rmap['promote_id'] = array('neq',0); - break; - default: - $map['promote_id'] = $_REQUEST['promote_id']; - $rmap['promote_id'] = $_REQUEST['promote_id']; - break; - } + if(!empty($_REQUEST['promote_id'])){ + // switch ($_REQUEST['promote_id']) { + // case 'GUANFANG': + // $map['promote_id'] = 0; + // $rmap['promote_id'] = 0; + // break; + // case 'PROMOTE': + // $map['promote_id'] = array('neq',0); + // $rmap['promote_id'] = array('neq',0); + // break; + // default: + // $map['promote_id'] = $_REQUEST['promote_id']; + // $rmap['promote_id'] = $_REQUEST['promote_id']; + // break; + // } + $promoter_ids = D("Promote")->where("parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}")->field('id')->select(); + $promoter_ids ? $rmap['promote_id'] = $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; } //当天注册人数 diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 92b3067ca..c58167a3b 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -11,65 +11,72 @@ class SpendController extends ThinkController { const model_name = 'Spend'; public function lists(){ if(isset($_REQUEST['user_account'])){ - $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); + $map['tab_spend.user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); unset($_REQUEST['user_account']); } if(isset($_REQUEST['spend_ip'])){ - $map['spend_ip']=array('like','%'.trim($_REQUEST['spend_ip']).'%'); + $map['tab_spend.spend_ip']=array('like','%'.trim($_REQUEST['spend_ip']).'%'); unset($_REQUEST['spend_ip']); } if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ - $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + $map['tab_spend.pay_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['pay_time'] = ['GT',strtotime(I('time-start'))]; + $map['tab_spend.pay_time'] = ['GT',strtotime(I('time-start'))]; unset($_REQUEST['time-start']); }elseif(isset($_REQUEST['time-end'])){ - $map['pay_time'] = ['LT',strtotime(I('time-end'))+86399]; + $map['tab_spend.pay_time'] = ['LT',strtotime(I('time-end'))+86399]; unset($_REQUEST['time-end']); } if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ - $map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); + $map['tab_spend.pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); }elseif(isset($_REQUEST['start'])){ - $map['pay_time'] = ['GT',strtotime(I('start'))]; + $map['tab_spend.pay_time'] = ['GT',strtotime(I('start'))]; unset($_REQUEST['start']); }elseif(isset($_REQUEST['end'])){ - $map['pay_time'] = ['LT',strtotime(I('end'))+86399]; + $map['tab_spend.pay_time'] = ['LT',strtotime(I('end'))+86399]; unset($_REQUEST['end']); } if(isset($_REQUEST['game_name'])){ if($_REQUEST['game_name']=='全部'){ unset($_REQUEST['game_name']); }else{ - $map['game_name']=$_REQUEST['game_name']; + $map['tab_spend.game_name']=$_REQUEST['game_name']; unset($_REQUEST['game_name']); } } if(isset($_REQUEST['server_name'])){ - $map['server_name']=$_REQUEST['server_name']; + $map['tab_spend.server_name']=$_REQUEST['server_name']; unset($_REQUEST['server_name']); } if(isset($_REQUEST['pay_order_number'])){ - $map['pay_order_number']=array('like','%'.trim($_REQUEST['pay_order_number']).'%'); + $map['tab_spend.pay_order_number']=array('like','%'.trim($_REQUEST['pay_order_number']).'%'); unset($_REQUEST['pay_order_number']); } if(isset($_REQUEST['pay_status'])){ - $map['pay_status']=$_REQUEST['pay_status']; + $map['tab_spend.pay_status']=$_REQUEST['pay_status']; unset($_REQUEST['pay_status']); } if(isset($_REQUEST['pay_way'])){ if($_REQUEST['pay_way']==2){ - $map['pay_way']=['in','2,3,4']; + $map['tab_spend.pay_way']=['in','2,3,4']; }else{ - $map['pay_way']=$_REQUEST['pay_way']; + $map['tab_spend.pay_way']=$_REQUEST['pay_way']; } unset($_REQUEST['pay_way']); } if(isset($_REQUEST['pay_game_status'])){ - $map['pay_game_status']=$_REQUEST['pay_game_status']; + $map['tab_spend.pay_game_status']=$_REQUEST['pay_game_status']; unset($_REQUEST['pay_game_status']); } + if(isset($_REQUEST['promote_id'])) { + $map['_complex'] = ['tp.parent_id'=>$_REQUEST['promote_id'], 'tp.grand_id'=>$_REQUEST['promote_id'], 'tp.id'=>$_REQUEST['promote_id'], '_logic' => 'or']; + $tab_promote_join = "left join tab_promote as tp on tp.id = tab_spend.promote_id"; + //unset($_REQUEST['promote_id']); + } else { + $tab_promote_join = false; + } if($_REQUEST['data_order']!=''){ $data_order=reset(explode(',',$_REQUEST['data_order'])); @@ -84,9 +91,9 @@ class SpendController extends ThinkController { $map1=$map; $map1['pay_status']=1; - $total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); - $ttotal=null_to_0(D(self::model_name)->where('pay_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); - $ytotal=null_to_0(D(self::model_name)->where('pay_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); + $total=null_to_0(D(self::model_name)->where($map1)->join($tab_promote_join)->sum('pay_amount')); + $ttotal=null_to_0(D(self::model_name)->where('pay_time'.total(1))->where(array('pay_status'=>1))->join($tab_promote_join)->sum('pay_amount')); + $ytotal=null_to_0(D(self::model_name)->where('pay_time'.total(5))->where(array('pay_status'=>1))->join($tab_promote_join)->sum('pay_amount')); $this->assign('total',$total); $this->assign('ttotal',$ttotal); $this->assign('ytotal',$ytotal); @@ -104,6 +111,6 @@ class SpendController extends ThinkController { $this->assign('_page',$data['page']); $this->display(); - } + } 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/UserController.class.php b/Application/Admin/Controller/UserController.class.php index b9b8ff816..aec80c71f 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -569,6 +569,11 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ $map['role_name'] = trim($_REQUEST['role_name']); unset($_REQUEST['role_name']); } + if (isset($_REQUEST['promote_id'])) { + $promoter_ids = D("Promote")->where("parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}")->field('id')->select(); + $promoter_ids ? $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; + + } 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); 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/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index 379fa42ee..a12fecfa6 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -371,4 +371,21 @@ class PromoteModel extends Model{ return $user; } + + public function getPromotersByLevel($level=1) + { + $result = []; + switch ($level) { + case 1: // 会长 + $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id = 0")->select(); + break; + case 2: // 组长 + $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id > 0")->select(); + break; + case 3: //组员 + $result = $this->field("id, nickname")->where("parent_id > 0 and grand_id > 0")->select(); + break; + } + return $result; + } } \ No newline at end of file diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index 5f03bb50f..bfb91151c 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -720,14 +720,14 @@ protected function _after_select(&$result,$options){ } else { $row = 10; } - - $list = $this->field($field?:true) + $list = $this->field("tab_spend.*") + ->join("left join tab_promote as tp on tp.id = tab_spend.promote_id") ->where($map) ->page($page, $row) - ->order($order?$order:'pay_time desc') + ->order($order?$order:'tab_spend.pay_time desc') ->select(); - $count = $this->where($map)->count(); + $count = $this->where($map)->join("left join tab_promote as tp on tp.id = tab_spend.promote_id")->count(); $data['data'] = $list; @@ -738,6 +738,7 @@ protected function _after_select(&$result,$options){ } return $data; - } + } + } 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/Member/user_info.html b/Application/Admin/View/Member/user_info.html index 9dbf16d59..5bb75a9ad 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -73,7 +73,7 @@ -
ID | +菜单名称 | +菜单跳转地址 | +菜单图标 | +操作 | +
---|---|---|---|---|
{$list.id} | +{$list.name} | +{$list.url} | +编辑 | +aOh! 暂时还没有内容! | +
说明:当用户在推广后台发起线下充值时,可在本页面审核是否通过,通过则自动发币
++ + | +充值账号 | +提交时间 | + +平台币数量 | +付款金额 | + +汇入银行 | +支付凭证 | + +备注 | +审核状态 | + +操作 | +aOh! 暂时还没有内容! | +
---|---|---|---|---|---|---|---|---|---|
+ | {$data.promote_account} | +{:set_show_time($data['create_time'])} | +{$data.coin_num} | +{$data.real_amount} | +— — | +{$data.pay_order_number} | +{$data.remark} | +
+ |
+ + 查看 + | +
说明:当用户在推广后台发起线下充值时,可在本页面审核是否通过,通过则自动发币
+充值账号: | ++ {$data['promote_account']} + | +
平台币数量: | ++ {$data['coin_num']} + | +
购买金额: | ++ {$data['real_amount']} + | +
汇入银行: | ++ -- + | +
支付凭证: | ++ {$data['pay_order_number']} + | +
支付截图: | +
+ |
+
备注: | ++ {$data['remark']} + | +
+ |
+
+
+
+
+ |
+
推广总用户
{$user_count}推广总充值
¥{$total_money}当日新增用户充值
¥{$today_add_user_money}当月新增用户充值
¥{$month_add_user_money}推广总用户
{$data.count}推广总充值
¥{$spendData.count}当日新增用户充值
¥{$todayAddSpendData.today}当月新增用户充值
¥{$mounthAddSpendData.mounth}昨日注册用户
{$yesterday_user_regist_count}昨日充值金额
¥{$yesterday_total_money}今日注册用户
{$yesterday_regist_user_count}今日充值金额
¥{$yesterday_total_money}昨日注册用户
{$data.yesterday}昨日充值金额
¥{$yesterdaySpendData.count}今日注册用户
{$data.today}今日充值金额
¥{$spendData.today}
日期 | 创角数 | 创角用户 | -新创角用户|新创角设备 + | 新创角用户|新创角设备 | 新增创角IP | 登录用户数 | -充值人数 | -充值次数 | -充值总额充值人数 | +充值次数 | +充值总额 | 现金充值 | 通用币充值 | @@ -198,7 +198,7 @@折扣币充值 | -+ | 代金劵使用 | @@ -609,7 +609,9 @@ var sdkVersion = $(this).val(); var relationGameId = $('#relation_game_id').val(); - getServerList(relationGameId, sdkVersion); + if (relationGameId > 0) { + getServerList(relationGameId, sdkVersion); + } }); function getServerList(relationGameId, sdkVersion) { diff --git a/Application/Home/View/default/Query/recharge.html b/Application/Home/View/default/Query/recharge.html index 842af2012..fd126b232 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} | @@ -343,7 +343,9 @@ var sdkVersion = $(this).val(); var relationGameId = $('#relation_game_id').val(); - getServerList(relationGameId, sdkVersion); + if (relationGameId > 0) { + getServerList(relationGameId, sdkVersion); + } }); function getServerList(relationGameId, sdkVersion) 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/Home/View/default/Query/summary.html b/Application/Home/View/default/Query/summary.html index 636d00b3f..545019883 100644 --- a/Application/Home/View/default/Query/summary.html +++ b/Application/Home/View/default/Query/summary.html @@ -155,17 +155,23 @@平台 | 创角数 | 创角用户 | -新创角用户|新创角设备 | +新创角用户|新创角设备 + | 新增创角IP | 登录用户数 | -充值人数 | -充值次数 | -充值总额 | +充值人数 | +充值次数 | +充值总额 | 现金充值 | 通用币充值 | 绑定币充值 | -折扣币充值 | -代金劵使用 | ++ 折扣币充值 + | ++ 代金劵使用 + | |||||