diff --git a/Application/Admin/View/BehaviorLog/index.html b/Application/Admin/View/BehaviorLog/index.html
index 0ee33fb7f..446c5a642 100644
--- a/Application/Admin/View/BehaviorLog/index.html
+++ b/Application/Admin/View/BehaviorLog/index.html
@@ -29,8 +29,8 @@
diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php
index b19f68679..45a84c811 100644
--- a/Application/Home/Controller/DownloadController.class.php
+++ b/Application/Home/Controller/DownloadController.class.php
@@ -1133,6 +1133,83 @@ class DownloadController extends BaseController {
}
$this->success('添加下载成功',U('listsIndex'));
}
+
+ public function players_data_export() {
+ $begTime = I('begtime');
+ $endTime = I('endtime');
+ $map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
+ $rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
+ $childPromoteIds = '';
+ if(empty($rs)) {
+ $map['tab_pay_info.promote_id'] = PID;
+ }else {
+ foreach ($rs as $rsKey => $rsValue) {
+ $id = $rsValue['id'];
+ $childPromoteIds .= $id.',';
+ }
+ $childPromoteIds = rtrim($childPromoteIds, ',');
+ $childPromoteIds .= ',' . PID;
+ $map['tab_pay_info.promote_id'] = ['in', $childPromoteIds];
+ }
+
+ $levelPromote = $this->getLevelPromote();
+ $queryPromote = $this->getQueryPromote($levelPromote);
+ $map2[] = [
+ '_logic' => 'or',
+ 'id' => $queryPromote['id'],
+ 'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
+ ];
+ $ids = M('promote', 'tab_')->where($map2)->getField('id', true);
+ if(empty($ids)) {
+ $ids = array();
+ }
+ if(empty($levelPromote)) {
+ array_push($ids,PID);
+
+ }
+ array_push($ids,$queryPromote['id']);
+ if (!empty($ids)) {
+ $map['tab_pay_info.promote_id'] = ['in',$ids];
+
+ }else {
+ $map['_string'] = '1<>1';
+ }
+
+ empty(I('relation_game_id')) || $map['tab_pay_info.relation_game_id'] = I('relation_game_id');
+ empty(I('sdk_version')) || $map['tab_pay_info.sdk_version'] = I('sdk_version');
+ empty(I('server_id')) || $map['tab_pay_info.server_id'] = I('server_id');
+ empty(I('game_player_name')) || $map['tab_pay_info.game_player_name'] = ['like', '%' . I('game_player_name') . '%'];
+ empty(I('user_account')) || $map['tab_pay_info.user_account'] = ['like', '%' . I('user_account') . '%'];
+ empty(I('extend')) || $map['tab_pay_info.extend'] = I('extend');
+ empty(I('user_id')) || $map['tab_pay_info.user_id'] = I('user_id');
+ if (!empty($begTime) && !empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['between', [strtotime($begTime), strtotime($endTime) - 1]];
+ }else if (empty($begTime) && !empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['elt',strtotime($endTime)];
+ }else if (!empty($begTime) && empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['EGT',strtotime($begTime)];
+ }
+
+ $conditions = json_encode($map,TRUE);
+ $addtime = time();
+ $data = [
+ 'logid' => 'players_'.time(),
+ 'promote_id' => PID,
+ 'type' => '/Home/Players/playaction',
+ 'dataname' => '玩家行为日志',
+ 'status' => 0,
+ 'addtime' => $addtime,
+ 'begintime' => 0,
+ 'content' => '',
+ 'conditions' =>$conditions
+ ];
+ $res = M('downloadlog','tab_')->add($data);
+ if (!$res) {
+ // $this->ajaxReturn(array("status" => -1, "msg" => "添加导出日志失败", 'ret' => $res));
+ $this->error('添加下载失败');
+ }
+ $this->success('添加下载成功',U('listsIndex'));
+ }
/**
* 充值明细添加下载
* @author sunke
@@ -1761,11 +1838,73 @@ class DownloadController extends BaseController {
case "平台币充值":
$this->orderlistExcelInfo($id,$map);
break;
+ case "玩家行为日志";
+ $this->playactionExcelInfo($id,$map);
+ break;
default:
break;
}
}
+
+ public function playactionExcelInfo($id,$map) {
+ $xlsName = "玩家行为日志";
+ $xlsCell = array(
+ 'cp订单号',
+ '充值时间',
+ '玩家账号',
+ '游戏名称',
+ '所属推广员',
+ '游戏区服',
+ '角色ID',
+ '角色名称',
+ '订单金额'
+ );
+ $model = M('pay_info','tab_');
+ $data1 = $model->field('id')->where($map)->select();
+ $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('gb2312', 'UTF-8', $xlsCell);
+ fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
+ $accessNum = '100000';//从数据库获取总量,假设是十万
+ $accessNum = count($data1)?:0 ;
+
+ $perSize = 5000;//每次查询的条数
+ $pages = ceil($accessNum / $perSize);
+ for($i = 1; $i <= $pages; $i++) {
+ $data = $model->where($map)->order('tab_pay_info.create_time desc')
+ ->limit(($i-1)*$perSize ,$perSize)->select();
+ foreach($data as $key => $v) {
+ $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
+ $promoteInfo = M('promote','tab_')->field("nickname")->where(['id' => intval($v['promote_id'])])->find();
+ $v['promote_id']= $promoteInfo['nickname'];
+ $csvData['extend'] = $this->encryption($v['extend']);
+ $csvData['create_time'] = $v['create_time'];
+ $csvData['user_account'] = $v['user_account'];
+ $csvData['game_name'] = $v['game_name'];
+ $csvData['promote_id'] = $v['promote_id'];
+ $csvData['server_name'] = $v['server_name'];
+ $csvData['user_id'] = $v['user_id'];
+ $csvData['game_player_name'] = $v['game_player_name'];
+ $csvData['price'] = $v['price'];
+ mb_convert_variables('GBK', 'UTF-8', $csvData);
+ fputcsv($fp, $csvData);
+ }
+ unset($csvData);
+ ob_flush();
+ flush();
+ }
+ fclose($fp);
+ $this->backSuccessExport($id);
+
+ }
//注册明细excel信息
public function registerExcelInfo($id,$map) {
diff --git a/Application/Home/Controller/PlayersController.class.php b/Application/Home/Controller/PlayersController.class.php
new file mode 100644
index 000000000..427ae9b5a
--- /dev/null
+++ b/Application/Home/Controller/PlayersController.class.php
@@ -0,0 +1,133 @@
+getLevelPromote();
+ $queryPromote = $this->getQueryPromote($levelPromote);
+ // $loginPromote = $this->getLoginPromote();
+ $map = [];
+
+ $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
+ $ids = M('promote', 'tab_')->where($map)->getField('id', true);
+ $ids[] = $queryPromote['id'];
+ $map = [];
+ $map['tab_pay_info.promote_id'] = ['in', $ids];
+
+ if (!empty($relationGameId)) {
+ $map['tab_pay_info.relation_game_id'] = $relationGameId;
+ }
+ if (!empty($sdkVersion)) {
+ $map['tab_pay_info.sdk_version'] = $sdkVersion;
+ }
+ if (!empty($serverId)) {
+ $map['tab_pay_info.server_id'] = $serverId;
+ }
+ if (!empty($gamePlayerName)) {
+ $map['tab_pay_info.game_player_name'] = $gamePlayerName;
+ }
+ if (!empty($userAccount)) {
+ $map['tab_pay_info.user_account'] = $userAccount;
+ }
+ if (!empty($extend)) {
+ $map['tab_pay_info.extend'] = $extend;
+ }
+ if (!empty($userId)) {
+ $map['tab_pay_info.user_id'] = $userId;
+ }
+ if (!empty($begTime) && !empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['between', [$begTime, $endTime - 1]];
+ }else if (empty($begTime) && !empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['elt',$endTime];
+ }else if (!empty($begTime) && empty($endTime)) {
+ $map['tab_pay_info.create_time'] = ['EGT',$begTime];
+ }
+ $page = intval(I('get.p', 1));
+ $page = $page ? $page : 1; //默认显示第一页数据arraypage
+ $row=10;
+ $rs = M('pay_info','tab_')->where($map)->order('tab_pay_info.create_time desc')
+ ->page($page, $row)->select();
+ foreach($rs as $key => $v) {
+ $rs[$key]['extend'] = encryption($v['extend']);
+ $rs[$key]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
+ $promoteInfo = M('promote','tab_')->field("nickname")->where(['id' => intval($v['promote_id'])])->find();
+ $rs[$key]['promote_id']= $promoteInfo['nickname'];
+ }
+ $count = M('pay_info', 'tab_')
+ ->field('tab_pay_info.id')
+ ->where($map)
+ ->select();
+ $count = count($count);
+
+ //分页
+ $parameter['p'] = $page;
+ $parameter['row'] = $row;
+ $parameter['begtime'] = $initBegTime;
+ $parameter['endtime'] = $initEndTime;
+ $parameter['relation_game_id'] = $relationGameId;
+ $parameter['sdk_version'] = $sdkVersion;
+ $parameter['server_id'] = $serverId;
+ $parameter['game_player_name'] = $gamePlayerName;
+ $parameter['user_account'] = $userAccount;
+ $parameter['extend'] = $extend;
+ $parameter['user_id'] = $user_id;
+ $parameter['level_promote_2'] = $levelPromote[0];
+ $parameter['level_promote_3'] = $levelPromote[1];
+ $parameter['level_promote_4'] = $levelPromote[2];
+ $page = set_pagination($count, $row, $parameter);
+ if ($page) {
+ $this->assign('_page', $page);
+ }
+ $this->assign('listData',$rs);
+ $this->assign('initBegTime', I('begtime'));
+ $this->assign('initEndTime', I('endtime'));
+ $this->display();
+ }
+
+ private function getLevelPromote()
+ {
+ $levelPromote = [];
+ $levelPromote[] = I('level_promote_2', 0);
+ $levelPromote[] = I('level_promote_3', 0);
+ $levelPromote[] = I('level_promote_4', 0);
+ return $levelPromote;
+ }
+
+ private function getQueryPromote($levelPromote)
+ {
+ $queryPromote = null;
+ $promote = $this->getLoginPromote();
+ $queryPromoteId = 0;
+ foreach ($levelPromote as $item) {
+ if ($item != 0) {
+ $queryPromoteId = $item;
+ }
+ }
+ if ($queryPromoteId == 0) {
+ $queryPromote = $this->getLoginPromote();
+ } else {
+ $queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find();
+ }
+ return $queryPromote;
+ }
+}
\ No newline at end of file
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index 3cb662551..2d52f6888 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -1759,7 +1759,7 @@ class QueryController extends BaseController
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
- $sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day'];
+ $sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'create_time', 'user_game_login_count'];
$nowTime = date('Y-m-d', time() - 3600 * 24);
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
@@ -1855,8 +1855,15 @@ class QueryController extends BaseController
$map['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
$fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today";
- $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version";
- $field = $fieldUC . ',' . $fieldUI;
+ $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time";
+
+ $loginRecordMap['lr.create_time'] = $map['uc.create_time'];
+ $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id';
+ $fieldLR = M('login_daily_record', 'tab_')->alias('lr')
+ ->field("count(*) as count")
+ ->where($loginRecordMap)
+ ->buildSql();
+ $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count';
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field)
->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
@@ -1883,6 +1890,7 @@ class QueryController extends BaseController
$list['role_level'] = empty($list['role_level']) ? '--' : $list['role_level'];
$list['unlogin_day'] = empty($list['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['play_time']))) / (24 * 3600));
$list['play_time'] = empty($list['play_time']) ? '--' : date('Y-m-d H:i:s', $list['play_time']);
+ $list['create_time'] = empty($list['create_time']) ? '--' : date('Y-m-d H:i:s', $list['create_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
}
}
diff --git a/Application/Home/View/default/Home/landingPage2.html b/Application/Home/View/default/Home/landingPage2.html
index 9b9c9e634..ff3b72c39 100644
--- a/Application/Home/View/default/Home/landingPage2.html
+++ b/Application/Home/View/default/Home/landingPage2.html
@@ -17,6 +17,23 @@
+
@@ -33,12 +50,21 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/Home/View/default/Players/playAction.html b/Application/Home/View/default/Players/playAction.html
new file mode 100644
index 000000000..c3b1f63f1
--- /dev/null
+++ b/Application/Home/View/default/Players/playAction.html
@@ -0,0 +1,352 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
说明
+
玩家在游戏内的行为日志
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cp订单号 |
+ 充值时间 |
+ 玩家账号 |
+ 游戏名称 |
+ 所属推广员 |
+ 游戏区服 |
+ 角色ID |
+ 角色名称 |
+ 订单金额 |
+
+
+
+
+
+
+ 暂无数据
+ |
+
+
+
+
+ {$vo.extend} |
+ {$vo.create_time} |
+ {$vo.user_account} |
+ {$vo.game_name} |
+ {$vo.promote_id} |
+ {$vo.server_name} |
+ {$vo.user_id} |
+ {$vo.game_player_name} |
+ {$vo.price} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html
index cd8f6eab3..1e53ffa9a 100644
--- a/Application/Home/View/default/Public/promote_base.html
+++ b/Application/Home/View/default/Public/promote_base.html
@@ -127,18 +127,11 @@
平台币充值
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/Data/update.sql b/Data/update.sql
index 4c9cac958..95adabd49 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -693,6 +693,8 @@ ALTER TABLE `tab_pay_info` ADD COLUMN `game_name` varchar(30) DEFAULT '' COMMENT
ALTER TABLE `tab_pay_info` ADD COLUMN `server_id` int(11) DEFAULT '0' COMMENT '区服id';
ALTER TABLE `tab_pay_info` ADD COLUMN `server_name` varchar(30) DEFAULT '' COMMENT '区服名称';
ALTER TABLE `tab_pay_info` ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id';
-ALTER TABLE `tab_pay_info` ADD COLUMN `game_player_id` int(11) DEFAULT '0' COMMENT '玩家游戏内id';
+ALTER TABLE `tab_pay_info` ADD COLUMN `game_player_id` varchar(30) DEFAULT '0' COMMENT '玩家游戏内id';
ALTER TABLE `tab_pay_info` ADD COLUMN `sdk_version` tinyint(2) DEFAULT '1' COMMENT '区别sdk版本1安卓 2苹果 ';
ALTER TABLE `tab_pay_info` ADD COLUMN `promote_account` varchar(30) DEFAULT '' COMMENT '推广员账号';
+-- 菜单(游戏充值预下单)
+INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('游戏充值预下单', 16, 0, 'BehaviorLog/game', 0, '', '行为日志', 0, 1);