| @@ 430-444 (lines=15) @@ | ||
| 427 | return $counts; |
|
| 428 | } |
|
| 429 | ||
| 430 | public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
|
| 431 | $where = "WHERE pokemon_id = '".$pokemon_id."' AND id > '".$last_update."'"; |
|
| 432 | $req = "SELECT count, id AS last_timestamp, (FROM_UNIXTIME(expire_timestamp)) AS disappear_time_real, lat as latitude, lon as longitude |
|
| 433 | FROM sightings |
|
| 434 | JOIN (SELECT COUNT(*) AS count |
|
| 435 | FROM sightings |
|
| 436 | " . $where." |
|
| 437 | ) x |
|
| 438 | " . $where . " |
|
| 439 | ORDER BY expire_timestamp DESC |
|
| 440 | LIMIT 0 , 1"; |
|
| 441 | $result = $this->mysqli->query($req); |
|
| 442 | $data = $result->fetch_object(); |
|
| 443 | return $data; |
|
| 444 | } |
|
| 445 | ||
| 446 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 447 | $where = "WHERE pokemon_id = '".$pokemon_id."AND".$last_update."'"; |
|
| @@ 446-462 (lines=17) @@ | ||
| 443 | return $data; |
|
| 444 | } |
|
| 445 | ||
| 446 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 447 | $where = "WHERE pokemon_id = '".$pokemon_id."AND".$last_update."'"; |
|
| 448 | $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 |
|
| 449 | FROM raids r |
|
| 450 | JOIN forts g |
|
| 451 | JOIN (SELECT COUNT(*) AS count |
|
| 452 | FROM raids |
|
| 453 | " . $where." |
|
| 454 | ) x |
|
| 455 | ON r.fort_id = g.id |
|
| 456 | " . $where . " |
|
| 457 | ORDER BY time_battle DESC |
|
| 458 | LIMIT 0 , 1"; |
|
| 459 | $result = $this->mysqli->query($req); |
|
| 460 | $data = $result->fetch_object(); |
|
| 461 | return $data; |
|
| 462 | } |
|
| 463 | ||
| 464 | public function getCaptchaCount() { |
|
| 465 | $req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL"; |
|
| @@ 537-551 (lines=15) @@ | ||
| 534 | return $counts; |
|
| 535 | } |
|
| 536 | ||
| 537 | public function getPokemonSinceLastUpdate($pokemon_id, $last_update) { |
|
| 538 | $where = "WHERE p.pokemon_id = '".$pokemon_id."' AND (UNIX_TIMESTAMP(p.disappear_time) - (LENGTH(s.kind) - LENGTH( REPLACE ( kind, \"s\", \"\") )) * 900) > '".$last_update."'"; |
|
| 539 | $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 |
|
| 540 | FROM pokemon p |
|
| 541 | JOIN spawnpoint s ON p.spawnpoint_id = s.id |
|
| 542 | JOIN (SELECT count(*) as count |
|
| 543 | FROM pokemon p |
|
| 544 | JOIN spawnpoint s ON p.spawnpoint_id = s.id |
|
| 545 | " . $where." |
|
| 546 | ) x |
|
| 547 | " . $where . " |
|
| 548 | ORDER BY last_timestamp DESC |
|
| 549 | LIMIT 0,1"; |
|
| 550 | $result = $this->mysqli->query($req); |
|
| 551 | $data = $result->fetch_object(); |
|
| 552 | return $data; |
|
| 553 | } |
|
| 554 | ||
| @@ 555-571 (lines=17) @@ | ||
| 552 | return $data; |
|
| 553 | } |
|
| 554 | ||
| 555 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 556 | $where = "WHERE pokemon_id = '".$pokemon_id."' AND UNIX_TIMESTAMP(start) > '".$last_update."'"; |
|
| 557 | $req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".self::$time_offset."')) AS end_time_real, latitude, longitude, count |
|
| 558 | FROM raid r |
|
| 559 | JOIN gym g |
|
| 560 | JOIN (SELECT count(*) as count |
|
| 561 | FROM raid |
|
| 562 | " . $where." |
|
| 563 | ) x |
|
| 564 | ON r.gym_id = g.gym_id |
|
| 565 | " . $where." |
|
| 566 | ORDER BY start DESC |
|
| 567 | LIMIT 0,1"; |
|
| 568 | $result = $this->mysqli->query($req); |
|
| 569 | $data = $result->fetch_object(); |
|
| 570 | return $data; |
|
| 571 | } |
|
| 572 | ||
| 573 | public function getCaptchaCount() { |
|
| 574 | $req = "SELECT SUM(accounts_captcha) AS total FROM mainworker"; |
|