public function getOnlineHour($row){
if(empty($row)) return false;
//全服
if(empty($row['server_id'])){
$con_db=$this->getDB('role_total');
$table = 'log_online_'.date('Ymd',strtotime($row['online_date']));
$table = 'log_online_20170428';
$con_db->field("DATE_FORMAT(`logdate`,'%Y,%m,%d,%k,%i') as online_time,sum(count) as avg_online");
$con_db->group("hour(logdate),minute(logdate)");
if( !empty($row['pfrom_id']) ){
$con_db->where('pfrom_id','=',$row['pfrom_id']);
}
if( !empty($row['online_date']) ){
$con_db->where('date(logdate)','=',$row['online_date']);
}
$con_db->where('server_id','<>',8004)->where('server_id','<>',8010);
$data=$con_db->table($table)->select();
}else{
$con_db=$this->getDB('back_log',$row);
// print_r($con_db);exit;
$table="log_online_".date('Ymd', strtotime($row['online_date']));
$table = 'log_online_20170428';
$con_db->field("DATE_FORMAT(`logdate`,'%Y,%m,%d,%k,%i') as online_time,count AS avg_online");
if( !empty($row['server_id']) ){
$con_db->where('server_id','=',$row['server_id']);
}
if( !empty($row['online_date']) ){
$con_db->where('logdate','>=',"{$row['online_date']} 00:00:00")
->where('logdate','<=',"{$row['online_date']} 23:59:59");
}
$data=$con_db->table($table)->select();
//echo $con_db->getLastSql();exit;
}
return $data;
}
//当前在线注册人数
public function getOnlineCreate($row){
if(empty($row)){
return false;
}
if( empty($row['server_id']) ){
$this->field("CONCAT(DATE_FORMAT(inst_date,'%Y,%m,%d'),',',inst_hour,',00') AS inst_hour,sum(inst_count) AS inst_count ");
$this->group('inst_hour');
}else{
$this->field("CONCAT(DATE_FORMAT(inst_date,'%Y,%m,%d'),',',inst_hour,',00') AS inst_hour,sum(inst_count) AS inst_count ");
}
if( !empty($row['server_id']) ){
$this->where('server_id','=',$row['server_id']);
}
if( !empty($row['pfrom_id']) ){
$this->where('pfrom_id','=',$row['pfrom_id']);
}
if( !empty($row['inst_date']) ){
$this->where('inst_date','=',$row['inst_date']);
}
$data=$this->select();
return $data;
}
浙公网安备 33010602011771号