diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 824276b35..9f99ad237 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -243,6 +243,7 @@ class ExportController extends Controller $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); if ($promoter_ids) { $map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; + $spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") "; } } } @@ -259,24 +260,24 @@ class ExportController extends Controller // unset($_REQUEST['promote_account']); // } if (isset($_REQUEST['register_way'])) { - if($_REQUEST['type']==1) { - if ($_GET['register_way'] == 1) { - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in (0,1)'; - $maps['tab_user.register_type'] = ['in',[0,1]]; - } elseif($_GET['register_way'] == 7){ - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in(7)'; - $maps['tab_user.register_type'] = 7; - }else { - empty($hav) || $hav .= ' AND '; - $hav .= ' tab_user.register_type in(2)'; - $maps['tab_user.register_type'] = 2; - } - } else { - $map['register_way'] = I('register_way'); - unset($_REQUEST['register_way']); - } + if($_REQUEST['type']==1) { + if ($_GET['register_way'] == 1) { + empty($hav) || $hav .= ' AND '; + $hav .= ' tab_user.register_type in (0,1)'; + $maps['tab_user.register_type'] = ['in',[0,1]]; + } elseif($_GET['register_way'] == 7){ + empty($hav) || $hav .= ' AND '; + $hav .= ' tab_user.register_type in(7)'; + $maps['tab_user.register_type'] = 7; + }else { + empty($hav) || $hav .= ' AND '; + $hav .= ' tab_user.register_type in(2)'; + $maps['tab_user.register_type'] = 2; + } + } else { + $map['register_way'] = I('register_way'); + unset($_REQUEST['register_way']); + } } if (isset($_REQUEST['register_type'])) { $map['register_type'] = I('register_type'); @@ -301,16 +302,25 @@ class ExportController extends Controller $order = 'id desc'; } - if (isset($_REQUEST['viplevel'])) { + if (isset($_REQUEST['viplevel'])) { - $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']); - } + $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']); + } - $map['puid'] = array('eq',0); - $map['is_platform'] = 0; - //数据 - $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,(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') + $map['puid'] = array('eq',0); + $map['is_platform'] = 0; + if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ + $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total') + ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom) + ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false) + ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false) + ->where($map) + ->group('tab_user.id') + ->order($order) + ->having($havs) + ->select(); + }else{ + $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total') ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1') ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false) ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false) @@ -319,38 +329,42 @@ class ExportController extends Controller ->order($order) ->having($havs) ->select(); - if($xlsData) { - $ids = array_column($xlsData,'id'); - /* 在手里 */ - $small = M('user','tab_')->field('count(id) as count,puid')->where(['puid'=>array('in',$ids)])->group('puid')->select(); - /* 出售中 */ - $small2 = M('user','tab_')->field('count(id) as count,source_puid')->where(['source_puid'=>array('in',$ids),'source_time'=>0])->group('source_puid')->select(); - - foreach($xlsData as $k => $v) { - - - $xlsData[$k]['vip_level'] = get_vip_level($v['recharge_total']); - if(empty($v['alipay'])){ - $xlsData[$k]['alipay'] = '--'; - } - - $xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号'); - - $xlsData[$k]['small_count'] = 0; - foreach($small as $s) { - if($s['puid'] == $v['id']) { - $xlsData[$k]['small_count'] += $s['count'];break; - } - } - foreach($small2 as $s) { - if($s['source_puid'] == $v['id']) { - $xlsData[$k]['small_count'] += $s['count'];break; - } - } + } + //数据 + + + if($xlsData) { + $ids = array_column($xlsData,'id'); + /* 在手里 */ + $small = M('user','tab_')->field('count(id) as count,puid')->where(['puid'=>array('in',$ids)])->group('puid')->select(); + /* 出售中 */ + $small2 = M('user','tab_')->field('count(id) as count,source_puid')->where(['source_puid'=>array('in',$ids),'source_time'=>0])->group('source_puid')->select(); - } + foreach($xlsData as $k => $v) { - } + + $xlsData[$k]['vip_level'] = get_vip_level($v['recharge_total']); + if(empty($v['alipay'])){ + $xlsData[$k]['alipay'] = '--'; + } + + $xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号'); + + $xlsData[$k]['small_count'] = 0; + foreach($small as $s) { + if($s['puid'] == $v['id']) { + $xlsData[$k]['small_count'] += $s['count'];break; + } + } + foreach($small2 as $s) { + if($s['source_puid'] == $v['id']) { + $xlsData[$k]['small_count'] += $s['count'];break; + } + } + + } + + } break; case 4: diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index 3e09faff6..f53a990c8 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -26,6 +26,7 @@ class MemberController extends ThinkController 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')) . ") "; + $spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") "; } } } @@ -176,7 +177,28 @@ class MemberController extends ThinkController // ->order($order) ->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') + // $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,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($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false) + // ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false) + // ->page($page, $row) + // ->having($havs) + // ->group('a.id') + // ->order($order) + // ->select(); + if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ + $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,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'.$spendprom) + ->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false) + ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false) + ->page($page, $row) + ->having($havs) + ->group('a.id') + ->order($order) + ->select(); + // echo $data;die(); + }else{ + $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,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($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false) ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false) @@ -185,10 +207,11 @@ class MemberController extends ThinkController ->group('a.id') ->order($order) ->select(); + } + //计数 - $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') + $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total') ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1') ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false) ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false) @@ -196,6 +219,18 @@ class MemberController extends ThinkController ->group('tab_user.id') ->where($hav) ->having($havs)->select(false); + //替换为新表 + if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ + $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total') + ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom) + ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false) + ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false) + ->where($map) + ->group('tab_user.id') + ->where($hav) + ->having($havs)->select(false); + } + $jcount = M('User', 'tab_')->field('count(a.id) as count')->table('(' . $sql . ') as a')->select(); $count = $jcount[0]['count']; diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 47d5583fe..b1daad232 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -412,7 +412,8 @@ class DownloadController extends BaseController { $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $begTime = strtotime($initBegTime); $endTime = strtotime($initEndTime); - + $gameId = intval(I('game_id', 0)); + $status = intval(I('status', 0)); $map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%']; $ids = M('promote', 'tab_')->where($map)->getField('id', true); $ids[] = $this->loginPromote['id']; @@ -423,7 +424,9 @@ class DownloadController extends BaseController { if (!empty($payOrderNumber)) { $map['pay_order_number'] = $payOrderNumber; } - + if (!empty($gameId)) { + $map['game_id'] = $gameId; + } if (!empty($begTime) && empty($endTime)) { $map['pay_time'] = ['egt', $begTime]; } elseif (empty($begTime) && !empty($endTime)) { @@ -431,6 +434,22 @@ class DownloadController extends BaseController { } elseif (!empty($begTime) && !empty($endTime)) { $map['pay_time'] = ['between', [$begTime, $endTime + 86399]]; } + + if (isset($_GET['status'])) { + if ($status == -2) { + $map['selle_status'] = 0; + } else { + $withdrawMap['promote_id'] = $this->loginPromote['id']; + $withdrawMap['status'] = $status; + $withdrawIds = M('withdraw', 'tab_')->where($withdrawMap)->getField('id', true); + + if (empty($withdrawIds)) { + $map = '1 = 2'; + } else { + $map['withdraw_id'] = ['in', $withdrawIds]; + } + } + } $conditions = json_encode($map,TRUE); $addtime = time(); $data = [ diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index 605c26ad4..f8b4e8ceb 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -15,6 +15,7 @@ class FinanceController extends BaseController { //提现状态 public static $withdrawStatus = [ + -2 => '已撤销', -1 => '审核未通过', 0 => '待审核', 1 => '汇款中', @@ -200,7 +201,7 @@ class FinanceController extends BaseController $map['pay_order_number'] = $payOrderNumber; } if (isset($_GET['status'])) { - if ($status == -2) { + if ($status == -99) { $map['selle_status'] = 0; } else { $withdrawMap['promote_id'] = $this->loginPromote['id']; @@ -277,8 +278,7 @@ class FinanceController extends BaseController //是否是会长 $this->purview(); //验证安全密码 - $metaTitle = '结算明细'; - $modelList = ['财务管理', $metaTitle]; + $modelList = []; $res = $this->verifyPasswordView($modelList, false); if ($res == false) { $data['status'] = 0; @@ -329,6 +329,7 @@ class FinanceController extends BaseController $add['status'] = 0; $add['widthdraw_number'] = $this->produceWithdrawNumber(); $add['settlement_end_time'] = $thisDay - 1; + $add['spend_ids'] = ''; M()->startTrans();//开启事物 $withdrawId = M('withdraw', 'tab_')->add($add); @@ -399,11 +400,9 @@ class FinanceController extends BaseController } if (isset($_GET['status']) && $_GET['status'] !== '') { $status = intval($_GET['status']); - if (!isset(FinanceController::$withdrawStatus[$status])) { - $this->error('参数异常'); + if (isset(FinanceController::$withdrawStatus[$status])) { + $map['status'] = $status; } - - $map['status'] = $status; } $data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof') @@ -420,8 +419,15 @@ class FinanceController extends BaseController $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); $list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']); $list['status_name'] = FinanceController::$withdrawStatus[$list['status']]; - if ($list['status'] == -1) { - $list['status_name'] = '' . $list['status_name'] . ''; + switch ($list['status']) { + case -2: + $list['status_name'] = '' . $list['status_name'] . ''; + break; + case -1: + $list['status_name'] = '' . $list['status_name'] . ''; + break; + default: + break; } } } @@ -572,8 +578,7 @@ class FinanceController extends BaseController //是否是会长 $this->purview(); //验证安全密码 - $metaTitle = '结算明细'; - $modelList = ['财务管理', $metaTitle]; + $modelList = []; $res = $this->verifyPasswordView($modelList, false); if ($res == false) { $data['status'] = 0; @@ -606,4 +611,69 @@ class FinanceController extends BaseController } $this->ajaxReturn($data); } + + //撤销提现 + public function cancelWithdraw() + { + //是否是会长 + $this->purview(); + //验证安全密码 + $modelList = []; + $res = $this->verifyPasswordView($modelList, false); + if ($res == false) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + $this->ajaxReturn($data); + } + + $id = intval(I('id', 0)); + $data = M('withdraw', 'tab_')->find($id); + if (empty($data) || !in_array($data['status'], [-1, 0])) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + if ($data['promote_id'] != $this->loginPromote['id']) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + $this->ajaxReturn($data); + } + + $spendMap['withdraw_id'] = $id; + $spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true); + if (empty($spendIds)) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + $spendIds = implode(',', $spendIds); + $time = time(); + $withdrawSave['id'] = $id; + $withdrawSave['status'] = -2; + $withdrawSave['spend_ids'] = $spendIds; + $withdrawSave['last_up_update_time'] = $time; + + M('withdraw', 'tab_')->startTrans();//开启事物 + $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave); + if ($withdrawRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + $this->ajaxReturn($data); + } + + $spendSave['selle_status'] = 0; + $spendSave['withdraw_id'] = 0; + $spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave); + if ($spendRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + } else { + M('withdraw', 'tab_')->commit();//事物提交 + $data['status'] = 1; + $data['msg'] = '撤销成功'; + } + $this->ajaxReturn($data); + } } \ No newline at end of file diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index 2cbb07ea2..aefcaf46a 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -103,8 +103,8 @@
其他 - +
@@ -139,14 +139,15 @@
- 支付宝 + 支付宝 +
- 微信支付 + 微信支付
@@ -181,7 +182,7 @@
备案号:琼ICP备19000556号-1 diff --git a/Application/Mobile/View/Public/bases.html b/Application/Mobile/View/Public/bases.html index 3a03f10ac..604038c69 100644 --- a/Application/Mobile/View/Public/bases.html +++ b/Application/Mobile/View/Public/bases.html @@ -84,9 +84,6 @@ - - - + + + + + + diff --git a/Data/update.sql b/Data/update.sql index 37160f3eb..c4a608160 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -540,4 +540,10 @@ CREATE TABLE `tab_idcard_log` ( `status` tinyint(2) DEFAULT '0' COMMENT '0 认证失败 1 认证成功', `create_time` int(11) DEFAULT '0' COMMENT '创建时间', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='身份证认证信息'; \ No newline at end of file +) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='身份证认证信息'; + +--提现表添加最后更新时间 +ALTER TABLE `tab_withdraw` +ADD COLUMN `last_up_update_time` int(10) NOT NULL DEFAULT 0 COMMENT '最后更新时间', +ADD COLUMN `spend_ids` longtext NOT NULL COMMENT '充值订单id'; + diff --git a/Public/Media/css/index.css b/Public/Media/css/index.css index 46893ed82..2600eb2a2 100644 --- a/Public/Media/css/index.css +++ b/Public/Media/css/index.css @@ -55,6 +55,7 @@ top: 4.23rem; width: 2.70rem; height: 3.70rem; + z-index: 9; } .side_tabbar img{ width: 100%; diff --git a/Public/Media/images/index_about/qrcode.png b/Public/Media/images/index_about/qrcode.png index 2c41fe3b8..d33691b9b 100644 Binary files a/Public/Media/images/index_about/qrcode.png and b/Public/Media/images/index_about/qrcode.png differ diff --git a/Public/Media/js/recharge.js b/Public/Media/js/recharge.js index 600774dca..20448a92e 100644 --- a/Public/Media/js/recharge.js +++ b/Public/Media/js/recharge.js @@ -1,4 +1,5 @@ $(function() { + //钱的数量选择 $(".select-box-soon>div:not(.price-input)").click(function(){ $(this).addClass("selectBg").siblings("div").removeClass("selectBg"); @@ -22,7 +23,7 @@ $(function() { $(".way-show>div>span").text(way); $("#apitype").val($(this).data('type')); }); - + $(".way-select>div").eq(0).trigger('click'); $(".recharge-btn").click(function () { var that = $('#recharge_form'); if($.trim($("#toaccount2").val()).length == 0){