| @@ 440-456 (lines=17) @@ | ||
| 437 | return $data; |
|
| 438 | } |
|
| 439 | ||
| 440 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 441 | $where = "WHERE pokemon_id = '".$pokemon_id."' && time_battle > '".$last_update."'"; |
|
| 442 | $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 |
|
| 443 | FROM raids r |
|
| 444 | JOIN forts g |
|
| 445 | JOIN (SELECT COUNT(*) AS count |
|
| 446 | FROM raids |
|
| 447 | " . $where." |
|
| 448 | ) x |
|
| 449 | ON r.fort_id = g.id |
|
| 450 | " . $where." |
|
| 451 | ORDER BY time_battle DESC |
|
| 452 | LIMIT 0 , 1"; |
|
| 453 | $result = $this->mysqli->query($req); |
|
| 454 | $data = $result->fetch_object(); |
|
| 455 | return $data; |
|
| 456 | } |
|
| 457 | ||
| 458 | public function getCaptchaCount() { |
|
| 459 | $req = " SELECT COUNT(*) as total FROM accounts WHERE captchaed IS NOT NULL AND reason IS NULL"; |
|
| @@ 547-563 (lines=17) @@ | ||
| 544 | return $data; |
|
| 545 | } |
|
| 546 | ||
| 547 | public function getRaidsSinceLastUpdate($pokemon_id, $last_update) { |
|
| 548 | $where = "WHERE pokemon_id = '".$pokemon_id."' && UNIX_TIMESTAMP(start) > '".$last_update."'"; |
|
| 549 | $req = "SELECT UNIX_TIMESTAMP(start) as start_timestamp, end, (CONVERT_TZ(end, '+00:00', '".self::$time_offset."')) AS end_time_real, latitude, longitude, count |
|
| 550 | FROM raid r |
|
| 551 | JOIN gym g |
|
| 552 | JOIN (SELECT count(*) as count |
|
| 553 | FROM raid |
|
| 554 | " . $where." |
|
| 555 | ) x |
|
| 556 | ON r.gym_id = g.gym_id |
|
| 557 | " . $where." |
|
| 558 | ORDER BY start DESC |
|
| 559 | LIMIT 0,1"; |
|
| 560 | $result = $this->mysqli->query($req); |
|
| 561 | $data = $result->fetch_object(); |
|
| 562 | return $data; |
|
| 563 | } |
|
| 564 | ||
| 565 | public function getCaptchaCount() { |
|
| 566 | $req = "SELECT SUM(accounts_captcha) AS total FROM mainworker"; |
|