Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function get_outlog()
- {
- $where = "where OutgoingLog.queued >=from_unixtime(?)";
- $param = array($_GET['start']);
- if(isset($_GET['end'])) {
- $where = "where OutgoingLog.queued between from_unixtime(?) and from_unixtime(?)";
- $param = array($_GET['start'],$_GET['end']);
- }
- if(isset($_GET['device'])) {
- $where .= " and OutgoingLog.Devices_id=?";
- $param[] = $_GET['device'];
- }
- //v13_фильтрация по городу
- if(isset($_GET['town'])) {
- $where .= " and Town.Name=?";
- $param[] = $_GET['town'];
- }
- if(isset($_GET['type']) && $_GET['type']>0) {
- $where .= " and Devices.Type=?";
- $param[] = $_GET['type'];
- }
- //v13_фильтрация по городу
- $sql =
- "SELECT
- UNIX_TIMESTAMP(OutgoingLog.queued) as unixqueued,
- UNIX_TIMESTAMP(OutgoingLog.pbxtime) as unixpbxtime,
- UNIX_TIMESTAMP(OutgoingLog.finished) as unixfinished,
- TIME_FORMAT( TIMEDIFF(NOW(), UTC_TIMESTAMP),'%H:%i' ) as tz, OutgoingLog.*,
- Devices.Name, Devices.CustomNum, Devices.sn, Devices.Location, ServerCommand.Name as ServerCommandName, ServerCommand.Letter,
- IF(ServerCommand.label IS NULL or ServerCommand.label = '', ServerCommand.Name, ServerCommand.label) as label, ServerCommand.type,
- CASE
- WHEN OutgoingLog.errortext LIKE 'user:%'
- THEN SUBSTRING(OutgoingLog.errortext, 6)
- ELSE OutgoingLog.DeviceNUM
- END AS DeviceNUM
- FROM OutgoingLog
- left join Devices on Devices.id = OutgoingLog.Devices_id
- left join Town on Town.id = Devices.Town_id
- left join ServerCommand on ServerCommand.id = OutgoingLog.ServerCommand_id
- $where
- order by OutgoingLog.id desc limit {$this->cnf['default_query_limit']}";
- $this->run_query($sql, $param, ['OutgoingLog', 'Devices']);
- }
Advertisement
Add Comment
Please, Sign In to add comment