Index.php 2.0 KB

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