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 @@ -
+
@@ -103,15 +103,38 @@
-
- -
+
+ +
+
+ +
+
+ + - +
+
+ +
@@ -375,6 +398,30 @@ $(function(){ autoclose:true, pickerPosition:'bottom-left' }) + var promote_id = "{:I('promote_id')}"; + $("#promote_level").change(function(){ + $.ajax({ + url:"{:U('Ajax/getPromotersByLevel')}", + type:"get", + data:{level:$("#promote_level option:selected").val()}, + dataType:'json', + success:function(response){ + str = ''; + // $.each(response.data, function(index, item){ + // console.log(item.id); + // str += ''; + // }); + data = response.data; + for (var i in data){ + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + }); + $("#promote_level").change(); }) function shenhe(){ var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { diff --git a/Application/Admin/View/Promote/shortCutMenu.html b/Application/Admin/View/Promote/shortCutMenu.html new file mode 100644 index 000000000..68877f7b6 --- /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..10d74ecf5 --- /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/RechargeSum/summation.html b/Application/Admin/View/RechargeSum/summation.html index f565d0e41..51ee0b684 100644 --- a/Application/Admin/View/RechargeSum/summation.html +++ b/Application/Admin/View/RechargeSum/summation.html @@ -55,7 +55,7 @@
-
+
+
+ + - +
+
+ +
搜索
@@ -268,6 +282,32 @@ $(function(){ autoclose: true, pickerPosition: 'bottom-left' }) + + var promote_id = "{:I('promote_id')}"; + console.log(promote_id); + $("#promote_level").change(function(){ + $.ajax({ + url:"{:U('Ajax/getPromotersByLevel')}", + type:"get", + data:{level:$("#promote_level option:selected").val()}, + dataType:'json', + success:function(response){ + str = ""; + // $.each(response.data, function(index, item){ + // console.log(item.id); + // str += ''; + // }); + data = response.data; + for (var i in data){ + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + }); + $("#promote_level").change(); }) diff --git a/Application/Admin/View/Spend/lists.html b/Application/Admin/View/Spend/lists.html index e4c2e2aad..b160f7f19 100644 --- a/Application/Admin/View/Spend/lists.html +++ b/Application/Admin/View/Spend/lists.html @@ -96,6 +96,20 @@
+
+
+ + - +
+
+ +
@@ -463,6 +477,33 @@ } }) }); + + var promote_id = "{:I('promote_id')}"; + console.log(promote_id); + $("#promote_level").change(function(){ + $.ajax({ + url:"{:U('Ajax/getPromotersByLevel')}", + type:"get", + data:{level:$("#promote_level option:selected").val()}, + dataType:'json', + success:function(response){ + str = ""; + // $.each(response.data, function(index, item){ + // console.log(item.id); + // str += ''; + // }); + data = response.data; + for (var i in data){ + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + }); + $("#promote_level").change(); + var game_id = "{:I('game_name')}"; var game_server = "{:I('server_name')}"; if(game_id){ 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/lists.html b/Application/Admin/View/TestResource/lists.html index fd03b4c41..e62fb5f99 100644 --- a/Application/Admin/View/TestResource/lists.html +++ b/Application/Admin/View/TestResource/lists.html @@ -203,8 +203,6 @@ Think.setValue('{$key}',"{$vo}"); - $('.side-sub-menu').eq(0).show(); - $(".select_gallery").select2(); + + diff --git a/Application/Admin/View/User/rolelist.html b/Application/Admin/View/User/rolelist.html index a6b8e04ab..b5b65bc90 100644 --- a/Application/Admin/View/User/rolelist.html +++ b/Application/Admin/View/User/rolelist.html @@ -69,7 +69,21 @@
- +
+ + - +
+
+ +
搜索
@@ -224,5 +238,29 @@ $(".select_gallery").select2(); } }) } + var promote_id = "{:I('promote_id')}"; + $("#promote_level").change(function(){ + $.ajax({ + url:"{:U('Ajax/getPromotersByLevel')}", + type:"get", + data:{level:$("#promote_level option:selected").val()}, + dataType:'json', + success:function(response){ + str = ''; + // $.each(response.data, function(index, item){ + // console.log(item.id); + // str += ''; + // }); + data = response.data; + for (var i in data){ + str += "" + } + $("#promote_id").empty(); + $("#promote_id").append(str); + $("#promote_id").select2(); + } + }) + }); + $("#promote_level").change(); diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 890c04244..0145fa2d0 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -38,9 +38,9 @@ class PromoteController extends BaseController $this->meta_title = "首页"; $loginPromote = $this->getLoginPromote(); - $whiteList = [1, 8]; - $isOpenQuery = in_array($loginPromote['id'], $whiteList) || in_array($loginPromote['parent_id'], $whiteList) || in_array($loginPromote['grand_id'], $whiteList) ? true : false; - + $whiteList = [1, 8, 84]; + $isOpenQuery = in_array($loginPromote['id'], $whiteList) || in_array($loginPromote['parent_id'], $whiteList) || in_array($loginPromote['grand_id'], $whiteList) ? true : false; + if (!$isOpenQuery) { $this->display('prepare'); exit(0); @@ -100,32 +100,89 @@ 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); + + $promoteId = array(get_pid()); + + //计算当日用户充值数据 + $map['_string'] = "promote_id = {$promote_id} or tab_promote.parent_id = {$promote_id} or tab_promote.grand_id = {$promote_id} "; + + $pay_time = " between 0 and ".time(); + $spendData = $this->caculateSpend($pay_time,$map['_string']); + + $promoteId = implode(',',$promoteId); + if ($promoteId) { + $user_count = M("user", "tab_")->where("promote_id IN({$promoteId})")->count(); + } else { + $user_count = 0; + } + + $today=total(1); + $yesterdays = total(5); + $week=total(2); + $mounth=total(3); + //计算今日的统计数据 + $data=M('User','tab_') + ->field('promote_account,promote_id,date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(tab_user.id) as count, + IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1 , + count(IF(register_time '.$yesterdays.',1,null)) as yesterday, + count(IF(register_time '.$today.',1,null)) as today, + count(IF(register_time '.$week.',1,null)) as week, + count(IF(register_time '.$mounth.',1,null)) as mounth') + ->join('tab_promote on promote_id = tab_promote.id','left') + ->where($map) + ->group('promote_id1') + ->having('promote_id != 0') + ->order('count desc,register_time') + ->find(); +// echo M('User','tab_')->_sql();die(); + + $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')); + //计算昨天用户的统计数据,当日用户充值数据 + $pay_time = " between {$yesterday_start} and {$yesterday_end}"; + $createTime = ['between',array($yesterday_start,$yesterday_end-1)]; + $yesterdaySpendData = $this->caculateSpend($pay_time,$map['_string'],$createTime); + + $todayAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],1); + + $mounthAddSpendData = $this->caculateSpend($pay_time,$map['_string'],[],2); + $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); + + $this->assign('data',$data); +// $this->assign('yesterdayData',$yesterdayData); + $this->assign('spendData',$spendData); + $this->assign('yesterdaySpendData',$yesterdaySpendData); + $this->assign('todayAddSpendData',$todayAddSpendData); + $this->assign('mounthAddSpendData',$mounthAddSpendData); + - $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); $this->assign("month_add_user_money", $month_add_user_money); $this->assign("yesterday_user_regist_count", $yesterday_user_regist_count); $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 +198,94 @@ class PromoteController extends BaseController $this->display(); } - private function pay_total($type = 0, $newadd = 1) + private function caculateSpend($pay_time,$condition,$create = [],$type = 0) { + $spend=M('Spend','tab_'); + $today=total(1); + $week=total(2); + $mounth=total(3); + + $map1['promote_id'] = $map['promote_id']=array('gt',0); + $map1['pay_status'] = $map['pay_status']=1; + $map1['pay_way'] = $map['pay_way'] = array('gt',0); + $userId = []; + + $promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid()." or grand_id=". get_pid())->select(); + $promoteId = array_column($promoteId,'id'); + $promoteId = implode(',',$promoteId).",".get_pid(); + $whereUser['promote_id'] = ['IN',$promoteId]; + + if ($type == 1) { + $start = mktime(0, 0, 0, date('m'), date('d'), date('Y')); + $end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1; + $whereUser['register_time'] = ['between',array($start,$end-1)]; + $userId = M('user','tab_')->field('id')->where($whereUser)->select(); + + } else if ($type == 2) { + $start = mktime(0, 0, 0, date('m'), 1, date('Y')); + $end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1; + $whereUser['register_time'] = ['between',array($start,$end-1)]; + $userId = M('user','tab_')->field('id')->where($whereUser)->select(); + } + + $userId = implode(',',array_column($userId,'id')); + if ($userId) { + $map1['user_id'] = $map['user_id']=['IN',$userId]; + } else if (!$userId&&$type!=0) { + return array('today'=>0,'mounth'=>0); + } + + if ($create) { + $map['create_time'] = $create; + } + + $bindrecharge_data = M('bind_recharge','tab_') + ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, + floor(sum(IF(create_time '.$pay_time.',real_amount,0))*100) as scount, + floor(sum(IF(create_time '.$today.',real_amount,0))*100) as today, + floor(sum(IF(create_time '.$week.',real_amount,0))*100) as week, + floor(sum(IF(create_time '.$mounth.',real_amount,0))*100) as mounth') + ->where($map1) + ->group('promote_id') + ->select(false); + + $deposit_data = M('deposit','tab_') + ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time, + floor(sum(IF(create_time '.$pay_time.',pay_amount,0))*100) as scount, + floor(sum(IF(create_time '.$today.',pay_amount,0))*100) as today, + floor(sum(IF(create_time '.$week.',pay_amount,0))*100) as week, + floor(sum(IF(create_time '.$mounth.',pay_amount,0))*100) as mounth') +// ->join('tab_user on tab_user.id = tab_spend.user_id','left') + ->where($map1) + ->group('promote_id') + ->select(false); + + $spendData=$spend + ->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time, + floor(sum(IF(pay_time '.$pay_time.',pay_amount,0))*100) as scount, + floor(sum(IF(pay_time '.$today.',pay_amount,0))*100) as today, + floor(sum(IF(pay_time '.$week.',pay_amount,0))*100) as week, + floor(sum(IF(pay_time '.$mounth.',pay_amount,0))*100) as mounth') +// ->join('tab_user on tab_user.id = tab_spend.user_id','left') + ->where($map) + ->union(' ('.$bindrecharge_data.') ') + ->union(' ('.$deposit_data.') ') + ->group('promote_id') + ->select(false); + + $spendData = $spend->field('a.promote_account,a.promote_id,a.time,sum(a.scount) as count,sum(a.today) as today,sum(a.week) as week,sum(a.mounth) as mounth,IF(tab_promote.grand_id>0,tab_promote.grand_id,IF(tab_promote.grand_id=0 and tab_promote.parent_id >0,tab_promote.parent_id,promote_id)) as promote_id1') + ->join('tab_promote on promote_id = tab_promote.id','left') + ->where($condition) + ->table('('.$spendData.') as a')->group('promote_id1')->order('count desc,a.ordertime')->find(); + $spendData['rand']=1; + $spendData['count']=$spendData['count']/100; + $spendData['today']=$spendData['today']/100; + $spendData['week']=$spendData['week']/100; + $spendData['mounth']=$spendData['mounth']/100; + + return $spendData; + } + + 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 +299,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 +350,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 { @@ -349,7 +494,7 @@ class PromoteController extends BaseController } elseif ($type == 50) { $data_list = null; $count = 0; - } else if($type == 0) { + } /*else if($type == 0) { $field = 'id,game_name,server_name,user_account,nickname,promote_account,detail,create_time as update_time'; $data_list = M("protect_log","tab_")->field($field)->limit('0,5')->order("create_time desc")->select(); @@ -358,7 +503,7 @@ class PromoteController extends BaseController } $count = M("protect_log","tab_")->field($field)->count(); - } else { + }*/ else { $data_list = M("document", "sys_")->limit('0,50')->where("category_id=56 and status=1")->order("update_time desc")->page($page, $row)->select(); //游戏公告 $count = M("document", "sys_")->where("category_id=56 and status=1")->count(); } @@ -860,6 +1005,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..d5904928f 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(); @@ -1649,12 +1655,12 @@ class QueryController extends BaseController $result['status'] = 0; $result['data'] = []; - if (empty($relationGameId) && empty($sdkVersion)) { + if (empty($relationGameId)) { return $result; } - empty($relationGameId) || $map['relation_game_id'] = $relationGameId; - empty($sdkVersion) || $map['sdk_version'] = $sdkVersion; + $map['relation_game_id'] = intval($relationGameId); + empty($sdkVersion) || $map['sdk_version'] = intval($sdkVersion); $gameIds = M('Game', 'tab_') ->where($map) diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index 820581c44..4f7f381b8 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -33,8 +33,8 @@ class TestResourceController extends BaseController if(!empty(I('user_account'))){ $map['tab_test_resource.user_account']=['like','%'.I('user_account').'%']; } - if(!empty(I('promote_name'))){ - $map['tab_test_resource.promote_account']=['like','%'.I('promote_name').'%']; + if(!empty(I('promote_id'))){ + $map['tab_test_resource.promote_id']=I('promote_id'); } $map['user.promote_id']=session("promote_auth.pid"); @@ -45,7 +45,6 @@ class TestResourceController extends BaseController ->page($page,$row) ->order('tab_test_resource.create_time DESC') ->select(); -// echo M('test_resource','tab_')->_sql();die(); foreach ($data as $key => $value) { $data[$key]['create_time'] = date('Y-m-d H:m:i',$value['create_time']); @@ -197,6 +196,7 @@ class TestResourceController extends BaseController M('protect_log_read', 'tab_')->startTrans(); //事物 try { + $arrUserId = array_column($data,'id'); $logId = implode(',',$arrUserId); @@ -214,7 +214,7 @@ class TestResourceController extends BaseController $addData = []; $k = 0; foreach($arrUserId as $key => $value) { - if (in_array($value['id'],$upsetData)) { + if (in_array($value,$upsetData)) { continue; } else { $addData[$k]['log_id'] = $value; @@ -605,5 +605,15 @@ class TestResourceController extends BaseController $this->display(); } + public function getChildPromoteList() + { + $promoteId = intval(I('post.promote_id', 0)); + $promoteId = empty($promoteId) ? PID : $promoteId; + $promoteList = getAllPromoteListByType(3, false, $promoteId); + $data['status'] = 1; + $data['data'] = $promoteList; + + $this->ajaxReturn($data); + } } \ No newline at end of file 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..e6f4b96b8 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -5,16 +5,16 @@
diff --git a/Application/Home/View/default/Promote/msg_list.html b/Application/Home/View/default/Promote/msg_list.html index 52230b1d3..043168bad 100644 --- a/Application/Home/View/default/Promote/msg_list.html +++ b/Application/Home/View/default/Promote/msg_list.html @@ -21,11 +21,11 @@ curr">消息 - - - - - + + + + + curr">游戏活动 @@ -34,12 +34,12 @@ - curr">资源号异常日志 - + curr">资源号异常日志 +
@@ -49,7 +49,7 @@

- {$data.title} + {$data.title} {$data.title} @@ -58,11 +58,14 @@

+ +
+ {$_page} +
+
-
- {$_page} -
+
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 21ceebfe2..1c5b7af27 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/dailySummary.html b/Application/Home/View/default/Query/dailySummary.html index 2358784c8..d612be1d1 100644 --- a/Application/Home/View/default/Query/dailySummary.html +++ b/Application/Home/View/default/Query/dailySummary.html @@ -176,7 +176,7 @@
-
+
@@ -184,13 +184,13 @@ - - - - + + @@ -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 @@ - + @@ -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 @@ - + 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 @@ - + - - - + + + - - + + @@ -376,7 +382,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/view_role.html b/Application/Home/View/default/Query/view_role.html index 17e93e732..f9a0f9a0b 100644 --- a/Application/Home/View/default/Query/view_role.html +++ b/Application/Home/View/default/Query/view_role.html @@ -166,7 +166,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/TestResource/protectLogList.html b/Application/Home/View/default/TestResource/protectLogList.html index 93c8c63f1..59b3d3dfd 100644 --- a/Application/Home/View/default/TestResource/protectLogList.html +++ b/Application/Home/View/default/TestResource/protectLogList.html @@ -48,7 +48,7 @@ diff --git a/Application/Home/View/default/TestResource/supportNumberList.html b/Application/Home/View/default/TestResource/supportNumberList.html index 1843338e2..7230e7170 100644 --- a/Application/Home/View/default/TestResource/supportNumberList.html +++ b/Application/Home/View/default/TestResource/supportNumberList.html @@ -46,10 +46,13 @@
- - - + + @@ -64,9 +67,36 @@
-
- -
+ + + + + +
+ +
+
+ +
+ +
@@ -162,6 +192,7 @@ diff --git a/Application/Media/View/default/Public/base.html b/Application/Media/View/default/Public/base.html index 4e18fa2fd..bf90e22e5 100644 --- a/Application/Media/View/default/Public/base.html +++ b/Application/Media/View/default/Public/base.html @@ -229,8 +229,8 @@
-
- +
+
- - - - - - - - -
-
- 推荐产品 - +更多 -
-
-
- - -
-
-
- -
日期 创角数 创角用户新创角用户|新创角设备 + 新创角用户|新创角设备 新增创角IP 登录用户数充值人数充值次数充值总额充值人数充值次数充值总额 现金充值 通用币充值 折扣币充值 + 代金劵使用
{$vo.user_account}{$vo.user_account} {$vo.order_number} {:get_pay_way($vo['pay_way'])} {$vo.pay_amount}
{$vo.account}{$vo.account} {$vo.promote_account}({$vo.pro_real_name}) {$vo.device_number} {$vo.register_time|date='Y-m-d H:i:s',###}平台 创角数 创角用户新创角用户|新创角设备新创角用户|新创角设备 + 新增创角IP 登录用户数充值人数充值次数充值总额充值人数充值次数充值总额 现金充值 通用币充值 绑定币充值折扣币充值代金劵使用 + 折扣币充值 + + 代金劵使用 +