<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use think\Db;

class Index extends Frontend
{

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

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

    /**
     * 获取网站配置信息
     */
    public function info() {
        $params = $this->request->request("params"); //内容
        $this->view->assign('info',config("site.".$params));
        return $this->view->fetch();
    }

    //邀请页面
    public function invite() {
        $code = input('code', '', 'trim');
        if (!$code) {
            $this->error('邀请码不存在');
        }

        $count = Db::name('user')->where(['invite_no' => $code])->count();
        if (!$count) {
            $this->error('邀请码不存在');
        }

        $this->view->assign('code', $code);

        return $this->view->fetch();
    }

}