Index.php 1.4 KB
<?php

namespace app\index\controller;

use app\common\controller\Frontend;

class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

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

    /**
     * 下载APP
     */
    public function download()
    {
        $href = '';
        $browser = 0;
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') == true) {
            $browser = 1;
        } else if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') == true) {
            $browser = 2;
        }
        if (stristr($_SERVER['HTTP_USER_AGENT'], 'Android')) {
            //echo '你的手机是:Android系统';
//            $ver = Db::name('version')->order('id', 'DESC')->find();
            $href = request()->domain() . '/package/android_debug.apk';
        } else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
            //echo '你的手机是:ISO系统';
            $browser = 3;
        }
        $this->assign('url', $href);
        $this->assign('browser', $browser);
        return $this->view->fetch();
    }

    /**
     * 用户协议及隐私协议
     */
    public function agreement()
    {
        $content = db('mobile_config')->where('id',1)->value('agreement');
        $this->assign('content',$content);
        return $this->view->fetch();
    }

}