|
@@ 435-449 (lines=15) @@
|
| 432 |
|
return $counts; |
| 433 |
|
} |
| 434 |
|
|
| 435 |
|
public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
| 436 |
|
$where = "WHERE pokemon_id = '".$pokemon_id."' AND id > '".$last_update."'"; |
| 437 |
|
$req = "SELECT count, id AS last_timestamp, (TO_TIMESTAMP(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude |
| 438 |
|
FROM sightings |
| 439 |
|
JOIN (SELECT COUNT(*) AS count |
| 440 |
|
FROM sightings |
| 441 |
|
" . $where. " |
| 442 |
|
) count ON 1 = 1 |
| 443 |
|
" . $where . " |
| 444 |
|
ORDER BY expire_timestamp DESC |
| 445 |
|
LIMIT 1 OFFSET 0"; |
| 446 |
|
$result = pg_query($this->db, $req); |
| 447 |
|
$data = pg_fetch_object($result); |
| 448 |
|
return $data; |
| 449 |
|
} |
| 450 |
|
|
| 451 |
|
public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
| 452 |
|
$where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'"; |
|
@@ 451-466 (lines=16) @@
|
| 448 |
|
return $data; |
| 449 |
|
} |
| 450 |
|
|
| 451 |
|
public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
| 452 |
|
$where = "WHERE pokemon_id = '".$pokemon_id."' AND time_battle > '".$last_update."'"; |
| 453 |
|
$req = "SELECT time_battle AS start_timestamp, time_end as end, (TO_TIMESTAMP(time_end)) AS end_time_real, lat as latitude, lon as longitude, count |
| 454 |
|
FROM raids r |
| 455 |
|
JOIN forts g ON r.fort_id = g.id |
| 456 |
|
JOIN (SELECT COUNT(*) AS count |
| 457 |
|
FROM raids |
| 458 |
|
" . $where." |
| 459 |
|
) count ON 1 = 1 |
| 460 |
|
" . $where." |
| 461 |
|
ORDER BY time_battle DESC |
| 462 |
|
LIMIT 1 OFFSET 0"; |
| 463 |
|
$result = pg_query($this->db, $req); |
| 464 |
|
$data = pg_fetch_object($result); |
| 465 |
|
return $data; |
| 466 |
|
} |
| 467 |
|
|
| 468 |
|
public function getCaptchaCount() { |
| 469 |
|
$req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL"; |