Index.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. class Index extends Controller
  6. {
  7. protected $noNeedLogin = '*';
  8. protected $noNeedRight = '*';
  9. protected $layout = '';
  10. public function index()
  11. {
  12. return $this->view->fetch();
  13. }
  14. // 新闻详情
  15. public function news_detail()
  16. {
  17. $id = input('id',0,'intval');
  18. $info = Db::name('news')->field('id,title,content,create_time')->where('id',$id)->where('status',1)->find();
  19. if($info){
  20. $info['create_time_text'] = date('Y-m-d H:i',$info['create_time']);
  21. }
  22. $this->view->assign('info', $info);
  23. return $this->view->fetch();
  24. }
  25. /**
  26. * app下载页
  27. * 判断是安卓还是ios
  28. */
  29. public function appdownload() {
  30. if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
  31. header("Location: ".config('site.user_ios_download_url'));
  32. }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
  33. $this->view->assign('downurl', config("site.user_android_download_url"));
  34. return $this->view->fetch();
  35. }else{
  36. $this->view->assign('downurl', config("site.user_android_download_url"));
  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. if(!$content){
  48. exit;
  49. }
  50. $this->assign('content',$content['content']);
  51. return $this->fetch();
  52. }
  53. }