Index.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\index\controller;
  3. use app\common\controller\Frontend;
  4. class Index extends Frontend
  5. {
  6. protected $noNeedLogin = '*';
  7. protected $noNeedRight = '*';
  8. protected $layout = '';
  9. public function index()
  10. {
  11. return $this->view->fetch();
  12. }
  13. /**
  14. * 服务协议
  15. * @return string
  16. * @throws \think\Exception
  17. */
  18. public function service()
  19. {
  20. $this->view->assign('content', config("site.userAgreement"));
  21. return $this->view->fetch();
  22. }
  23. /**
  24. * 隐私政策
  25. * @return string
  26. * @throws \think\Exception
  27. */
  28. public function privacy()
  29. {
  30. $this->view->assign('content', config("site.privacyAgreement"));
  31. return $this->view->fetch();
  32. }
  33. /**
  34. * 判断是安卓还是ios
  35. */
  36. public function appJump() {
  37. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  38. header("Location: https://apps.apple.com/cn/app/%E4%BC%B4%E5%A3%B0%E8%AF%AD%E9%9F%B3/id1556551099");
  39. }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  40. $host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  41. header("Location: ".$host."/index/index/download");
  42. }else{
  43. echo '机型暂不支持!';
  44. }
  45. }
  46. /**
  47. * 下载app中转页
  48. */
  49. public function download() {
  50. $this->redirect('http://www.baidu.com');
  51. $this->view->assign('downurl', config("site.apkUrl"));
  52. return $this->view->fetch();
  53. }
  54. public function appdownload() {
  55. $this->redirect('http://www.baidu.com');
  56. /*$this->view->assign('downurl', config("site.apkUrl"));
  57. return $this->view->fetch();*/
  58. }
  59. //判断是否微信浏览器 -xzz1125
  60. function is_weixin() {
  61. if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
  62. return true;
  63. } return false;
  64. }
  65. }