diff --git a/Application/Admin/Controller/BehaviorLogController.class.php b/Application/Admin/Controller/BehaviorLogController.class.php index b9ac94d06..5306bc473 100644 --- a/Application/Admin/Controller/BehaviorLogController.class.php +++ b/Application/Admin/Controller/BehaviorLogController.class.php @@ -5,6 +5,15 @@ namespace Admin\Controller; class BehaviorLogController extends ThinkController { + private $single_type = [ + 0 => '通知到账', + 1 => '补单', + ]; + + /** + * 游戏预下单记录 + * @return [type] [description] + */ public function game() { $params = I('get.'); @@ -67,7 +76,7 @@ class BehaviorLogController extends ThinkController $data[$k]['server_name'] = ''; $data[$k]['game_player_name'] = ''; $data[$k]['game_player_id'] = ''; - + } } $count = M('pay_info', 'tab_')->where($map)->count(); @@ -82,4 +91,77 @@ class BehaviorLogController extends ThinkController $this->display('index'); } + + /** + * 补单记录 + * @return [type] [description] + */ + public function singleSupplement() { + $p = I('get.p', 1); + $row = I('get.row', 10); + $params = I('get.'); + + if(isset($params['timestart']) && isset($params['timeend'])) { + $startTime = strtotime($params['timestart']); + $endTime = strtotime($params['timeend']) + 86399; + $map['tab_repair_pay.create_time'] = array('BETWEEN', [$startTime, $endTime]); + } + + if(isset($params['type'])) { + $map['tab_repair_pay.type'] = $params['type']; + } + + if(isset($params['pay_order_number'])) { + $map['tab_repair_pay.pay_order_number'] = $params['pay_order_number']; + } + + if(isset($params['admin_name'])) { + $map['tab_repair_pay.admin_name'] = $params['admin_name']; + } + + + if(!empty(I('get.order_number'))) { + $map['tab_spend.order_number'] = I('get.order_number'); + $data = M('repair_pay', 'tab_')->join('tab_spend on tab_spend.pay_order_number = tab_repair_pay.pay_order_number')->where($map)->page($p, $row)->order('tab_repair_pay.id DESC')->select(); + } else { + $data = M('repair_pay', 'tab_')->where($map)->page($p, $row)->order('id DESC')->select(); + } + + $show_data = []; + foreach($data as $k => $v) { + if($v['tab'] == 'spend') { + $order_detail = M('spend', 'tab_')->field('order_number,pay_time,user_account,promote_account,game_name,pay_amount,pay_way')->where(['pay_order_number' => $v['pay_order_number']])->find(); + $re_data['pay_time'] = $order_detail['pay_time']; + } elseif($v['tab'] == 'deposit') { + $order_detail = M('deposit', 'tab_')->field('order_number,create_time,user_account,promote_account,pay_amount,pay_way')->where(['pay_order_number' => $v['pay_order_number']])->find(); + $re_data['pay_time'] = $order_detail['create_time']; + } + $re_data['order_number'] = !empty($order_detail['order_number']) ? $order_detail['order_number'] : '-'; + $re_data['user_account'] = $order_detail['user_account']; + $re_data['promote_account'] = $order_detail['promote_account']; + $re_data['game_name'] = !empty($order_detail['game_name']) ? $order_detail['game_name'] : '-'; + $re_data['pay_amount'] = $order_detail['pay_amount']; + $re_data['pay_way'] = get_pay_way($order_detail['pay_way']); + $re_data['pay_order_number'] = $v['pay_order_number']; + $re_data['type'] = $this->single_type[$v['type']]; + $re_data['create_time'] = $v['create_time']; + $re_data['admin_name'] = $v['admin_name']; + $show_data[] = $re_data; + } + + if(!empty(I('get.order_number'))) { + $map['tab_spend.order_number'] = I('get.order_number'); + $count = M('repair_pay', 'tab_')->join('tab_spend on tab_spend.pay_order_number = tab_repair_pay.pay_order_number')->where($map)->count(); + } else { + $count = M('repair_pay', 'tab_')->where($map)->count(); + } + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('show_data', $show_data); + + $this->display('singleSupplement'); + + } } diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 93782c10b..2a87bac71 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -2097,6 +2097,70 @@ class ExportController extends Controller $xlsData[0]['money_all'] = $xlsData[0]['buy_num'] * 10; $xlsData[0]['authorization_all_num'] = $authorization_all_num; break; + case 25: + $xlsCell = array( + array('type', '类型'), + array('pay_order_number', '支付订单号'), + array('order_number', 'CP订单号'), + array('pay_time', '充值时间'), + array('user_account', '玩家账号'), + array('promote_account', '所属推广员'), + array('game_name', '游戏名称'), + array('pay_amount', '实付金额'), + array('pay_way', '充值方式'), + array('admin_name', '补单管理员'), + array('create_time', '补单时间'), + ); + + $params = I('get.'); + if(isset($params['timestart']) && isset($params['timeend'])) { + $startTime = strtotime($params['timestart']); + $endTime = strtotime($params['timeend']) + 86399; + $map['tab_repair_pay.create_time'] = array('BETWEEN', [$startTime, $endTime]); + } + + if(isset($params['type'])) { + $map['tab_repair_pay.type'] = $params['type']; + } + + if(isset($params['pay_order_number'])) { + $map['tab_repair_pay.pay_order_number'] = $params['pay_order_number']; + } + + if(isset($params['admin_name'])) { + $map['tab_repair_pay.admin_name'] = $params['admin_name']; + } + + + if(!empty(I('get.order_number'))) { + $map['tab_spend.order_number'] = I('get.order_number'); + $data = M('repair_pay', 'tab_')->join('tab_spend on tab_spend.pay_order_number = tab_repair_pay.pay_order_number')->where($map)->page($p, $row)->order('tab_repair_pay.id DESC')->select(); + } else { + $data = M('repair_pay', 'tab_')->where($map)->page($p, $row)->order('id DESC')->select(); + } + + $xlsData = []; + foreach($data as $k => $v) { + if($v['tab'] == 'spend') { + $order_detail = M('spend', 'tab_')->field('order_number,pay_time,user_account,promote_account,game_name,pay_amount,pay_way')->where(['pay_order_number' => $v['pay_order_number']])->find(); + $re_data['pay_time'] = set_show_time($order_detail['pay_time']); + } elseif($v['tab'] == 'deposit') { + $order_detail = M('deposit', 'tab_')->field('order_number,create_time,user_account,promote_account,pay_amount,pay_way')->where(['pay_order_number' => $v['pay_order_number']])->find(); + $re_data['pay_time'] = set_show_time($order_detail['create_time']); + } + $re_data['order_number'] = !empty($order_detail['order_number']) ? $order_detail['order_number'] : '-'; + $re_data['user_account'] = $order_detail['user_account']; + $re_data['promote_account'] = $order_detail['promote_account']; + $re_data['game_name'] = !empty($order_detail['game_name']) ? $order_detail['game_name'] : '-'; + $re_data['pay_amount'] = $order_detail['pay_amount']; + $re_data['pay_way'] = get_pay_way($order_detail['pay_way']); + $re_data['pay_order_number'] = $v['pay_order_number']; + $re_data['type'] = $v['type'] == 1 ? '补单' : '通知到账'; + $re_data['create_time'] = set_show_time($v['create_time']); + $re_data['admin_name'] = $v['admin_name']; + $xlsData[] = $re_data; + } + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/Controller/RepairController.class.php b/Application/Admin/Controller/RepairController.class.php index 2762546de..02f23d354 100644 --- a/Application/Admin/Controller/RepairController.class.php +++ b/Application/Admin/Controller/RepairController.class.php @@ -3,6 +3,7 @@ namespace Admin\Controller; use User\Api\UserApi as UserApi; use Common\Api\GameApi; +use Callback\Controller\BaseController; /** * 后台首页控制器 * @author 麦当苗儿 @@ -17,7 +18,20 @@ class RepairController extends ThinkController { $result=$game->game_pay_notify($param,1); } $spend = M('Spend',"tab_"); + if($result == "success"){ + $auth = session('user_auth'); + // 补单记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => 'spend', + 'create_time' => time(), + 'type' => 1 // 补单 + ]); + $rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1)); $this->ajaxReturn(array('status'=>1,'msg'=>'补单成功')); }else{ @@ -97,6 +111,107 @@ class RepairController extends ThinkController { } - + /** + * 游戏充值补单 + */ + public function noticePayed($orderNo, $second, $type) { + $auth = session('user_auth'); + + if (IS_AJAX) { + if ($type != 'spend' && $type != 'deposit') { + $this->ajaxReturn(['status'=>0,'msg'=>'参数有误']); + } + $tab = $type; + + if (!$orderNo || !$second) { + $this->ajaxReturn(['status'=>0,'msg'=>'参数不足']); + } + $r = D('Member')->check_sc_pwd($second); + if (!$r) { + $this->ajaxReturn(['status'=>0,'msg'=>'二级密码错误']); + } + + M($tab, 'tab_')->startTrans(); + $order = M($tab, 'tab_')->where(['pay_order_number' => $orderNo])->find(); + if ($order['pay_status'] == 1) { + M($tab, 'tab_')->rollback(); + $this->ajaxReturn(['status'=>0,'msg'=>'支付成功,无需补单']); + } + + $r = M($tab, 'tab_')->where([ + 'pay_order_number' => $orderNo, + 'pay_status' => 0 + ])->save([ + 'pay_status' => 1 + ]); + if ($r) { + + $cpFlag = 0; // 0 通知cp失败 1 成功 + // 通知cp + if ($tab == 'spend') { + $param['out_trade_no'] = $orderNo; + $game = new GameApi(); + $result=$game->game_pay_notify($param,1); + $spend = M($tab, "tab_"); + if($result == "success"){ + $rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1)); + if ($rr) { + $cpFlag = 1; + M('spend', 'tab_')->commit(); + } else { + M($tab, 'tab_')->rollback(); + $this->ajaxReturn(array('status'=>1,'msg'=>'补单失败.')); + } + }else{ + M($tab, 'tab_')->commit(); + } + } else { // deposit + M('spend', 'tab_')->commit(); + } + + // 通知到账记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => $tab, + 'create_time' => time(), + 'type' => 0 + ]); + if ($tab == 'spend' && $cpFlag === 1) { + // 补单记录 + M('repair_pay', 'tab_')->add([ + 'admin_id' => $auth['uid'], + 'admin_name' => $auth['username'], + 'pay_order_number' => $orderNo, + 'ip' => get_client_ip(), + 'tab' => $tab, + 'create_time' => time(), + 'type' => 1 + ]); + } + + // todo: 分红 上级奖励等 + if ($tab == 'spend' && $cpFlag == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功,通知CP失败!']); + } + $this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功!']); + } else { + M('spend', 'tab_')->rollback(); + $this->ajaxReturn(['status'=>0,'msg'=>'补单失败,请重试']); + } + + } + } + + /** + * 平台币充值补单 + */ + public function platform($orderNo) { + if (IS_AJAX) { + $payOrderNumber = I('request.pay_order_number'); + } + } } diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 329bcf91b..a90a2a13f 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -131,5 +131,14 @@ class SpendController extends ThinkController $this->assign('is_admin', is_administrator()); $this->display(); } + + /** + * 充值补单功能 + */ + public function order_repair() { + if (IS_AJAX) { + + } + } } diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index 3c6f02c18..f5d287b7b 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -5,6 +5,7 @@ use Admin\Model\SpendModel; use Open\Model\UserLoginRecordModel; use Admin\Model\UserPlayModel; use User\Api\UserApi as UserApi; +use GuzzleHttp\Client; /** * 后台首页控制器 @@ -113,7 +114,85 @@ class StatController extends ThinkController $this->display(); - } + } + + public function multisort($records, $column, $type = 'asc') + { + $records = index_by_column($column, $records); + // var_dump($records);die(); + if ($type == 'asc') { + ksort($records); + } else { + krsort($records); + } + return array_values($records); + } + + public function userretention() + { + $this->meta_title = '留存统计'; + $start = I('start', date('Y-m-d',strtotime('-7 day'))); + $end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end'); + $dataOrder = I('data_order', ''); + $gameId = I('game_id', 0); + + $status = true; + $data = false; + $error = ''; + if ($gameId == 0) { + $error = '请选择游戏!'; + $status = false; + } + $startTime = strtotime($start . ' 00:00:00'); + $endTime = strtotime($end . ' 23:59:59') + 1; + if ((($endTime - $startTime)/(24*3600)) > 31) { + $error = '时间间隔不能超过31天'; + $status = false; + } + if ($status) { + $client = new Client([ + 'base_uri' => C('PACKAGE_SERVER_URL'), + 'timeout' => 10.0, + ]); + $response = $client->post('/statistics/player-retention', [ + 'verify' => false, + 'form_params' => [ + 'start_time' => $start, + 'end_time' => $end, + 'promote_id' => I('promote_id', 0), + 'game_id' => $gameId, + ] + ]); + + $result = (string)$response->getBody(); + $result = json_decode($result, true); + if (!$result) { + $this->assign('error', '数据请求异常!'); + } + $data = $result['data']['records']; + $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; + foreach ($data as $key => $item) { + foreach ($dayList as $day) { + if ($item['register_count'] > 0) { + $item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; + } else { + $item['retention_day'. $day] = '--'; + } + } + $data[$key] = $item; + } + if ($dataOrder) { + $data = $this->multisort($data, $dataOrder); + } + } else { + $this->assign('error', $error); + } + + $this->assign('data', $data); + $this->meta_title = '留存统计'; + $this->display(); + } + /** * 留存统计 @@ -121,7 +200,7 @@ class StatController extends ThinkController * 06.12.3 * xmy */ - public function userretention($p = 0) + public function playerRetention($p = 0) { echo "暂不开放"; die(); diff --git a/Application/Admin/View/BehaviorLog/singleSupplement.html b/Application/Admin/View/BehaviorLog/singleSupplement.html new file mode 100644 index 000000000..28cc12552 --- /dev/null +++ b/Application/Admin/View/BehaviorLog/singleSupplement.html @@ -0,0 +1,373 @@ + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + - +
+ + +
+
+ + +
+ 搜索 +
+
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
类型支付订单号CP订单号充值时间玩家账号所属推广员游戏名称实付金额充值方式补单管理员补单时间
aOh! 暂时还没有内容!
{$vo.type}{$vo.pay_order_number}{$vo.order_number}{:set_show_time($vo['pay_time'])}{$vo.user_account}{$vo.promote_account}{$vo.game_name}{$vo.pay_amount}{$vo.pay_way}{$vo.admin_name}{:set_show_time($vo['create_time'])}
+
+
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html index e482c3a29..488c82a12 100644 --- a/Application/Admin/View/Deposit/lists.html +++ b/Application/Admin/View/Deposit/lists.html @@ -127,6 +127,7 @@ 订单状态 + 操作 @@ -168,6 +169,16 @@ {:get_info_status($data['pay_status'],9)} + + +
+ + 通知到账 + + + + @@ -397,5 +408,36 @@ // minimumResultsForSearch: Infinity, // 永久隐藏搜索框 // }); } + + // 充值补单 + $(".pay_repair").click(function () { + url = $(this).attr('href-hhh'); + data = $(this).attr('href-data'); + var pwd2 = prompt("请输入二级密码"); + if (!pwd2) { + alert("二级密码不能为空"); + return ; + } + $.ajax({ + type: 'post', + url: url, + data: {orderNo: data, second: pwd2, type: 'deposit'}, + success: function (e) { + if (e.status == 1) { + layer.msg(e.msg, {icon: 1}); + setTimeout(function () { + location.reload(); + }, 1500); + } else { + if (e.msg) { + var tip_msg = e.msg; + } else { + var tip_msg = e.info ? e.info : "补单失败"; + } + layer.msg(tip_msg, {icon: 2}); + } + }, + }); + }); diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index 3e26b5414..e4351eab5 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -224,7 +224,7 @@ + + + + + + +
+ +
+
+ +
+
+ +  -  + +
+
+ +
+
+ +
+ +
+ 搜索 +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
日期游戏名称渠道名称新增玩家1日留存2日留存3日留存4日留存5日留存6日留存7日留存15日留存30日留存
aOh! 暂时还没有内容!
{$vo.time}{$game_name}{$promote_name}{$vo.register_num}{:round($vo['1']/$vo['register_num'],4)*100}%{:round($vo['2']/$vo['register_num'],4)*100}%{:round($vo['3']/$vo['register_num'],4)*100}%{:round($vo['4']/$vo['register_num'],4)*100}%{:round($vo['5']/$vo['register_num'],4)*100}%{:round($vo['6']/$vo['register_num'],4)*100}%{:round($vo['7']/$vo['register_num'],4)*100}%{:round($vo['15']/$vo['register_num'],4)*100}%{:round($vo['30']/$vo['register_num'],4)*100}%
+
+
+
+ 导出 + {$_page|default=''} +
+ + + + + + +if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Data/update.sql b/Data/update.sql index 1dca7f650..9ca70f829 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -737,6 +737,7 @@ CREATE TABLE `tab_test_white_list` ( --游戏添加落地页视频封面 ALTER TABLE `tab_game` ADD COLUMN `flooring_page_video_cover` int(11) NOT NULL DEFAULT 0 COMMENT '落地页视频封面'; + --2019-12-11 超级签新增充值方式 chenzhi ALTER TABLE `tab_game_supersign` ADD COLUMN `pay_way` tinyint(2) DEFAULT '0' COMMENT '充值方式(0:未知,1:支付宝,2:微信)' AFTER `pay_time`; @@ -863,4 +864,33 @@ DROP INDEX o ON tab_spend; ALTER TABLE tab_spend ADD INDEX o(pay_status, is_check, settle_check, promote_id); ALTER TABLE tab_user_login_record ADD INDEX user_id_promote_idx(user_id, promote_id); +CREATE TABLE `tab_player_retention` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) not null COMMENT '用户ID', + `game_id` int(11) NOT NULL COMMENT '游戏ID', + `player_id` int(11) NOT NULL COMMENT '玩家ID', + `day1` tinyint(1) NOT NULL default 0 COMMENT '是否1日留存', + `day2` tinyint(1) NOT NULL default 0 COMMENT '是否2日留存', + `day3` tinyint(1) NOT NULL default 0 COMMENT '是否3日留存', + `day4` tinyint(1) NOT NULL default 0 COMMENT '是否4日留存', + `day5` tinyint(1) NOT NULL default 0 COMMENT '是否5日留存', + `day6` tinyint(1) NOT NULL default 0 COMMENT '是否6日留存', + `day7` tinyint(1) NOT NULL default 0 COMMENT '是否7日留存', + `day15` tinyint(1) NOT NULL default 0 COMMENT '是否15日留存', + `day30` tinyint(1) NOT NULL default 0 COMMENT '是否30日留存', + PRIMARY KEY (`id`), + KEY `index_game_id` (`game_id`), + KEY `index_user_id` (`user_id`), + KEY `index_player_id` (`player_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户留存率'; +-- 玩家注册时间 +ALTER TABLE `tab_user_play` +ADD COLUMN `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '玩家注册时间'; + +update tab_user_play a left join tab_user b on a.user_id= b.id set a.create_time = b.register_time where a.user_id=b.id; +ALTER TABLE `tab_spend` +ADD COLUMN `event_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '事件是否通知'; + +-- 菜单添加补单记录 +INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('补单记录管理', 137, 0, 'BehaviorLog/singleSupplement', 0, '', '游戏订单', 0, 1);