<?php
namespace app\file\controller;

use think\Controller;
use think\Db;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2021 http://mifenlei.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: @梦雨 <50361804@qq.com>
// +----------------------------------------------------------------------
class Index extends Controller
{
    public function _initialize()
    {
        return json(array('code' => 0, 'msg' => config('web.mifenlei')));
    }
    //模板文件列表
    public function index()
    {
        return $this->fetch('/index');
    }
    // 编辑
    public function updata()
    {
        if (strpos(input('id'), 'template') === false) {
            $this->error('你迷路了', url('index/index/index'));
        }
        if (request()->isPost()) {
	    	return json(array('code' => 0, 'msg' => config('web.mifenlei')));
    	} 
    	$this->assign('id',input('id'));
        return $this->fetch('/updata');
    }
    //创建文件
    public function establish()
    {
        if (strpos(input('name'), 'template') === false) {
            $this->error('你迷路了', url('index/index/index'));
        }
    	return json(array('code' => 0, 'msg' => config('web.mifenlei')));
    }
    //删除文件
    public function delete()
    {
        return json(array('code' => 0, 'msg' => config('web.mifenlei')));
    }
}