Blame view

app-wx/controllers/ErrorController.php 1.63 KB
62d73041   xu   app-wx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php namespace app\wx\controllers;

use common\models\SysSetting;
use yii;

/**
 *  错误控制
 * Class ErrorController
 * @package app\wx\controllers
 */
class ErrorController extends yii\web\Controller
{
    protected $site;
    public function init()
    {
        \yii::$app->name = '系统通知';
        $this->site = new \stdClass();
        $this->getSite();
        $view = \yii::$app->view;
        $view->params['site'] = $this->site;
    }

    public function getSite()
    {

        $url = \yii::$app->request->getHostInfo() . \yii::$app->request->url;
        $this->site->url = $url;
        if(YII_ENV_DEV){
            $this->site->base_url = \yii::$app->request->getHostInfo() . \yii::$app->request->baseUrl;
        } else {
            $this->site->base_url = \yii::$app->request->getHostInfo();
        }
        $this->site->assets_url = $url;
        $this->site->title = '通知';
        $this->site->desc = '';
        $this->site->icon = '';
        $this->site->appid = '';
        $this->site->timestamp = '';
        $this->site->noncestr = '';
        $this->site->signature = '';
        $this->site->user_bridge_url = '';
        $this->site->sn = '';

        return $this->site;
    }

    /** 系统暂停
     * @return string
     */
    public function actionStop()
    {
        $this->layout = 'site';
        \yii::$app->name = '系统通知';
        $viewTpl = '@app/wx/views/site/error/stop.php';
        $siteInfo = SysSetting::getClientSiteInfo();

        return $this->render($viewTpl,['stop_status'=> $siteInfo['stop'], 'stop_head'=>  $siteInfo['stop_head'], 'stop_content'=> $siteInfo['stop_content']]);
    }

}