| @@ 125-141 (lines=17) @@ | ||
| 122 | return $data; |
|
| 123 | } |
|
| 124 | ||
| 125 | public function getRecentAll() |
|
| 126 | { |
|
| 127 | $req = 'SELECT DISTINCT pokemon_id, encounter_id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, |
|
| 128 | lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina |
|
| 129 | FROM sightings |
|
| 130 | ORDER BY updated DESC |
|
| 131 | LIMIT 0,12'; |
|
| 132 | $result = $this->mysqli->query($req); |
|
| 133 | $data = array(); |
|
| 134 | if ($result->num_rows > 0) { |
|
| 135 | while ($row = $result->fetch_object()) { |
|
| 136 | $data[] = $row; |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||
| 140 | return $data; |
|
| 141 | } |
|
| 142 | ||
| 143 | public function getRecentMythic($mythic_pokemon) |
|
| 144 | { |
|
| @@ 331-343 (lines=13) @@ | ||
| 328 | return $data; |
|
| 329 | } |
|
| 330 | ||
| 331 | public function getPokemonCountAll() |
|
| 332 | { |
|
| 333 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 334 | FROM pokemon_stats |
|
| 335 | GROUP BY pid'; |
|
| 336 | $result = $this->mysqli->query($req); |
|
| 337 | $array = array(); |
|
| 338 | while ($data = $result->fetch_object()) { |
|
| 339 | $array[] = $data; |
|
| 340 | } |
|
| 341 | ||
| 342 | return $array; |
|
| 343 | } |
|
| 344 | ||
| 345 | public function getRaidCount($pokemon_id) |
|
| 346 | { |
|
| @@ 356-368 (lines=13) @@ | ||
| 353 | return $data; |
|
| 354 | } |
|
| 355 | ||
| 356 | public function getRaidCountAll() |
|
| 357 | { |
|
| 358 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 359 | FROM raid_stats |
|
| 360 | GROUP BY pid'; |
|
| 361 | $result = $this->mysqli->query($req); |
|
| 362 | $array = array(); |
|
| 363 | while ($data = $result->fetch_object()) { |
|
| 364 | $array[] = $data; |
|
| 365 | } |
|
| 366 | ||
| 367 | return $array; |
|
| 368 | } |
|
| 369 | ||
| 370 | /////////////// |
|
| 371 | // Pokestops |
|
| @@ 383-393 (lines=11) @@ | ||
| 380 | return $data; |
|
| 381 | } |
|
| 382 | ||
| 383 | public function getAllPokestops() |
|
| 384 | { |
|
| 385 | $req = 'SELECT lat as latitude, lon as longitude, null AS lure_expiration, UNIX_TIMESTAMP() AS now, null AS lure_expiration_real FROM pokestops'; |
|
| 386 | $result = $this->mysqli->query($req); |
|
| 387 | $pokestops = array(); |
|
| 388 | while ($data = $result->fetch_object()) { |
|
| 389 | $pokestops[] = $data; |
|
| 390 | } |
|
| 391 | ||
| 392 | return $pokestops; |
|
| 393 | } |
|
| 394 | ||
| 395 | ///////// |
|
| 396 | // Gyms |
|
| @@ 399-413 (lines=15) @@ | ||
| 396 | // Gyms |
|
| 397 | ///////// |
|
| 398 | ||
| 399 | public function getTeamGuardians($team_id) |
|
| 400 | { |
|
| 401 | $req = "SELECT COUNT(*) AS total, guard_pokemon_id |
|
| 402 | FROM forts f |
|
| 403 | LEFT JOIN fort_sightings fs ON (fs.fort_id = f.id AND fs.last_modified = (SELECT MAX(last_modified) FROM fort_sightings fs2 WHERE fs2.fort_id=f.id)) |
|
| 404 | WHERE team = '".$team_id."' GROUP BY guard_pokemon_id ORDER BY total DESC LIMIT 0,3"; |
|
| 405 | $result = $this->mysqli->query($req); |
|
| 406 | ||
| 407 | $datas = array(); |
|
| 408 | while ($data = $result->fetch_object()) { |
|
| 409 | $datas[] = $data; |
|
| 410 | } |
|
| 411 | ||
| 412 | return $datas; |
|
| 413 | } |
|
| 414 | ||
| 415 | public function getOwnedAndPoints($team_id) |
|
| 416 | { |
|
| @@ 427-439 (lines=13) @@ | ||
| 424 | return $data; |
|
| 425 | } |
|
| 426 | ||
| 427 | public function getAllGyms() |
|
| 428 | { |
|
| 429 | $req = 'SELECT f.id as gym_id, team as team_id, f.lat as latitude, f.lon as longitude, updated as last_scanned, (6 - fs.slots_available) AS level |
|
| 430 | FROM forts f |
|
| 431 | LEFT JOIN fort_sightings fs ON (fs.fort_id = f.id AND fs.last_modified = (SELECT MAX(last_modified) FROM fort_sightings fs2 WHERE fs2.fort_id=f.id));'; |
|
| 432 | $result = $this->mysqli->query($req); |
|
| 433 | $gyms = array(); |
|
| 434 | while ($data = $result->fetch_object()) { |
|
| 435 | $gyms[] = $data; |
|
| 436 | } |
|
| 437 | ||
| 438 | return $gyms; |
|
| 439 | } |
|
| 440 | ||
| 441 | public function getGymData($gym_id) |
|
| 442 | { |
|
| @@ 453-466 (lines=14) @@ | ||
| 450 | return $data; |
|
| 451 | } |
|
| 452 | ||
| 453 | public function getGymDefenders($gym_id) |
|
| 454 | { |
|
| 455 | $req = "SELECT external_id as pokemon_uid, pokemon_id, atk_iv as iv_attack, def_iv as iv_defense, sta_iv as iv_stamina, cp, fort_id as gym_id |
|
| 456 | FROM gym_defenders |
|
| 457 | WHERE fort_id='".$gym_id."' |
|
| 458 | ORDER BY deployment_time"; |
|
| 459 | $result = $this->mysqli->query($req); |
|
| 460 | $defenders = array(); |
|
| 461 | while ($data = $result->fetch_object()) { |
|
| 462 | $defenders[] = $data; |
|
| 463 | } |
|
| 464 | ||
| 465 | return $defenders; |
|
| 466 | } |
|
| 467 | ||
| 468 | /////////// |
|
| 469 | // Raids |
|
| @@ 529-542 (lines=14) @@ | ||
| 526 | return $gym_history; |
|
| 527 | } |
|
| 528 | ||
| 529 | public function getGymHistoriesPokemon($gym_id) |
|
| 530 | { |
|
| 531 | $req = "SELECT external_id AS pokemon_uid, pokemon_id, cp_now as cp, owner_name AS trainer_name |
|
| 532 | FROM gym_defenders |
|
| 533 | WHERE fort_id = '".$gym_id."' |
|
| 534 | ORDER BY deployment_time"; |
|
| 535 | $result = $this->mysqli->query($req); |
|
| 536 | $pokemons = array(); |
|
| 537 | while ($data = $result->fetch_object()) { |
|
| 538 | $pokemons[] = $data; |
|
| 539 | } |
|
| 540 | ||
| 541 | return $pokemons; |
|
| 542 | } |
|
| 543 | ||
| 544 | public function getHistoryForGym($page, $gym_id) |
|
| 545 | { |
|
| @@ 681-694 (lines=14) @@ | ||
| 678 | return $levelData; |
|
| 679 | } |
|
| 680 | ||
| 681 | public function getActivePokemon($trainer_name) |
|
| 682 | { |
|
| 683 | $req = "SELECT pokemon_id, cp, atk_iv AS iv_attack, sta_iv AS iv_stamina, def_iv AS iv_defense, FROM_UNIXTIME(deployment_time) AS deployment_time, '1' AS active, fort_id as gym_id, FLOOR((UNIX_TIMESTAMP() - created) / 86400) AS last_scanned |
|
| 684 | FROM gym_defenders |
|
| 685 | WHERE owner_name = '".$trainer_name."' AND fort_id IS NOT NULL |
|
| 686 | ORDER BY deployment_time"; |
|
| 687 | $result = $this->mysqli->query($req); |
|
| 688 | $pokemon = array(); |
|
| 689 | while ($data = $result->fetch_object()) { |
|
| 690 | $pokemon[] = $data; |
|
| 691 | } |
|
| 692 | ||
| 693 | return $pokemon; |
|
| 694 | } |
|
| 695 | ||
| 696 | public function getInactivePokemon($trainer_name) |
|
| 697 | { |
|
| @@ 696-709 (lines=14) @@ | ||
| 693 | return $pokemon; |
|
| 694 | } |
|
| 695 | ||
| 696 | public function getInactivePokemon($trainer_name) |
|
| 697 | { |
|
| 698 | $req = "SELECT pokemon_id, cp, atk_iv AS iv_attack, sta_iv AS iv_stamina, def_iv AS iv_defense, NULL AS deployment_time, '0' AS active, fort_id as gym_id, FLOOR((UNIX_TIMESTAMP() - created) / 86400) AS last_scanned |
|
| 699 | FROM gym_defenders |
|
| 700 | WHERE owner_name = '".$trainer_name."' AND fort_id IS NULL |
|
| 701 | ORDER BY last_scanned"; |
|
| 702 | $result = $this->mysqli->query($req); |
|
| 703 | $pokemon = array(); |
|
| 704 | while ($data = $result->fetch_object()) { |
|
| 705 | $pokemon[] = $data; |
|
| 706 | } |
|
| 707 | ||
| 708 | return $pokemon; |
|
| 709 | } |
|
| 710 | ||
| 711 | public function getTrainerLevelCount($team_id) |
|
| 712 | { |
|
| @@ 738-748 (lines=11) @@ | ||
| 735 | // Cron |
|
| 736 | ///////// |
|
| 737 | ||
| 738 | public function getPokemonCountsActive() |
|
| 739 | { |
|
| 740 | $req = 'SELECT pokemon_id, COUNT(*) as total FROM sightings WHERE expire_timestamp >= UNIX_TIMESTAMP() GROUP BY pokemon_id'; |
|
| 741 | $result = $this->mysqli->query($req); |
|
| 742 | $counts = array(); |
|
| 743 | while ($data = $result->fetch_object()) { |
|
| 744 | $counts[$data->pokemon_id] = $data->total; |
|
| 745 | } |
|
| 746 | ||
| 747 | return $counts; |
|
| 748 | } |
|
| 749 | ||
| 750 | public function getTotalPokemonIV() |
|
| 751 | { |
|
| @@ 758-772 (lines=15) @@ | ||
| 755 | ||
| 756 | return $data; |
|
| 757 | } |
|
| 758 | public function getPokemonCountsLastDay() |
|
| 759 | { |
|
| 760 | $req = 'SELECT pokemon_id, COUNT(*) AS spawns_last_day |
|
| 761 | FROM sightings |
|
| 762 | WHERE expire_timestamp >= (SELECT MAX(expire_timestamp) - 86400 FROM sightings) |
|
| 763 | GROUP BY pokemon_id |
|
| 764 | ORDER BY pokemon_id ASC'; |
|
| 765 | $result = $this->mysqli->query($req); |
|
| 766 | $counts = array(); |
|
| 767 | while ($data = $result->fetch_object()) { |
|
| 768 | $counts[$data->pokemon_id] = $data->spawns_last_day; |
|
| 769 | } |
|
| 770 | ||
| 771 | return $counts; |
|
| 772 | } |
|
| 773 | ||
| 774 | public function getCaptchaCount() |
|
| 775 | { |
|
| @@ 124-140 (lines=17) @@ | ||
| 121 | return $data; |
|
| 122 | } |
|
| 123 | ||
| 124 | public function getRecentAll() |
|
| 125 | { |
|
| 126 | $req = 'SELECT pokemon_id, id, FROM_UNIXTIME(expire_timestamp) AS disappear_time, FROM_UNIXTIME(updated) AS last_modified, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, |
|
| 127 | lat AS latitude, lon AS longitude, cp, atk_iv AS individual_attack, def_iv AS individual_defense, sta_iv AS individual_stamina |
|
| 128 | FROM pokemon |
|
| 129 | ORDER BY changed DESC |
|
| 130 | LIMIT 0,12;'; |
|
| 131 | $result = $this->mysqli->query($req); |
|
| 132 | $data = array(); |
|
| 133 | if ($result->num_rows > 0) { |
|
| 134 | while ($row = $result->fetch_object()) { |
|
| 135 | $data[] = $row; |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | return $data; |
|
| 140 | } |
|
| 141 | ||
| 142 | public function getRecentMythic($mythic_pokemon) |
|
| 143 | { |
|
| @@ 305-317 (lines=13) @@ | ||
| 302 | return $data; |
|
| 303 | } |
|
| 304 | ||
| 305 | public function getPokemonCountAll() |
|
| 306 | { |
|
| 307 | $req = 'SELECT pokemon_id, SUM(count) as count, MAX(date) as last_seen_day |
|
| 308 | FROM pokemon_stats |
|
| 309 | GROUP BY pokemon_id'; |
|
| 310 | $result = $this->mysqli->query($req); |
|
| 311 | $array = array(); |
|
| 312 | while ($data = $result->fetch_object()) { |
|
| 313 | $array[] = $data; |
|
| 314 | } |
|
| 315 | ||
| 316 | return $array; |
|
| 317 | } |
|
| 318 | ||
| 319 | ||
| 320 | public function getRaidCount($pokemon_id) |
|
| @@ 331-343 (lines=13) @@ | ||
| 328 | return $data; |
|
| 329 | } |
|
| 330 | ||
| 331 | public function getRaidCountAll() |
|
| 332 | { |
|
| 333 | $req = 'SELECT pokemon_id, SUM(count) as count, MAX(date) as last_seen_day |
|
| 334 | FROM raid_stats |
|
| 335 | GROUP BY pokemon_id'; |
|
| 336 | $result = $this->mysqli->query($req); |
|
| 337 | $array = array(); |
|
| 338 | while ($data = $result->fetch_object()) { |
|
| 339 | $array[] = $data; |
|
| 340 | } |
|
| 341 | ||
| 342 | return $array; |
|
| 343 | } |
|
| 344 | ||
| 345 | /////////////// |
|
| 346 | // Pokestops |
|
| @@ 358-368 (lines=11) @@ | ||
| 355 | return $data; |
|
| 356 | } |
|
| 357 | ||
| 358 | public function getAllPokestops() |
|
| 359 | { |
|
| 360 | $req = 'SELECT lat as latitude, lon as longitude, lure_expire_timestamp AS lure_expiration, UNIX_TIMESTAMP() AS now, FROM_UNIXTIME(lure_expire_timestamp) AS lure_expiration_real FROM pokestop'; |
|
| 361 | $result = $this->mysqli->query($req); |
|
| 362 | $pokestops = array(); |
|
| 363 | while ($data = $result->fetch_object()) { |
|
| 364 | $pokestops[] = $data; |
|
| 365 | } |
|
| 366 | ||
| 367 | return $pokestops; |
|
| 368 | } |
|
| 369 | ||
| 370 | ///////// |
|
| 371 | // Gyms |
|
| @@ 390-401 (lines=12) @@ | ||
| 387 | return $data; |
|
| 388 | } |
|
| 389 | ||
| 390 | public function getAllGyms() |
|
| 391 | { |
|
| 392 | $req = 'SELECT id as gym_id, team_id, lat as latitude, lon as longitude, updated as last_scanned, (6 - availble_slots) AS level |
|
| 393 | FROM gym'; |
|
| 394 | $result = $this->mysqli->query($req); |
|
| 395 | $gyms = array(); |
|
| 396 | while ($data = $result->fetch_object()) { |
|
| 397 | $gyms[] = $data; |
|
| 398 | } |
|
| 399 | ||
| 400 | return $gyms; |
|
| 401 | } |
|
| 402 | ||
| 403 | public function getGymData($gym_id) |
|
| 404 | { |
|
| @@ 491-501 (lines=11) @@ | ||
| 488 | // Cron |
|
| 489 | ///////// |
|
| 490 | ||
| 491 | public function getPokemonCountsActive() |
|
| 492 | { |
|
| 493 | $req = 'SELECT pokemon_id, COUNT(*) as total FROM pokemon WHERE expire_timestamp >= UNIX_TIMESTAMP() GROUP BY pokemon_id'; |
|
| 494 | $result = $this->mysqli->query($req); |
|
| 495 | $counts = array(); |
|
| 496 | while ($data = $result->fetch_object()) { |
|
| 497 | $counts[$data->pokemon_id] = $data->total; |
|
| 498 | } |
|
| 499 | ||
| 500 | return $counts; |
|
| 501 | } |
|
| 502 | ||
| 503 | public function getTotalPokemonIV() |
|
| 504 | { |
|
| @@ 512-526 (lines=15) @@ | ||
| 509 | return $data; |
|
| 510 | } |
|
| 511 | ||
| 512 | public function getPokemonCountsLastDay() |
|
| 513 | { |
|
| 514 | $req = 'SELECT pokemon_id, COUNT(*) AS spawns_last_day |
|
| 515 | FROM pokemon |
|
| 516 | WHERE expire_timestamp >= (SELECT MAX(expire_timestamp) - 86400 FROM pokemon) |
|
| 517 | GROUP BY pokemon_id |
|
| 518 | ORDER BY pokemon_id ASC'; |
|
| 519 | $result = $this->mysqli->query($req); |
|
| 520 | $counts = array(); |
|
| 521 | while ($data = $result->fetch_object()) { |
|
| 522 | $counts[$data->pokemon_id] = $data->spawns_last_day; |
|
| 523 | } |
|
| 524 | ||
| 525 | return $counts; |
|
| 526 | } |
|
| 527 | ||
| 528 | public function getCaptchaCount() |
|
| 529 | { |
|
| @@ 124-141 (lines=18) @@ | ||
| 121 | return $data; |
|
| 122 | } |
|
| 123 | ||
| 124 | public function getRecentAll() |
|
| 125 | { |
|
| 126 | $req = "SELECT DISTINCT pokemon_id, encounter_id, disappear_time, last_modified, |
|
| 127 | CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."') AS disappear_time_real, |
|
| 128 | latitude, longitude, cp, individual_attack, individual_defense, individual_stamina |
|
| 129 | FROM pokemon |
|
| 130 | ORDER BY last_modified DESC |
|
| 131 | LIMIT 0,12"; |
|
| 132 | $result = $this->mysqli->query($req); |
|
| 133 | $data = array(); |
|
| 134 | if ($result->num_rows > 0) { |
|
| 135 | while ($row = $result->fetch_object()) { |
|
| 136 | $data[] = $row; |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||
| 140 | return $data; |
|
| 141 | } |
|
| 142 | ||
| 143 | public function getRecentMythic($mythic_pokemons) |
|
| 144 | { |
|
| @@ 333-345 (lines=13) @@ | ||
| 330 | return $data; |
|
| 331 | } |
|
| 332 | ||
| 333 | public function getPokemonCountAll() |
|
| 334 | { |
|
| 335 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 336 | FROM pokemon_stats |
|
| 337 | GROUP BY pid'; |
|
| 338 | $result = $this->mysqli->query($req); |
|
| 339 | $array = array(); |
|
| 340 | while ($data = $result->fetch_object()) { |
|
| 341 | $array[] = $data; |
|
| 342 | } |
|
| 343 | ||
| 344 | return $array; |
|
| 345 | } |
|
| 346 | ||
| 347 | public function getRaidCount($pokemon_id) |
|
| 348 | { |
|
| @@ 358-370 (lines=13) @@ | ||
| 355 | return $data; |
|
| 356 | } |
|
| 357 | ||
| 358 | public function getRaidCountAll() |
|
| 359 | { |
|
| 360 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 361 | FROM raid_stats |
|
| 362 | GROUP BY pid'; |
|
| 363 | $result = $this->mysqli->query($req); |
|
| 364 | $array = array(); |
|
| 365 | while ($data = $result->fetch_object()) { |
|
| 366 | $array[] = $data; |
|
| 367 | } |
|
| 368 | ||
| 369 | return $array; |
|
| 370 | } |
|
| 371 | ||
| 372 | /////////////// |
|
| 373 | // Pokestops |
|
| @@ 403-417 (lines=15) @@ | ||
| 400 | // Gyms |
|
| 401 | ///////// |
|
| 402 | ||
| 403 | public function getTeamGuardians($team_id) |
|
| 404 | { |
|
| 405 | $req = "SELECT COUNT(*) AS total, guard_pokemon_id |
|
| 406 | FROM gym WHERE team_id = '".$team_id."' |
|
| 407 | GROUP BY guard_pokemon_id |
|
| 408 | ORDER BY total DESC |
|
| 409 | LIMIT 0,3"; |
|
| 410 | $result = $this->mysqli->query($req); |
|
| 411 | $datas = array(); |
|
| 412 | while ($data = $result->fetch_object()) { |
|
| 413 | $datas[] = $data; |
|
| 414 | } |
|
| 415 | ||
| 416 | return $datas; |
|
| 417 | } |
|
| 418 | ||
| 419 | public function getOwnedAndPoints($team_id) |
|
| 420 | { |
|
| @@ 462-477 (lines=16) @@ | ||
| 459 | return $data; |
|
| 460 | } |
|
| 461 | ||
| 462 | public function getGymDefenders($gym_id) |
|
| 463 | { |
|
| 464 | $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 465 | FROM gympokemon |
|
| 466 | INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid |
|
| 467 | GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id |
|
| 468 | HAVING gymmember.gym_id='".$gym_id."' |
|
| 469 | ORDER BY cp DESC"; |
|
| 470 | $result = $this->mysqli->query($req); |
|
| 471 | $defenders = array(); |
|
| 472 | while ($data = $result->fetch_object()) { |
|
| 473 | $defenders[] = $data; |
|
| 474 | } |
|
| 475 | ||
| 476 | return $defenders; |
|
| 477 | } |
|
| 478 | ||
| 479 | //////////////// |
|
| 480 | // Gym History |
|
| @@ 519-534 (lines=16) @@ | ||
| 516 | return $gym_history; |
|
| 517 | } |
|
| 518 | ||
| 519 | public function getGymHistoriesPokemon($gym_id) |
|
| 520 | { |
|
| 521 | $req = "SELECT DISTINCT gymmember.pokemon_uid, pokemon_id, cp, trainer_name |
|
| 522 | FROM gymmember |
|
| 523 | LEFT JOIN gympokemon |
|
| 524 | ON gymmember.pokemon_uid = gympokemon.pokemon_uid |
|
| 525 | WHERE gymmember.gym_id = '".$gym_id."' |
|
| 526 | ORDER BY deployment_time"; |
|
| 527 | $result = $this->mysqli->query($req); |
|
| 528 | $pokemons = array(); |
|
| 529 | while ($data = $result->fetch_object()) { |
|
| 530 | $pokemons[] = $data; |
|
| 531 | } |
|
| 532 | ||
| 533 | return $pokemons; |
|
| 534 | } |
|
| 535 | ||
| 536 | public function getHistoryForGym($page, $gym_id) |
|
| 537 | { |
|
| @@ 768-781 (lines=14) @@ | ||
| 765 | // Cron |
|
| 766 | ///////// |
|
| 767 | ||
| 768 | public function getPokemonCountsActive() |
|
| 769 | { |
|
| 770 | $req = 'SELECT pokemon_id, COUNT(*) as total |
|
| 771 | FROM pokemon |
|
| 772 | WHERE disappear_time >= UTC_TIMESTAMP() |
|
| 773 | GROUP BY pokemon_id'; |
|
| 774 | $result = $this->mysqli->query($req); |
|
| 775 | $counts = array(); |
|
| 776 | while ($data = $result->fetch_object()) { |
|
| 777 | $counts[$data->pokemon_id] = $data->total; |
|
| 778 | } |
|
| 779 | ||
| 780 | return $counts; |
|
| 781 | } |
|
| 782 | ||
| 783 | ||
| 784 | public function getTotalPokemonIV() |
|
| @@ 795-809 (lines=15) @@ | ||
| 792 | return $data; |
|
| 793 | } |
|
| 794 | ||
| 795 | public function getPokemonCountsLastDay() |
|
| 796 | { |
|
| 797 | $req = 'SELECT pokemon_id, COUNT(*) AS spawns_last_day |
|
| 798 | FROM pokemon |
|
| 799 | WHERE disappear_time >= (SELECT MAX(disappear_time) FROM pokemon) - INTERVAL 1 DAY |
|
| 800 | GROUP BY pokemon_id |
|
| 801 | ORDER BY pokemon_id ASC'; |
|
| 802 | $result = $this->mysqli->query($req); |
|
| 803 | $counts = array(); |
|
| 804 | while ($data = $result->fetch_object()) { |
|
| 805 | $counts[$data->pokemon_id] = $data->spawns_last_day; |
|
| 806 | } |
|
| 807 | ||
| 808 | return $counts; |
|
| 809 | } |
|
| 810 | ||
| 811 | public function getCaptchaCount() |
|
| 812 | { |
|
| @@ 330-342 (lines=13) @@ | ||
| 327 | return $data; |
|
| 328 | } |
|
| 329 | ||
| 330 | public function getPokemonCountAll() |
|
| 331 | { |
|
| 332 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 333 | FROM pokemon_stats |
|
| 334 | GROUP BY pid'; |
|
| 335 | $result = $this->mysqli->query($req); |
|
| 336 | $array = array(); |
|
| 337 | while ($data = pg_fetch_object($result)) { |
|
| 338 | $array[] = $data; |
|
| 339 | } |
|
| 340 | ||
| 341 | return $array; |
|
| 342 | } |
|
| 343 | ||
| 344 | public function getRaidCount($pokemon_id) |
|
| 345 | { |
|
| @@ 355-367 (lines=13) @@ | ||
| 352 | return $data; |
|
| 353 | } |
|
| 354 | ||
| 355 | public function getRaidCountAll() |
|
| 356 | { |
|
| 357 | $req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude |
|
| 358 | FROM raid_stats |
|
| 359 | GROUP BY pid'; |
|
| 360 | $result = $this->mysqli->query($req); |
|
| 361 | $array = array(); |
|
| 362 | while ($data = pg_fetch_object($result)) { |
|
| 363 | $array[] = $data; |
|
| 364 | } |
|
| 365 | ||
| 366 | return $array; |
|
| 367 | } |
|
| 368 | ||
| 369 | /////////////// |
|
| 370 | // Pokestops |
|