Index.php 1.4 KB

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