| @@ 459-473 (lines=15) @@ | ||
| 456 | return $counts; |
|
| 457 | } |
|
| 458 | ||
| 459 | public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
|
| 460 | $where = "WHERE p.pokemon_id = '".$pokemon_id."' AND p.expire_timestamp - (coalesce(CASE WHEN duration = 0 THEN NULL ELSE duration END ,30)*60) > '".$last_update."'"; |
|
| 461 | $req = "SELECT count, p.expire_timestamp - (coalesce(CASE WHEN duration = 0 THEN NULL ELSE duration END ,30)*60) AS last_timestamp, (FROM_UNIXTIME(p.expire_timestamp)) AS disappear_time_real, p.lat as latitude, p.lon as longitude |
|
| 462 | FROM sightings p |
|
| 463 | LEFT JOIN spawnpoints s ON p.spawn_id = s.spawn_id |
|
| 464 | JOIN (SELECT COUNT(*) AS count |
|
| 465 | FROM sightings p |
|
| 466 | LEFT JOIN spawnpoints s ON p.spawn_id = s.spawn_id |
|
| 467 | " . $where." |
|
| 468 | ) x |
|
| 469 | " . $where . " |
|
| 470 | ORDER BY last_timestamp DESC |
|
| 471 | LIMIT 0 , 1"; |
|
| 472 | $result = $this->mysqli->query($req); |
|
| 473 | $data = $result->fetch_object(); |
|
| 474 | return $data; |
|
| 475 | } |
|
| 476 | ||
| @@ 477-493 (lines=17) @@ | ||
| 474 | return $data; |
|
| 475 | } |
|
| 476 | ||
| 477 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 478 | $where = "WHERE pokemon_id = '".$pokemon_id."AND".$last_update."'"; |
|
| 479 | $req = "SELECT time_battle AS start_timestamp, time_end as end, (FROM_UNIXTIME(time_end)) AS end_time_real, lat as latitude, lon as longitude, count |
|
| 480 | FROM raids r |
|
| 481 | JOIN forts g |
|
| 482 | JOIN (SELECT COUNT(*) AS count |
|
| 483 | FROM raids |
|
| 484 | " . $where." |
|
| 485 | ) x |
|
| 486 | ON r.fort_id = g.id |
|
| 487 | " . $where . " |
|
| 488 | ORDER BY time_battle DESC |
|
| 489 | LIMIT 0 , 1"; |
|
| 490 | $result = $this->mysqli->query($req); |
|
| 491 | $data = $result->fetch_object(); |
|
| 492 | return $data; |
|
| 493 | } |
|
| 494 | ||
| 495 | public function getCaptchaCount() { |
|
| 496 | $req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL"; |
|
| @@ 619-633 (lines=15) @@ | ||
| 616 | return $counts; |
|
| 617 | } |
|
| 618 | ||
| 619 | public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
|
| 620 | $where = "WHERE p.pokemon_id = '".$pokemon_id."' AND (UNIX_TIMESTAMP(p.disappear_time) - (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900) > '".$last_update."'"; |
|
| 621 | $req = "SELECT count, (UNIX_TIMESTAMP(p.disappear_time) - (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900) as last_timestamp, (CONVERT_TZ(p.disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real, p.latitude, p.longitude |
|
| 622 | FROM pokemon p |
|
| 623 | JOIN spawnpoint s ON p.spawnpoint_id = s.id |
|
| 624 | JOIN (SELECT count(*) as count |
|
| 625 | FROM pokemon p |
|
| 626 | JOIN spawnpoint s ON p.spawnpoint_id = s.id |
|
| 627 | " . $where." |
|
| 628 | ) x |
|
| 629 | " . $where . " |
|
| 630 | ORDER BY last_timestamp DESC |
|
| 631 | LIMIT 0,1"; |
|
| 632 | $result = $this->mysqli->query($req); |
|
| 633 | $data = $result->fetch_object(); |
|
| 634 | return $data; |
|
| 635 | } |
|
| 636 | ||
| @@ 637-653 (lines=17) @@ | ||
| 634 | return $data; |
|
| 635 | } |
|
| 636 | ||
| 637 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 638 | $where = "WHERE pokemon_id = '".$pokemon_id."' AND UNIX_TIMESTAMP(start) > '".$last_update."'"; |
|
| 639 | $req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".self::$time_offset."')) AS end_time_real, latitude, longitude, count |
|
| 640 | FROM raid r |
|
| 641 | JOIN gym g |
|
| 642 | JOIN (SELECT count(*) as count |
|
| 643 | FROM raid |
|
| 644 | " . $where." |
|
| 645 | ) x |
|
| 646 | ON r.gym_id = g.gym_id |
|
| 647 | " . $where." |
|
| 648 | ORDER BY start DESC |
|
| 649 | LIMIT 0,1"; |
|
| 650 | $result = $this->mysqli->query($req); |
|
| 651 | $data = $result->fetch_object(); |
|
| 652 | return $data; |
|
| 653 | } |
|
| 654 | ||
| 655 | public function getCaptchaCount() { |
|
| 656 | $req = "SELECT SUM(accounts_captcha) AS total FROM mainworker"; |
|