From ddeeec6b5609ce3f795fce748b4b7a848dc908d4 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 2 May 2017 15:38:25 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E6=B7=BB=E5=8A=A0=E5=8F=8B?= =?UTF-8?q?=E7=9B=9FCNZZ=E7=BB=9F=E8=AE=A1=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/config.index.html | 8 ++++++++ extend/hook/FilterView.php | 25 ++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/application/admin/view/config.index.html b/application/admin/view/config.index.html index 4814e8d17..74e61348c 100644 --- a/application/admin/view/config.index.html +++ b/application/admin/view/config.index.html @@ -49,6 +49,14 @@ +
+ +
+ +

友盟统计应用ID,可以在友盟网站统计申请并获取

+
+
+
diff --git a/extend/hook/FilterView.php b/extend/hook/FilterView.php index 29a267667..e7fb05200 100644 --- a/extend/hook/FilterView.php +++ b/extend/hook/FilterView.php @@ -25,20 +25,29 @@ use think\Request; */ class FilterView { + /** + * 当前请求对象 + * @var Request + */ + protected $request; + /** * 行为入口 * @param $params */ public function run(&$params) { - $app = Request::instance()->root(true); + $this->request = Request::instance(); + $app = $this->request->root(true); $replace = [ '__APP__' => $app, - '__SELF__' => Request::instance()->url(true), + '__SELF__' => $this->request->url(true), '__PUBLIC__' => strpos($app, EXT) ? ltrim(dirname($app), DS) : $app, ]; $params = str_replace(array_keys($replace), array_values($replace), $params); - $this->baidu($params); - $this->cnzz($params); + if (!IS_CLI) { + $this->baidu($params); + $this->cnzz($params); + } } /** @@ -46,7 +55,7 @@ class FilterView { * @param $params */ public function baidu(&$params) { - if (!IS_CLI && ($key = sysconf('tongji_baidu_key'))) { + if (($key = sysconf('tongji_baidu_key'))) { $script = <<