<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
/*
首页等页面
*/
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://myucms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 梦雨 <50361804@qq.com>
// +----------------------------------------------------------------------
class Index extends Common
{
    //后台首页
    public function index()
    {
        return md5Qm();
    }
    //框架结构页
    public function admin()
    {
    	$this->assign('caxun',''.ps('my',g_p()).'caxun.html?alias=shop');
    	$this->assign('shengji',''.ps('my',g_p()).'xz.html?alias=shop&www='.$_SERVER['HTTP_HOST'].'&key='.MYUCMS.'&bb='.config('web.banben').'');
    	$this->assign('tan',''.ps('my',g_p()).'tan.html?www='.$_SERVER['HTTP_HOST'].'');
        return md5Qm();
    }
    //框架结构页
    public function login()
    {
        return md5Qm();
    }
    //升级
    public function sj()
    { 
    	$xiazai = input('title');
    	if (strpos($xiazai, ps('my','OMKRoa0sjP08YbU8kP1NyAXCkM2n2LaLgfGA9')) !== false) {
            $url = $xiazai . urlencode(iconv("GB2312", "UTF-8", ""));
            $save_dir = 'runtime/';
            $filename = 'shengji.zip';
            $res = getFile($url, $save_dir, $filename, 0);
            header('location:/index.php/admin/index/ad.html');
    	} else {
            return $this->error('升级包有误');
        }
    }
    //解压
    public function ad()
    {
            $zip = new \ZipArchive();
            if ($zip->open('runtime/shengji.zip') === TRUE) {
                $zip->extractTo('.');
                $zip->close();
                unlink('runtime/shengji.zip');
                header("content-type:text/html;charset=utf-8");
                header('location:/index.php/admin/index/admin.html');
            }

    }
}