rabin 1 年之前
父節點
當前提交
1ae1bade40
共有 2 個文件被更改,包括 13 次插入32 次删除
  1. 12 31
      lib/Data.php
  2. 1 1
      lib/Manage.php

+ 12 - 31
lib/Data.php

@@ -10,7 +10,7 @@ class Data
     public function getPageInfo($key = false)
     {
         if (!$key) {
-            $page = Dever::input('page');
+            $page = Dever::input('key');
             if ($page) {
                 $key = $page;
             } else {
@@ -31,7 +31,7 @@ class Data
     # 直接获取某个页面的内容
     public function getPage($path = 'module', $cdate = 'Y-m-d H:i', $config = array())
     {
-        $page = Dever::input('page');
+        $page = Dever::input('key');
         if ($page) {
             $uri = $page;
         } else {
@@ -86,7 +86,7 @@ class Data
 
                     if ($data['module'][$k]['data']) {
                         foreach ($data['module'][$k]['data'] as $k1 => $v1) {
-                            $data['module'][$k]['data'][$k1] = $this->getOne($v1, 2, $cdate);
+                            $data['module'][$k]['data'][$k1] = $this->getOne($v1, $cdate);
                         }
                     }
                 }
@@ -135,7 +135,7 @@ class Data
 
                 if ($data) {
                     foreach ($data as $k => $v) {
-                        $data[$k] = $this->getOne($v, 2, $cdate);
+                        $data[$k] = $this->getOne($v, $cdate);
                     }
                 }
             } else {
@@ -147,7 +147,7 @@ class Data
     }
 
     # 获取某条推送位的数据
-    public function getOne($data, $state = 2, $cdate = 'Y-m-d H:i')
+    public function getOne($data, $cdate = 'Y-m-d H:i')
     {
         $data = is_array($data) ? $data : Dever::db('page/data')->one($data);
         $source = array();
@@ -174,21 +174,13 @@ class Data
         }
         foreach ($data as $k => $v) {
             $s = strstr($k, $key);
-            if ($lang && strstr($k, 'col_') && !$s) {
+            if (!$s && $lang && strstr($k, 'col_')) {
                 $s = true;
                 $key = 'col_';
-            } elseif ($k == 'id') {
-                if ($state == 1) {
-                    $result[$k]['id'] = $v;
-                } else {
-                    $result['id'] = $v;
-                }
+            } elseif ($k == 'id' || $k == 'type' || $k == 'type_id') {
+                $result[$k] = $v;
             } elseif ($k == 'cdate') {
-                if ($state == 1) {
-                    $result[$k]['cdate_string'] = date($cdate, $v);
-                } else {
-                    $result['cdate_string'] = date($cdate, $v);
-                }
+                $result['cdate_string'] = date($cdate, $v);
             }
             if ($s) {
                 $id = str_replace($key, '', $k);
@@ -215,21 +207,10 @@ class Data
                     $v = explode(',', $v);
                 }
 
-                if ($state == 1) {
-                    if (strstr($v, 'jpg') || strstr($v, 'png') || strstr($v, 'gif')) {
-                        $v = '<img src="'.$v.'" width="150"/>';
-                    }
-                    if (!isset($result[$k])) {
-                        $result[$k] = array();
-                    }
-
-                    $result[$k][$col_module['name']] = $v;
-                } else {
-                    if (strstr($col_module['key'], 'link')) {
-                        $v = Dever::url($v, 'main');
-                    }
-                    $result[$col_module['key']] = $v;
+                if (strstr($col_module['key'], 'link')) {
+                    $v = Dever::url($v, 'main');
                 }
+                $result[$col_module['key']] = $v;
             }
         }
 

+ 1 - 1
lib/Manage.php

@@ -81,7 +81,7 @@ class Manage
 
     public function show($id)
     {
-        $table = Dever::load('page/lib/data')->getOne($id, 1);
+        $table = Dever::load('page/lib/data')->getOne($id);
         if (count($table) == 1) {
             $table = $table[0];
         }