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