Index.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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->view->assign('downurl', config("site.apkUrl"));
  51. return $this->view->fetch();
  52. }
  53. public function appdownload() {
  54. $this->view->assign('downurl', config("site.apkUrl"));
  55. return $this->view->fetch();
  56. }
  57. //判断是否微信浏览器 -xzz1125
  58. function is_weixin() {
  59. if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
  60. return true;
  61. } return false;
  62. }
  63. }