<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/11/011
 * Time: 19:58
 */

namespace frontend\modules\cp\controllers;

use Yii;
use frontend\models\AdminApi;

class CommonController extends BaseController
{
    public function actionFrameHeader()
    {
        return $this->renderPartial('frame_header');
    }

    public function actionFrameMain()
    {
        return $this->renderPartial('frame_main');
    }

    public function actionFrameMenu()
    {
        return $this->renderPartial('frame_menu');
    }

    public function actionFrameMiddle()
    {
        return $this->renderPartial('frame_middle');
    }

    public function actionFrameContentMenu()
    {
        return $this->renderPartial('frame_content_menu');
    }

    public function actionFrameSetUpMenu()
    {
        return $this->renderPartial('frame_setup_menu');
    }

    public function actionCssJsMain()
    {
        return $this->renderPartial('css_js_main');
    }

    public function actionSuccess()
    {
        $redirectUrl = Yii::$app->request->get('redirectUrl', ''); // 参数可选
        $tip = Yii::$app->request->get('tip', ''); // 参数可选
        return $this->renderPartial('success', ['redirectUrl' => $redirectUrl, 'tip' => $tip]);
    }

    public function actionError()
    {
        $redirectUrl = Yii::$app->request->get('redirectUrl', ''); // 参数可选
        $tip = Yii::$app->request->get('tip', ''); // 参数可选
        return $this->renderPartial('error', ['redirectUrl' => $redirectUrl, 'tip' => $tip]);
    }
    
    public function actionGetCommonInfo()
    {
        $api = new AdminApi();
        $commonInfo = $api->getCommonInfo()['data'];
        return json_encode($commonInfo);
    }
}
