<?php

namespace app\index\controller;

use think\Controller;
use think\Db;
class Index extends Controller
{



    public function index()
    {
        return $this->view->fetch();
    }


    /**
     * app下载页
     * 判断是安卓还是ios
     */
    public function appdownload() {

        if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')||strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')){
            header("Location: ".config('site.user_ios_download_url'));
        }else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Android')){
            $this->view->assign('downurl', config("site.user_android_download_url"));
            return $this->view->fetch();
        }else{
            $this->view->assign('downurl', config("site.user_android_download_url"));
            return $this->view->fetch();
        }
    }

    //基础文章网页
    public function basedata(){
        $key = input('key','');
        if(!$key){
            exit;
        }
        $content = Db::name('basedata')->where('key',$key)->find();
        $this->assign('content',$content['content']);
        return $this->fetch();
    }

    //系统公告
    public function messagesys(){
        $id = input('id','');
        if(!$id){
            exit;
        }
        $content = Db::name('message_sys')->where('id',$id)->find();
        $this->assign('content',$content['info']);
        return $this->fetch('basedata');
    }

}
