From c7bdf42447ea09f7e5ef3e5ee758bf4bc72d2273 Mon Sep 17 00:00:00 2001 From: molong Date: Sun, 1 Jan 2017 08:27:49 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=A7=A3=E5=86=B3doc=E6=A0=87?= =?UTF-8?q?=E7=AD=BEbug=EF=BC=88=E9=9B=B6=E6=97=B6=EF=BC=89=202=E3=80=81?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=99=E7=82=B9=E7=9A=84=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Fornt.php | 2 +- application/common/model/Document.php | 3 +++ core/extend/com/Sent.php | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/application/common/controller/Fornt.php b/application/common/controller/Fornt.php index 00bf2a22..085a716f 100644 --- a/application/common/controller/Fornt.php +++ b/application/common/controller/Fornt.php @@ -38,7 +38,7 @@ class Fornt extends Base { //网站主题设置 $themes['mobile'] = config('mobile_themes') ? config('mobile_themes') : 'mobile'; $themes['pc'] = config('pc_themes') ? config('pc_themes') : 'default'; - $view_path = $this->isMobile() ? 'template/' . $themes['mobile'] . '/' : 'template/' . $themes['pc'] . '/'; + $view_path = ($this->isMobile() && config('open_mobile_site')) ? 'template/' . $themes['mobile'] . '/' : 'template/' . $themes['pc'] . '/'; $module = $this->request->module(); if (!in_array($module, array('index', 'install'))) { $view_path_pre = $module . '/'; diff --git a/application/common/model/Document.php b/application/common/model/Document.php index f9999672..3516a678 100644 --- a/application/common/model/Document.php +++ b/application/common/model/Document.php @@ -71,6 +71,9 @@ class Document extends Base{ } public function extend($name){ + if (is_numeric($name)) { + $name = db('Model')->where('id', $name)->value('name'); + } $this->extend_db = db('Document' . ucfirst($name)); $name = strtoupper($name); //$this->join('__DOCUMENT_' . $name . '__', $this->fk . '=' . $this->pk, 'LEFT'); diff --git a/core/extend/com/Sent.php b/core/extend/com/Sent.php index b7f94155..95c7f8a4 100644 --- a/core/extend/com/Sent.php +++ b/core/extend/com/Sent.php @@ -54,7 +54,7 @@ class Sent extends Taglib{ $cid = !empty($tag['cid']) ? $tag['cid']:'0'; $field = empty($tag['field']) ? '*' : $tag['field']; $limit = empty($tag['limit']) ? 20 : $tag['limit']; - $order = empty($tag['order']) ? 'create_time desc' : $tag['order']; + $order = empty($tag['order']) ? 'id desc' : $tag['order']; //获得当前栏目的所有子栏目 $ids = get_category_child($cid); @@ -63,7 +63,7 @@ class Sent extends Taglib{ $where .= " and model_id = {$model} and status >= 1"; $parse = $parse = 'extend(\''.$model.'\')->where(\''.$where.'\')->field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; + $parse .= '$__LIST__ = model(\'Document\')->where(\''.$where.'\')->field(\''.$field.'\')->limit(\''.$limit.'\')->order(\''.$order.'\')->select();'; $parse .= 'foreach ($__LIST__ as $key => $'.$tag['name'].') {'; $parse .= '?>'; $parse .= $content;