Blame view

app-wx/controllers/SiteController.php 2.75 KB
62d73041   xu   app-wx
1
2
3
4
<?php
namespace app\wx\controllers;

use Yii;
62d73041   xu   app-wx
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
use app\wx\models\Engineer;
use common\models\EngineerProfile;
use common\helpers\WxHelper;
use common\models\SysSetting;

use stdClass;

/**
 * Site-控制器
 * Class SiteController
 * @package app\wx\controllers
 */
class SiteController extends BaseController
{
    public $layout = 'site';

    /**
     * @param yii\base\Action $action
     * @return bool
     * @throws yii\web\BadRequestHttpException
     */
    public function beforeAction($action)
    {
        $view = Yii::$app->view;
        $view->params['site']= $this->site;

        //$this->handleMallAccessCtrl();
        return parent::beforeAction($action);
    }

    /**
     * @return string
     * @return string HTML
7d60e23d   xu   app-wx(v0.1.0 bui...
38
     */
62d73041   xu   app-wx
39
40
41
    public function actionIndex()
    {

7d60e23d   xu   app-wx(v0.1.0 bui...
42
        /**
62d73041   xu   app-wx
43
44
45
         * 构造user的共用信息
         */

62d73041   xu   app-wx
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

        return $this->render('index');
    }



    /*
        * 错误页面
        */
    public function actionError()
    {
        $this->layout = '/error';

        $exception = Yii::$app->errorHandler->exception;
        if ($exception && isset($exception->statusCode)) {
            $code = $exception->statusCode;
        }
      //  $viewTpl = 'error/' . $code . '.php';
        $viewTpl = 'error/404.php';

        return $this->render($viewTpl);
    }

    /** 封号提示
     * @return string
7d60e23d   xu   app-wx(v0.1.0 bui...
71
72
     */
    public function actionBlock()
62d73041   xu   app-wx
73
74
75
76
77
78
79
80
81
    {
        $this->layout = '/error';
        $viewTpl = 'error/block.php';
        $service_phone = '4000000000';
        return $this->render($viewTpl,['service_phone'=> $service_phone]);
    }

    /** 关注提示
     * @return string
7d60e23d   xu   app-wx(v0.1.0 bui...
82
     */
62d73041   xu   app-wx
83
84
85
86
87
88
89
90
91
92
93
    public function actionSubscribe()
    {
        $this->layout = '/error';
        $viewTpl = 'error/subscribe.php';
        $service_phone = '4000000000';
        return $this->render($viewTpl,['service_phone'=>$service_phone]);
    }

    /**
     * 未授权提示
     */
7d60e23d   xu   app-wx(v0.1.0 bui...
94
    public function actionNoOauth()
62d73041   xu   app-wx
95
96
97
98
99
100
101
102
103
    {
        $this->layout = '/error';
        $viewTpl = 'error/block.php';
        $id = $this->request->get('id');
        $service_phone = '4000000000';
        $errorMsg = '当前没有权限查看该内容';
        if ($id == 1) {
            $errorMsg = '请进行认证以后再来查看该页面';
        }
62d73041   xu   app-wx
104
105
106
107
        return $this->render($viewTpl,['service_phone'=>$service_phone, 'errorMsg' => $errorMsg]);
    }

    public function actionIndex2()
7d60e23d   xu   app-wx(v0.1.0 bui...
108
109
    {
        return $this->renderPartial('index2');
62d73041   xu   app-wx
110
    }
7d60e23d   xu   app-wx(v0.1.0 bui...
111

62d73041   xu   app-wx
112
    /**
7d60e23d   xu   app-wx(v0.1.0 bui...
113
114
115
     * 推送给客户的短链接
     * @return \yii\web\Response
     */
62d73041   xu   app-wx
116
    public function actionT()
7d60e23d   xu   app-wx(v0.1.0 bui...
117
    {
62d73041   xu   app-wx
118
        $shortUUID = $this->request->get('o');