Search.php 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 Search extends Controller
  7. {
  8. public function main()
  9. {
  10. $kw = $this->getQuery()->string("kw")?:$this->getQuery()->string("args_0");
  11. $bids = $this->getQuery()->string("bids");
  12. $cid = $this->getQuery()->string("cid");
  13. $page = $this->getQuery()->string("args_1");
  14. $request=[
  15. 'r'=>'l',
  16. 'u'=>Site::getData("user_tag")
  17. ];
  18. if ($kw){
  19. $request['kw']=urldecode($kw);
  20. }
  21. if ($bids){
  22. $request['bids']=$bids;
  23. }
  24. if ($cid){
  25. $request['cid']=$cid;
  26. }
  27. if ($page){
  28. $request['page']=$page;
  29. }
  30. $url = Site::getData('site_url') . "/tao.php?".http_build_query($request);
  31. $content= Dataoke::parse(file_get_contents($url));
  32. $this->setCache($content);
  33. }
  34. }