dever há 6 anos atrás
pai
commit
c785300186
3 ficheiros alterados com 31 adições e 0 exclusões
  1. 17 0
      journal/database/content.php
  2. 13 0
      journal/lib/Manage.php
  3. 1 0
      main/src/Content.php

+ 17 - 0
journal/database/content.php

@@ -50,6 +50,10 @@ return array
     'menu' => false,
     'gettype' => $type,
     'text' => $text,
+    'end' => array
+    (
+        'insert' => 'journal/lib/manage.addContent',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -378,5 +382,18 @@ return array
             'page' => array(10, 'list'),
             'col' => '*',
         ),
+
+        'getAllByReorder' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
     )
 );

+ 13 - 0
journal/lib/Manage.php

@@ -252,4 +252,17 @@ class Manage
 
         return $data;
     }
+
+    public function addContent($id, $name, $data)
+    {
+        # 获取最新的reorder
+        $info_id = Dever::param('info_id', $data);
+        $data = Dever::db('journal/content')->getAllByReorder(array('info_id' => $info_id));
+
+        if ($data) {
+            $update['where_id'] = $id;
+            $update['reorder'] = $data['reorder'] + 1;
+            Dever::db('journal/content')->update($update);
+        }
+    }
 }

+ 1 - 0
main/src/Content.php

@@ -24,6 +24,7 @@ class Content extends Core
     # 首页精选
     public function home()
     {
+        echo Dever::login(6945);die;
         # 栏目
         //$this->data['push_menu'] = Dever::load('push/lib/data')->get('menu', '头部导航');
         $this->data['menu'] = Dever::db('content/cate')->getAll();