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