rabin 2 yıl önce
ebeveyn
işleme
1abb1778b3
3 değiştirilmiş dosya ile 61 ekleme ve 28 silme
  1. 1 1
      database/col.php
  2. 32 26
      database/data.php
  3. 28 1
      lib/Data.php

+ 1 - 1
database/col.php

@@ -190,7 +190,7 @@ return array
 			'option' => array
 			(
 				'state' => 1,
-				'id' => array('yes', 'in'),
+				//'id' => array('yes', 'in'),
 				//'id_no' => array('yes-id', '!='),
 			),
 			'type' => 'all',

+ 32 - 26
database/data.php

@@ -23,6 +23,7 @@ $data = array
 (
     1 => '内容自定义',
 );
+$lang = array();
 $name = '推送数据管理';
 if ($info) {
     $info = Dever::db('push/info')->one($info);
@@ -116,7 +117,8 @@ $struct = array
 );
 
 if ($info) {
-    $col = Dever::db('push/col')->getAll(array('id' => $info['col']));
+    $info['col'] = explode(',', $info['col']);
+    $col = Dever::db('push/col')->getAll();
 
     if ($col) {
         $pic_index = 0;
@@ -124,7 +126,6 @@ if ($info) {
             $pic = $info['col_pic'];
             $pic_temp = explode("\r\n", $pic);
         }
-        
     	foreach ($col as $k => $v) {
 
             $place = $v['pic'];
@@ -133,30 +134,35 @@ if ($info) {
             }
             $key = 'col_' . $v['id'];
     		$list = false;
-    		if ($v['type'] == 1) {
-    			$update_type = 'text';
-                $lang[] = $key;
-                $list = true;
-    		} elseif ($v['type'] == 2) {
-    			$update_type = 'textarea';
-                $lang[] = $key;
-                $list = true;
-    		} elseif ($v['type'] == 3) {
-    			$update_type = 'editor';
-                $lang[] = $key;
-    		} elseif ($v['type'] == 4) {
-    			$update_type = 'image';
-                $pic_index++;
-    		} elseif ($v['type'] == 5) {
-    			$update_type = 'images';
-                $pic_index++;
-    		} elseif ($v['type'] == 6) {
-    			$update_type = 'radio';
-    		} elseif ($v['type'] == 7) {
-    			$update_type = 'checkbox';
-    		} elseif ($v['type'] == 8) {
-    			$update_type = 'day';
-    		}
+            if (!in_array($v['id'], $info['col'])) {
+                $update_type = 'hidden';
+            } else {
+                if ($v['type'] == 1) {
+                    $update_type = 'text';
+                    $lang[] = $key;
+                    $list = true;
+                } elseif ($v['type'] == 2) {
+                    $update_type = 'textarea';
+                    $lang[] = $key;
+                    $list = true;
+                } elseif ($v['type'] == 3) {
+                    $update_type = 'editor';
+                    $lang[] = $key;
+                } elseif ($v['type'] == 4) {
+                    $update_type = 'image';
+                    $pic_index++;
+                } elseif ($v['type'] == 5) {
+                    $update_type = 'images';
+                    $pic_index++;
+                } elseif ($v['type'] == 6) {
+                    $update_type = 'radio';
+                } elseif ($v['type'] == 7) {
+                    $update_type = 'checkbox';
+                } elseif ($v['type'] == 8) {
+                    $update_type = 'day';
+                }
+            }
+    		
     		$struct[$key] = array
 	        (
 	            //'col'       => 'col_' . $v['id'],

+ 28 - 1
lib/Data.php

@@ -6,8 +6,35 @@ use Dever;
 
 class Data
 {
+    # 直接获取某个页面的内容
+    public function getPage($path = 'module', $cdate = 'Y-m-d H:i')
+    {
+        $page = Dever::input('page');
+        if ($page) {
+            $uri = $page;
+        } else {
+            $uri = Dever::uri();
+
+            if (!$uri) {
+                $uri = 'home';
+            }
+        }
+        
+        $data = $this->getPageData($uri, $cdate);
+
+        $result = array();
+        if ($data && $data['info']) {
+            foreach ($data['info'] as $k => $v) {
+                if ($v['template_id'] > 0 && isset($v['template'])) {
+                    $result[] = Dever::render($path . '/' . $v['template']['key'], $v);
+                }
+            }
+        }
+        return implode("\r\n", $result);
+    }
+
     # 获取某个页面的数据
-    public function getPage($page_id, $cdate = 'Y-m-d H:i')
+    public function getPageData($page_id, $cdate = 'Y-m-d H:i')
     {
         $where = array();
         if (is_numeric($page_id)) {