<?php
declare (strict_types = 1);

namespace app\index\controller;
use app\index\middleware\Cookie;
use app\lib\model\{Type};

class Index
{
    //中间件
    protected $middleware = [Cookie::class];

    public function index()
    {
        // 模板变量赋值
        $data = request()->Config;

        $data['login'] = http_url(isset($data['user_dz'])?$data['user_dz'].'.php':'','login',[],isset($data['user_url'])?explode(',',$data['user_url']):true);
        // 模板输出
        return view('index',['data'=>$data]);
    }

    //文档
    public function api()
    {
        // 模板变量赋值
        $data = request()->Config;
        $data['pay_type'] = Type::field('name,showname')->where('status', 1)->select();
        // 模板输出
        return view('',['data'=>$data]);
    }
}
