Index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\index\controller;
  3. //use app\common\controller\Frontend;
  4. use think\Controller;
  5. use think\Db;
  6. class Index extends Controller
  7. {
  8. protected $noNeedLogin = '*';
  9. protected $noNeedRight = '*';
  10. protected $layout = '';
  11. public function index()
  12. {
  13. return $this->view->fetch();
  14. }
  15. /**
  16. * app下载页
  17. * 判断是安卓还是ios
  18. */
  19. public function appdownload() {
  20. /*$this->view->assign('downurl', config("site.apkurl"));
  21. return $this->view->fetch();*/
  22. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  23. header("Location: ".config('site.ios_downurl'));
  24. }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  25. //$host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  26. //header("Location: ".$host."/index/index/download");
  27. $this->view->assign('downurl', config("site.android_apkUrl"));
  28. return $this->view->fetch();
  29. }else{
  30. $this->view->assign('downurl', config("site.android_apkUrl"));
  31. return $this->view->fetch();
  32. }
  33. }
  34. //基础文章网页
  35. public function basedata(){
  36. $key = input('key','');
  37. if(!$key){
  38. exit;
  39. }
  40. $content = Db::name('basedata')->where('key',$key)->find();
  41. $this->assign('content',$content['content']);
  42. return $this->fetch();
  43. }
  44. }