| @@ 164-169 (lines=6) @@ | ||
| 161 | // Single Pokemon |
|
| 162 | /////////////////// |
|
| 163 | ||
| 164 | public function getGymsProtectedByPokemon($pokemon_id) |
|
| 165 | { |
|
| 166 | $req = "SELECT COUNT(f.id) AS total |
|
| 167 | FROM forts f |
|
| 168 | LEFT JOIN fort_sightings fs ON (fs.fort_id = f.id AND fs.last_modified = (SELECT MAX(last_modified) FROM fort_sightings fs2 WHERE fs2.fort_id=f.id)) |
|
| 169 | WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 170 | $result = $this->mysqli->query($req); |
|
| 171 | $data = $result->fetch_object(); |
|
| 172 | ||
| @@ 176-185 (lines=10) @@ | ||
| 173 | return $data; |
|
| 174 | } |
|
| 175 | ||
| 176 | public function getPokemonLastSeen($pokemon_id) |
|
| 177 | { |
|
| 178 | $req = "SELECT FROM_UNIXTIME(expire_timestamp) AS expire_timestamp, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, lat AS latitude, lon AS longitude |
|
| 179 | FROM sightings |
|
| 180 | WHERE pokemon_id = '".$pokemon_id."' |
|
| 181 | ORDER BY expire_timestamp DESC |
|
| 182 | LIMIT 0,1"; |
|
| 183 | $result = $this->mysqli->query($req); |
|
| 184 | $data = $result->fetch_object(); |
|
| 185 | ||
| 186 | return $data; |
|
| 187 | } |
|
| 188 | ||
| @@ 165-170 (lines=6) @@ | ||
| 162 | // Single Pokemon |
|
| 163 | /////////////////// |
|
| 164 | ||
| 165 | public function getGymsProtectedByPokemon($pokemon_id) |
|
| 166 | { |
|
| 167 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 168 | $result = $this->mysqli->query($req); |
|
| 169 | $data = $result->fetch_object(); |
|
| 170 | ||
| 171 | return $data; |
|
| 172 | } |
|
| 173 | ||
| @@ 174-183 (lines=10) @@ | ||
| 171 | return $data; |
|
| 172 | } |
|
| 173 | ||
| 174 | public function getPokemonLastSeen($pokemon_id) |
|
| 175 | { |
|
| 176 | $req = "SELECT disappear_time, |
|
| 177 | CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."') AS disappear_time_real, |
|
| 178 | latitude, longitude |
|
| 179 | FROM pokemon |
|
| 180 | WHERE pokemon_id = '".$pokemon_id."' |
|
| 181 | ORDER BY disappear_time DESC |
|
| 182 | LIMIT 0,1"; |
|
| 183 | $result = $this->mysqli->query($req); |
|
| 184 | $data = $result->fetch_object(); |
|
| 185 | ||
| 186 | return $data; |
|
| @@ 416-425 (lines=10) @@ | ||
| 413 | return $gyms; |
|
| 414 | } |
|
| 415 | ||
| 416 | public function getGymData($gym_id) |
|
| 417 | { |
|
| 418 | $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team, |
|
| 419 | CONVERT_TZ(gym.last_scanned, '+00:00', '".self::$time_offset."') AS last_scanned, |
|
| 420 | gym.guard_pokemon_id AS guard_pokemon_id, |
|
| 421 | gym.total_cp AS total_cp, |
|
| 422 | (6 - gym.slots_available) AS level |
|
| 423 | FROM gymdetails |
|
| 424 | LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id |
|
| 425 | WHERE gym.gym_id='".$gym_id."'"; |
|
| 426 | $result = $this->mysqli->query($req); |
|
| 427 | $data = $result->fetch_object(); |
|
| 428 | ||