|
|
@ -1034,65 +1034,4 @@ public function auto_rrdae(){
|
|
|
|
];
|
|
|
|
];
|
|
|
|
return $ret;
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|