diff --git a/Application/Admin/Controller/PayChannelIntentionController.class.php b/Application/Admin/Controller/PayChannelIntentionController.class.php new file mode 100644 index 000000000..d89f5ef4f --- /dev/null +++ b/Application/Admin/Controller/PayChannelIntentionController.class.php @@ -0,0 +1,511 @@ + +// +---------------------------------------------------------------------- + +namespace Admin\Controller; + +use User\Api\UserApi; +use Com\Wechat; +use Com\WechatAuth; + +/** + * 后台用户控制器 + * @author 麦当苗儿 + */ +class PayChannelIntentionController extends AdminController +{ + + public static $arr_pay_way = ['alipay'=>'支付宝','wxpay'=>'微信支付','sqpay'=>'双乾快捷支付','yeepay'=>'易宝支付']; + + public function index($p = 0) { + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $map = []; + + if ($_REQUEST['timestart']&&!$_REQUEST['timeend']) { + $map['create_time'] = ['egt',strtotime($_REQUEST['timestart'])]; + } + + if (!$_REQUEST['timestart']&&$_REQUEST['timeend']) { + $map['create_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399]; + } + + if ($_REQUEST['timestart']&&$_REQUEST['timeend']) { + $map['create_time'] = ['between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]]; +// $map['create_time'] = ['elt',strtotime($_REQUEST['time_end'])]; + } + + if ($_REQUEST['pay_type']) { + $map['pay_ways'] = ['like',"%,{$_REQUEST['pay_type']}"]; + } + + $show_data = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways,tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount,CASE WHEN is_submit = 0 THEN 2 ELSE pay_status END as pay_status,tab_pay_channel_intention.pay_order_number') +// ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + + $data = M()->table('('.$show_data.') as a') + ->field('pay_ways,user_account,pay_status, + SUM(if(pay_status=0,pay_amount,0)) fail_invest_amount, + SUM(if(pay_status=1,pay_amount,0)) success_invest_amount, + SUM(if(pay_status=2,pay_amount,0)) nothing_invest_amount, + count(if(pay_status=0,pay_amount,null)) fail_invest_count, + count(if(pay_status=1,pay_amount,null)) success_invest_count, + count(if(pay_status=2,pay_amount,null)) nothing_invest_count') + ->where($map) + ->group('a.pay_ways,a.user_account,a.pay_status') + ->select(false); + + $data = M()->table('('.$data.') as a') + ->field('pay_ways,sum(fail_invest_amount) fail_invest_amount, + sum(success_invest_amount) success_invest_amount, + sum(nothing_invest_amount) nothing_invest_amount, + count(if(pay_status=0,fail_invest_count,NULL)) fail_invest_count, + count(if(pay_status=1,success_invest_count,NULL)) success_invest_count, + count(if(pay_status=2,nothing_invest_count,NULL)) nothing_invest_count') + ->page($page,$row) + ->where($map) + ->group('a.pay_ways') + ->select(); + + + $sum = M()->table('('.$show_data.') as a') + ->field('pay_ways,user_account,pay_status, + SUM(if(pay_status=0,pay_amount,0)) fail_invest_amount, + SUM(if(pay_status=1,pay_amount,0)) success_invest_amount, + SUM(if(pay_status=2,pay_amount,0)) nothing_invest_amount, + count(if(pay_status=0,pay_amount,null)) fail_invest_count, + count(if(pay_status=1,pay_amount,null)) success_invest_count, + count(if(pay_status=2,pay_amount,null)) nothing_invest_count') + ->group('a.user_account,a.pay_status') + ->select(false); + + $sum = M()->table('('.$sum.') as a') + ->field('pay_ways,sum(fail_invest_amount) fail_invest_amount, + sum(success_invest_amount) success_invest_amount, + sum(nothing_invest_amount) nothing_invest_amount, + count(if(pay_status=0,fail_invest_count,NULL)) fail_invest_count, + count(if(pay_status=1,success_invest_count,NULL)) success_invest_count, + count(if(pay_status=2,nothing_invest_count,NULL)) nothing_invest_count') + ->where($map) + ->find(); + + + $this->assign('sum',$sum); + + $count = M()->table('('.$show_data.') as a') + ->field('count(pay_amount) count') + ->group('a.pay_ways') + ->select(false); + + $count = M()->table('('.$count.') as a')->count(); + + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page);//分页 + } + + foreach($data as $key => $value) { + + $arr = explode(',',$data[$key]['pay_ways']); + + $data[$key]['pay_way'] = self::$arr_pay_way[end($arr)]; + + $data[$key]['pay_ways_ch'] = ''; + foreach ($arr as $k=>$v) { + $data[$key]['pay_ways_ch'] = $data[$key]['pay_ways_ch'].($k+1).','.self::$arr_pay_way[$v]; + + } + } + + $this->assign('data',$data); + + $this->display(); + + } + + public function export_index() { + + $xlsName = '支付意向统计导出'; + + $xlsCell = array( + "充值点击行为", "最终使用方式", '充值成功用户数', '充值成功金额(汇总)', + '下单未支付用户数', '下单未支付用户数金额(汇总)', '充值失败用户数', '充值失败金额(汇总)' + ); + + $map = []; + + if ($_REQUEST['timestart']&&!$_REQUEST['timeend']) { + $map['create_time'] = ['egt',strtotime($_REQUEST['timestart'])]; + } + + if (!$_REQUEST['timestart']&&$_REQUEST['timeend']) { + $map['create_time'] = ['elt',strtotime($_REQUEST['timeend'])+86399]; + } + + if ($_REQUEST['timestart']&&$_REQUEST['timeend']) { + $map['create_time'] = ['between',[strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+86399]]; +// $map['create_time'] = ['elt',strtotime($_REQUEST['time_end'])]; + } + + if ($_REQUEST['pay_type']) { + $map['pay_ways'] = ['like',"%,{$_REQUEST['pay_type']}"]; + } + + $show_data = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways,tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount,CASE WHEN pay_status is null THEN 2 ELSE pay_status END as pay_status,tab_pay_channel_intention.pay_order_number') + ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + + $count = M()->table('('.$show_data.') as a') + ->field('count(pay_amount) count') + ->group('a.pay_ways') + ->select(false); + + $accessNum = M()->table('('.$count.') as a')->count(); + + $perSize = 2000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + + for($i = 1; $i <= $pages; $i++) { + + + $xlsData = M()->table('('.$show_data.') as a') + ->field('"" as pay_ways_ch,"" as pay_way,pay_ways,user_account, + count(if(pay_status=1,pay_amount,null)) success_invest_count, + SUM(if(pay_status=1,pay_amount,0)) success_invest_amount, + count(if(pay_status=2,pay_amount,null)) nothing_invest_count, + SUM(if(pay_status=2,pay_amount,0)) nothing_invest_amount, + count(if(pay_status=0,pay_amount,null)) fail_invest_count, + SUM(if(pay_status=0,pay_amount,0)) fail_invest_amount') + ->limit(($i-1)*$perSize ,$perSize) + ->where($map) + ->group('a.pay_ways,a.user_account,a.pay_status') + ->select(); + + + foreach($xlsData as $key =>$value) { + $arr = explode(',',$value['pay_ways']); + + $value['pay_way'] = self::$arr_pay_way[end($arr)]; + + + + $value['pay_ways_ch'] = ''; + foreach ($arr as $k=>$v) { + $value['pay_ways_ch'] = $value['pay_ways_ch'].($k+1).','.self::$arr_pay_way[$v]; + + } + + unset($value['pay_ways']); + unset($value['user_account']); + + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + } + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + + $sum = M()->table('('.$show_data.') as a') + ->field('pay_ways,user_account, + SUM(if(pay_status=0,pay_amount,0)) fail_invest_amount, + SUM(if(pay_status=1,pay_amount,0)) success_invest_amount, + SUM(if(pay_status=2,pay_amount,0)) nothing_invest_amount, + count(if(pay_status=0,pay_amount,null)) fail_invest_count, + count(if(pay_status=1,pay_amount,null)) success_invest_count, + count(if(pay_status=2,pay_amount,null)) nothing_invest_count') + ->group('a.pay_ways') + ->select(false); + + $sum = M()->table('('.$sum.') as a') + ->field('"" as pay_ways_ch,"" as pay_way, + sum(success_invest_count) success_invest_count, + sum(success_invest_amount) success_invest_amount, + sum(nothing_invest_count) nothing_invest_count, + sum(nothing_invest_amount) nothing_invest_amount, + sum(fail_invest_count) fail_invest_count, + sum(fail_invest_amount) fail_invest_amount') + ->find(); + mb_convert_variables('GBK', 'UTF-8', $sum); + fputcsv($fp, $sum); +//刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + + fclose($fp); + + $getData = $_GET; + unset($getData['id']); + unset($getData['xlsname']); + + } + + public function detail($p = 0) { + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + + $map = []; + + if ($_REQUEST['pay_ways']) { + $map['pay_ways'] = $_REQUEST['pay_ways']; + } + + if ($_REQUEST['user_account']) { + $map['user_account'] = $_REQUEST['user_account']; + } + + if ($_REQUEST['pay_status'] || $_REQUEST['pay_status'] == '0') { + $map['pay_status'] = $_REQUEST['pay_status']; + if ($_REQUEST['pay_status'] == 3) { + $map['pay_status'] = 1; + $map['pay_game_status'] = 1; + } + } + + $data = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways, + count(if(tab_pay_channel_intention.pay_way="alipay",tab_pay_channel_intention.pay_way,null)) alipay, + count(if(tab_pay_channel_intention.pay_way="wxpay",tab_pay_channel_intention.pay_way,null)) wxpay, + count(if(tab_pay_channel_intention.pay_way="sqshorcut",tab_pay_channel_intention.pay_way,null)) sqshorcut, + count(if(tab_pay_channel_intention.pay_way="shorcut",tab_pay_channel_intention.pay_way,null)) shorcut, + tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_status END as pay_status, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_game_status END as pay_game_status, + tab_pay_channel_intention.pay_order_number,tab_pay_channel_intention.create_time') +// ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + +// var_dump($data);die(); + + $count = M()->table('('.$data.') as a') + ->where($map) + ->count(); + + $data = M()->table('('.$data.') as a') + ->page($page,$row) + ->where($map) + ->select(); + + + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page);//分页 + } + + $sum = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways, + count(if(tab_pay_channel_intention.pay_way="alipay",tab_pay_channel_intention.pay_way,null)) alipay, + count(if(tab_pay_channel_intention.pay_way="wxpay",tab_pay_channel_intention.pay_way,null)) wxpay, + count(if(tab_pay_channel_intention.pay_way="sqshorcut",tab_pay_channel_intention.pay_way,null)) sqshorcut, + count(if(tab_pay_channel_intention.pay_way="shorcut",tab_pay_channel_intention.pay_way,null)) shorcut, + tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_status END as pay_status, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_game_status END as pay_game_status, + tab_pay_channel_intention.pay_order_number,tab_pay_channel_intention.create_time') +// ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + + $sum = M()->table('('.$sum.') as a') + ->field("sum(pay_amount) pay_amount,sum(alipay) alipay,sum(wxpay) wxpay,sum(sqshorcut) sqshorcut,sum(shorcut) shorcut") + ->where($map) + ->find(); + + foreach ($data as $key => $value) { + + $data[$key]['create_time'] = date('Y-m-d H:i:s',$data[$key]['create_time']); + + } + + $this->assign('data',$data); + $this->assign('sum',$sum); + + $this->display(); + + } + + public function export_detail() { + + $xlsName = '支付意向统计详情导出'; + + $xlsCell = array( + "用户", "充值金额", '支付宝', '微信', + '易宝', '双乾快捷支付', '时间', '支付状态', '关联订单' + ); + + $map = []; + + if ($_REQUEST['pay_ways']) { + $map['pay_ways'] = $_REQUEST['pay_ways']; + } + + if ($_REQUEST['user_account']) { + $map['user_account'] = $_REQUEST['user_account']; + } + + if ($_REQUEST['pay_status'] || $_REQUEST['pay_status'] == '0') { + $map['pay_status'] = $_REQUEST['pay_status']; + if ($_REQUEST['pay_status'] == 3) { + $map['pay_status'] = 1; + $map['pay_game_status'] = 1; + } + } + + $data = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways, + count(if(tab_pay_channel_intention.pay_way="alipay",tab_pay_channel_intention.pay_way,null)) alipay, + count(if(tab_pay_channel_intention.pay_way="wxpay",tab_pay_channel_intention.pay_way,null)) wxpay, + count(if(tab_pay_channel_intention.pay_way="sqshorcut",tab_pay_channel_intention.pay_way,null)) sqshorcut, + count(if(tab_pay_channel_intention.pay_way="shorcut",tab_pay_channel_intention.pay_way,null)) shorcut, + tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_status END as pay_status, + CASE WHEN is_submit = 0 THEN 2 ELSE pay_game_status END as pay_game_status, + tab_pay_channel_intention.pay_order_number,tab_pay_channel_intention.create_time') +// ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + $accessNum = M()->table('('.$data.') as a') + ->where($map) + ->count(); + + $perSize = 2000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + + for($i = 1; $i <= $pages; $i++) { + + $xlsData = M()->table('('.$data.') as a') + ->field('user_account,pay_amount,alipay,wxpay,shorcut,sqshorcut,create_time,pay_status,pay_game_status,pay_order_number') + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->select(); + + + foreach($xlsData as $key =>$value) { + + if ($value['pay_status'] == 0) { + $value['pay_status'] = '支付失败'; + } else if($value['pay_status'] == 1) { + $value['pay_status'] = '支付成功'; + } else if($value['pay_status'] == 2) { + $value['pay_status'] = '下单未支付'; + } + + if ($value['pay_game_status'] == 0) { + $value['pay_status'] .= '通知失败'; + } else if($value['pay_game_status'] == 1) { + $value['pay_status'] .= '通知成功'; + } else if($value['pay_game_status'] == 2) { + $value['pay_status'] .= '未通知'; + } + unset($value['pay_game_status']); + + $value['create_time'] = date('Y-m-d H:i:s',$value['create_time']); +// var_dump($value);die(); + + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + } + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + + $sum = M('pay_channel_intention','tab_') + ->field('group_concat(tab_pay_channel_intention.`pay_way` ORDER BY tab_pay_channel_intention.create_time ASC) as pay_ways, + count(if(tab_pay_channel_intention.pay_way="alipay",tab_pay_channel_intention.pay_way,null)) alipay, + count(if(tab_pay_channel_intention.pay_way="wxpay",tab_pay_channel_intention.pay_way,null)) wxpay, + count(if(tab_pay_channel_intention.pay_way="sqshorcut",tab_pay_channel_intention.pay_way,null)) sqshorcut, + count(if(tab_pay_channel_intention.pay_way="shorcut",tab_pay_channel_intention.pay_way,null)) shorcut, + tab_pay_channel_intention.user_account, + tab_pay_channel_intention.pay_amount, + CASE WHEN pay_status is null THEN 2 ELSE pay_status END as pay_status, + CASE WHEN pay_game_status is null THEN 2 ELSE pay_game_status END as pay_game_status, + tab_pay_channel_intention.pay_order_number,tab_pay_channel_intention.create_time') +// ->join('left join tab_spend on tab_pay_channel_intention.pay_order_number=tab_spend.pay_order_number') + ->group('tab_pay_channel_intention.pay_order_number') + ->order('tab_pay_channel_intention.create_time ASC') + ->select(false); + + $sum = M()->table('('.$sum.') as a') + ->field("'汇总(检索时间内所有数据的统计)' as user_account,sum(pay_amount) pay_amount,sum(alipay) alipay,sum(wxpay) wxpay,sum(sqshorcut) sqshorcut,sum(shorcut) shorcut") + ->where($map) + ->find(); + + mb_convert_variables('GBK', 'UTF-8', $sum); + fputcsv($fp, $sum); +//刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + + fclose($fp); + + $getData = $_GET; + unset($getData['id']); + unset($getData['xlsname']); + + } + +} \ No newline at end of file diff --git a/Application/Admin/Controller/UserPayWhiteListController.class.php b/Application/Admin/Controller/UserPayWhiteListController.class.php new file mode 100644 index 000000000..804db6448 --- /dev/null +++ b/Application/Admin/Controller/UserPayWhiteListController.class.php @@ -0,0 +1,230 @@ +field('show_data')->where(array('id'=>$group_id))->find(); + + if (($empower_type['show_data']==1||$group_id==1)) { + $this->assign('show',1); + } + + if ($_REQUEST['show']&&($empower_type['show_data']==1||$group_id==1)) { + + $data = M('user_pay_whitelist','tab_')->where($map) + ->page($page,$row) + ->order('update_time DESC') + ->select(); + + foreach ($data as $key => $value) { + if ($value['status']==2) { + $data[$key]['time_status'] = '永久'; + } else { + $data[$key]['time_status'] = '有效期至'.date('Y-m-d H:i:s',$value['update_time']+$value['time']); + } + + $data[$key]['update_time'] = date('Y-m-d H:i:s',$value['update_time']); + + } + + $count = M('user_pay_whitelist','tab_')->where($map)->count(); + + $this->assign('data',$data); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + } + + $this->assign('data',$data); + $this->meta_title = '玩家支付限制白名单'; + + $this->display(); + + } + + public function export() { + + $xlsName = '支付限制白名单账号导出'; + + $xlsCell = array( + "序号", "账号", '状态', '有效日期', + '时间' + ); + + $map = []; + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + + $accessNum = M('user_pay_whitelist','tab_')->where($map)->count(); + + $perSize = 2000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + + for($i = 1; $i <= $pages; $i++) { + + + $xlsData = M('user_pay_whitelist','tab_') + ->field("id,user_account,status,'' as time_status,update_time,time") + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->order('update_time DESC') + ->select(); + + foreach ($xlsData as $key => $value) { + if ($value['status']==2) { + $value['time_status'] = '永久'; + $value['status'] = '永久'; + } else if($value['status']==1){ + $value['time_status'] = '有效期至'.date('Y-m-d H:i:s',$value['update_time']+$value['time']); + $value['status'] = '30天允许支付'; + } else { + $value['time_status'] = '有效期至'.date('Y-m-d H:i:s',$value['update_time']+$value['time']); + $value['status'] = '7天允许支付'; + } + unset($value['time']); + + $value['update_time'] = date('Y-m-d H:i:s',$value['update_time']); + + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + + } + + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + + fclose($fp); + + $getData = $_GET; + unset($getData['id']); + unset($getData['xlsname']); + + } + + public function add() { + + if (IS_POST) { + + $post = $_POST; + + if($post['account']!=$post['account_check']) { + $this->ajaxReturn(['status'=>0,'msg'=>'两次输入不一致']); + exit(); + } + + $hav_user = M('user','tab_')->where(['account'=>$post['account']])->find(); + + if(!$hav_user) { + $this->ajaxReturn(['status'=>0,'msg'=>'账号不存在']); + exit(); + } + + $whiteList = M('user_pay_whitelist','tab_')->where(['user_id'=>$hav_user['id']])->find(); + + $insert = []; + + $insert['user_id'] = $hav_user['id']; + $insert['user_account'] = $hav_user['account']; + + if(!$whiteList) { + + $insert['status'] = 0; + $insert['time'] = 7*86400; + $insert['create_time'] = time(); + $insert['update_time'] = time(); + + $is_success = M('user_pay_whitelist','tab_')->add($insert); + + } else { + $insert['update_time'] = time(); + if($whiteList['status']==0) { + $insert['status'] = 1; + $insert['time'] = 30*86400; + } elseif($whiteList['status']==1) { + $insert['status'] = 2; + $insert['time'] = 1; + + } + + if($whiteList['status']==2) { + $this->ajaxReturn(['status'=>0,'msg'=>'该账号已经是永久无需再进行操作']); + exit(); + } + + $is_success = M('user_pay_whitelist','tab_')->where(['user_id'=>$hav_user['id']])->save($insert); + } + + if($is_success) { + $this->ajaxReturn(['status'=>1,'msg'=>'操作成功']); + exit(); + } else { + $this->ajaxReturn(['status'=>0,'msg'=>'操作失败']); + exit(); + } + + } + + $this->meta_title = '新增支付限制白名单账号'; + + $this->display(); + + } + + public function del() { + + if (!$_REQUEST['id']) { + $this->ajaxReturn(['status'=>0,'msg'=>'id不能为空']); + exit(); + } + + $is_del = M('user_pay_whitelist','tab_')->where(['id'=>$_REQUEST['id']])->delete(); + + if($is_del) { + $this->ajaxReturn(['status'=>1,'msg'=>'删除成功']); + exit(); + } else { + $this->ajaxReturn(['status'=>0,'msg'=>'删除失败']); + exit(); + } + + } + + + +} diff --git a/Application/Admin/View/PayChannelIntention/detail.html b/Application/Admin/View/PayChannelIntention/detail.html new file mode 100644 index 000000000..8e5926099 --- /dev/null +++ b/Application/Admin/View/PayChannelIntention/detail.html @@ -0,0 +1,586 @@ + + + + + + + + + + +
+ + +
+ + +
+ 返回 +
+ +
+ +
+ + + +
+ +
+ +
+ + - +
+ + +
+
+ + +
+ 搜索 +
+ +
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号用户充值金额支付宝微信易宝双乾快捷支付时间支付状态关联订单
aOh! 暂时还没有内容!
{$index}{$data.user_account}{$data.pay_amount}{$data.alipay}{$data.wxpay}{$data.shorcut}{$data.sqshorcut}{$data.create_time} 支付失败 下单未支付 支付成功
+ 通知失败 未通知 通知成功
{$data.pay_order_number}
汇总(检索时间内所有数据的统计){$sum.pay_amount}{$sum.alipay}{$sum.wxpay}{$sum.shorcut}{$sum.sqshorcut}
+
+
+
+
+ + 导出 + + + {$_page|default=''} +
+ +
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/PayChannelIntention/index.html b/Application/Admin/View/PayChannelIntention/index.html new file mode 100644 index 000000000..19612b864 --- /dev/null +++ b/Application/Admin/View/PayChannelIntention/index.html @@ -0,0 +1,601 @@ + + + + + + + + + + +
+ + +
+ + +
+ +
+ +
+ + - +
+ + +
+
+ + +
+ 搜索 +
+ +
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号充值点击行为最终使用方式充值成功用户数充值成功金额(汇总)下单未支付用户数下单未支付用户数金额(汇总)充值失败用户数充值失败金额(汇总)
aOh! 暂时还没有内容!
{$index}{$data.pay_ways_ch}{$data.pay_way}{$data.success_invest_count}{$data.success_invest_amount}{$data.nothing_invest_count}{$data.nothing_invest_amount}{$data.fail_invest_count}{$data.fail_invest_amount}
汇总(检索时间内所有数据的统计){$sum.success_invest_count}{$sum.success_invest_amount}{$sum.nothing_invest_count}{$sum.nothing_invest_amount}{$sum.fail_invest_count}{$sum.fail_invest_amount}
+
+
+
+
+ + 导出 + + + {$_page|default=''} +
+ +
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Application/Admin/View/UserPayWhiteList/add.html b/Application/Admin/View/UserPayWhiteList/add.html new file mode 100644 index 000000000..9ea115432 --- /dev/null +++ b/Application/Admin/View/UserPayWhiteList/add.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+ + + + + + + + + + + + + + + +
账号: + + +
账号确认: + + +
+
+ +
+ + + 返回 + +
+
+
+
+ + + +
+ + + + + + + diff --git a/Application/Admin/View/UserPayWhiteList/index.html b/Application/Admin/View/UserPayWhiteList/index.html new file mode 100644 index 000000000..07fbecc88 --- /dev/null +++ b/Application/Admin/View/UserPayWhiteList/index.html @@ -0,0 +1,657 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号账号状态有效时间时间操作
aOh! 暂时还没有内容!
+ {$data.id}{$data.user_account}7天允许支付30天允许支付永久允许支付{$data.time_status}{$data.update_time}删除
+
+ +
+
+
+ 导出 + {$_page|default=''} +
+ + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + diff --git a/Data/update.sql b/Data/update.sql index d8137b933..8a262d8c6 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1496,3 +1496,30 @@ ALTER TABLE `tab_user` ADD INDEX `index_device_ip` (`device_number`, `last_login_ip`) USING BTREE ; ALTER TABLE `tab_user` ADD COLUMN `is_repeat` tinyint(1) not null default 0 comment '是否重复用户[设备/IP]'; + +-- 添加支付白名单表与支付渠道意向表 zyx 2020/03/23 +CREATE TABLE `tab_user_pay_whitelist` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户id', + `user_account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户账号', + `status` tinyint(2) NULL DEFAULT 0 COMMENT '状态 0:7日有效 1:30日有效 2:永久有效', + `update_time` int(11) NULL DEFAULT 0 COMMENT '更新时间', + `create_time` int(11) NULL DEFAULT 0 COMMENT '创建时间', + `time` int(11) NULL DEFAULT 0 COMMENT '有效时间 单位秒 1表示永久有效', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic; + +CREATE TABLE `tab_pay_channel_intention` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户id', + `user_account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '用户账号', + `pay_way` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '1' COMMENT '1:alipay:支付宝,2:wxpay:微信 3:sqshorcut:双乾支付 4:shorcut:易宝支付', + `pay_amount` int(11) NULL DEFAULT 0 COMMENT '支付金额', + `pay_order_number` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '支付订单号', + `create_time` int(11) NULL DEFAULT 0 COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic; +ALTER TABLE `tab_pay_channel_intention` +ADD COLUMN `pay_status` tinyint(2) NULL DEFAULT 0 COMMENT '支付状态 0未支付 1已支付' AFTER `create_time`; +ALTER TABLE `tab_pay_channel_intention` +ADD COLUMN `pay_game_status` tinyint(2) NULL DEFAULT 0 COMMENT '支付状态 0未支付 1已支付' AFTER `create_time`; \ No newline at end of file