| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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()
- {
- // $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);
- }
- }
|