| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace Heanup\App\Api\Controller;
- use Heanup\App\Api\Config\Site;
- use Heanup\App\Api\Controller;
- use Heanup\App\Api\Model\Dataoke;
- class Category extends Controller
- {
- protected function main()
- {
- if (isMobile()) {
- header("location: /tao.php");
- die();
- }
- // $id = $this->getQuery()->intval("id");
- $id = $this->getQuery()->string("args_0");
- $page = $this->getQuery()->string("args_1");
- $request = [
- 'r' => 'l',
- 'site' => 'classify',
- 'cid' => $id,
- ];
- $bids = $this->getQuery()->string("bids");
- $original_id = $this->getQuery()->string("original_id");
- if ($bids) {
- $request['bids'] = $bids;
- }
- if ($original_id) {
- $request['original_id'] = $original_id;
- }
- if ($page) {
- $request['page'] = $page;
- }
- $sort = $this->getQuery()->string("s");
- if ($sort) {
- $request['s'] = $sort;
- }
- $url = Site::getData('site_url') . "/tao.php?" . http_build_query($request);
- $content= Dataoke::parse(file_get_contents($url));
- $this->setCache($content);
- }
- protected function after()
- {
- $id = $this->getQuery()->string("args_0");
- $page = $this->getQuery()->string("args_1");
- if ($page) {
- $site_url = Site::getData('site_url') . "/category/" . $id . "/page_" . $page . ".html";
- } else {
- $site_url = Site::getData('site_url') . "/category/" . $id . "/index.html";
- }
- $this->addSitemap($site_url);
- }
- }
|