public function getDevice() { global $db, $res; dbc(); $sql = "select COUNT(imei) AS total,COUNT(CASE state WHEN '1' THEN 1 END) AS highState,COUNT(CASE state WHEN '-1' THEN -1 END) AS lowState,COUNT(CASE state WHEN '0' THEN 0 END) AS normalState from " . $db->table('info'); $row = $db->queryall($sql); $res["data"] = $row; die(json_encode_lockdata($res)); }
Done!