Category.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Heanup\App\Api\Controller;
  3. use Heanup\App\Api\Config\Site;
  4. use Heanup\App\Api\Controller;
  5. use Heanup\App\Api\Model\Dataoke;
  6. class Category extends Controller
  7. {
  8. protected function main()
  9. {
  10. // $id = $this->getQuery()->intval("id");
  11. $id = $this->getQuery()->string("args_0");
  12. $page = $this->getQuery()->string("args_1");
  13. $request = [
  14. 'r' => 'l',
  15. 'site' => 'classify',
  16. 'cid' => $id,
  17. ];
  18. $bids = $this->getQuery()->string("bids");
  19. $original_id = $this->getQuery()->string("original_id");
  20. if ($bids) {
  21. $request['bids'] = $bids;
  22. }
  23. if ($original_id) {
  24. $request['original_id'] = $original_id;
  25. }
  26. if ($page) {
  27. $request['page'] = $page;
  28. }
  29. $url = Site::getData('site_url') . "/tao.php?" . http_build_query($request);
  30. echo Dataoke::parse(file_get_contents($url));
  31. }
  32. protected function after()
  33. {
  34. $id = $this->getQuery()->string("args_0");
  35. $page = $this->getQuery()->string("args_1");
  36. if ($page) {
  37. $site_url = Site::getData('site_url') . "/category/" . $id . "/page_" . $page . ".html";
  38. } else {
  39. $site_url = Site::getData('site_url') . "/category/" . $id . "/index.html";
  40. }
  41. $this->addSitemap($site_url);
  42. }
  43. }