推广平台>数据管理>充值玩家--更新

master
chenxiaojun 5 years ago
commit 64eb3ce4cb

@ -1034,4 +1034,65 @@ public function auto_rrdae(){
];
return $ret;
}
//玩家角色每日登录记录
public function userPlayLoginRecordByDayCount($time = '')
{
if ($time == '') {
$time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24)));
} else {
$time = strtotime(date('Y-m-d 00:00:00', strtotime($time)));
}
$res = M('user_play_login_record_by_day', 'tab_')->where(array('create_time' => $time))->find();
if (empty($res)) {
$map['login_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]];
$this->userPlayLoginRecordByDayByMap($map);
}
}
//玩家角色每日登录记录--初始化
public function userPlayLoginRecordByDayInitial()
{
$res = M('user_play_login_record_by_day', 'tab_')->order('id asc')->find();
if (empty($res)) {
ini_set('memory_limit','800M');
$time = strtotime(date('Y-m-d 00:00:00', time()));
$map['login_time'] = ['lt', $time];
$this->userPlayLoginRecordByDayByMap($map);
echo '初始化成功';
} else {
echo '表存在记录,无法初始化';
}
}
//玩家角色每日登录记录
private function userPlayLoginRecordByDayByMap($map = [])
{
if (isset($map['login_time'])) {
$map['game_id'] = ['gt', 0];
$field = 'FROM_UNIXTIME(login_time, "%Y-%m-%d") as day,user_id,game_id';
$loginData = M('user_game_login_record', 'tab_')->field($field)
->where($map)
->group('day,game_id,user_id')
->select();
if (!empty($loginData)) {
$data = [];
foreach ($loginData as &$list) {
$data[] = [
'user_id' => $list['user_id'],
'game_id' => $list['game_id'],
'server_id' => '',
'role_id' => '',
'create_time' => strtotime($list['day']),
];
unset($list);
}
unset($loginData);
M('user_play_login_record_by_day', 'tab_')->addAll($data);
}
}
}
}

@ -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('user_play_login_record_by_day', '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'];
}
}

@ -26,17 +26,13 @@
.home-video video {
margin-left: 0.45%;
width: 84.75%;
border-radius: 4.5%;
}
@media(min-width:580px){
.home-video {
max-width:580px;
}
}
@media(min-height:580px){
.home-video {
max-width:580px;
}
}
</style>
<input type="hidden" name="title" value="{$game['relation_game_name']}">
<input type="hidden" name="icon" value="{$game['icon']}">

@ -145,6 +145,28 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="user_game_login_count">玩家游戏累计登录天数
<if condition="'user_game_login_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="create_time">注册时间
<if condition="'create_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>最后登录时间</th>
<th>推广员账号</th>
</tr>
@ -163,6 +185,8 @@
<td>{$record.recharge_count}</td>
<td>{$record.recharge_cost_today}</td>
<td>{$record.unlogin_day}</td>
<td>{$record.user_game_login_count}</td>
<td>{$record.create_time}</td>
<td>{$record.play_time}</td>
<td>{$record.promote_account}</td>
</tr>

@ -696,3 +696,16 @@ ALTER TABLE `tab_pay_info` ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT '0'
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 '推广员账号';
--2019-12-11 cxj
--
CREATE TABLE `tab_user_play_login_record_by_day` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT 0 COMMENT '玩家id',
`game_id` int(11) NOT NULL DEFAULT 0 COMMENT '游戏id',
`server_id` varchar(30) NOT NULL DEFAULT '' COMMENT '区服id',
`role_id` varchar(30) NOT NULL DEFAULT '' COMMENT '角色id',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`),
INDEX `search`(`user_id`, `game_id`, `create_time`) USING BTREE
);

Loading…
Cancel
Save