dever 5 years ago
parent
commit
c6421d3d3d
3 changed files with 78 additions and 19 deletions
  1. 13 0
      audit/database/data.php
  2. 56 17
      audit/lib/Core.php
  3. 9 2
      config/env/localhost/default.php

+ 13 - 0
audit/database/data.php

@@ -38,6 +38,7 @@ return array
 		'update_status' => 'audit/lib/core.status',
 		'update_reorder' => 'audit/lib/core.reorder',
 		'update_push' => 'audit/lib/core.push',
+		'updatemul' => 'audit/lib/core.updatemul',
 	),
 	# 数据结构
 	'struct' => array
@@ -228,5 +229,17 @@ return array
 			'page' => array(15, 'list'),
 			'col' => '*',
 		),
+
+		'getIn' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'id' => array('yes', 'in'),
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'col' => '*',
+		),
 	)
 );

+ 56 - 17
audit/lib/Core.php

@@ -9,41 +9,80 @@ class Core
     public function audit($id, $name, $data)
     {
         $audit = Dever::param('audit', $data);
-        $info = Dever::db('audit/data')->one($id);
-        $table = Dever::config('base')->type_table[$info['type']];
+        if ($audit) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach($info as $k => $v) {
+                    $table = Dever::config('base')->type_table[$v['type']];
 
-        $source = Dever::db($table)->one($info['data_id']);
+                    $source = Dever::db($table)->one($v['data_id']);
 
-        if ($source && $source['audit'] != $audit) {
-            Dever::config('base')->after = false;
-            Dever::db($table)->update(array('where_id' => $info['data_id'], 'audit' => $audit));
+                    if ($source && $source['audit'] != $audit) {
+                        Dever::config('base')->after = false;
+                        Dever::db($table)->update(array('where_id' => $v['data_id'], 'audit' => $audit));
+                    }
+                }
+            }
         }
     }
 
     public function status($id, $name, $data)
     {
         $status = Dever::param('status', $data);
-        $info = Dever::db('audit/data')->one($id);
-        $table = Dever::config('base')->type_table[$info['type']];
+        if ($status) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach ($info as $k => $v) {
+                    $table = Dever::config('base')->type_table[$v['type']];
 
-        $source = Dever::db($table)->one($info['data_id']);
+                    $source = Dever::db($table)->one($v['data_id']);
 
-        if ($source && $source['status'] != $status) {
-            Dever::config('base')->after = false;
-            Dever::db($table)->update(array('where_id' => $info['data_id'], 'status' => $status));
+                    if ($source && $source['status'] != $status) {
+                        Dever::config('base')->after = false;
+                        Dever::db($table)->update(array('where_id' => $v['data_id'], 'status' => $status));
+                    }
+                }
+            }
         }
     }
 
+    public function updatemul($id, $name, $data)
+    {
+        //$this->audit($id, $name, $data);
+        //$this->status($id, $name, $data);
+        $this->push($id, $name, $data);
+    }
+
     public function push($id, $name, $data)
     {
         $push = Dever::param('push', $data);
-        $info = Dever::db('audit/data')->one($id);
-        $table = Dever::config('base')->type_table[$info['type']];
+        if ($push) {
+            $info = Dever::db('audit/data')->getIn($id);
+            if ($info) {
+                foreach ($info as $k => $v) {
+                    if ($v['type'] > 2) {
+                        continue;
+                    }
+                    $table = Dever::config('base')->type_table[$v['type']];
 
-        $source = Dever::db($table)->one($info['data_id']);
+                    $source = Dever::db($table)->one($v['data_id']);
+
+                    if ($source && $push == 2) {
+                        $content = Dever::load('content/lib/article')->getContent($source);
+                        $send['source_id'] = $v['id'];
+                        $send['name'] = $source['name'];
+                        $send['cate_id'] = $source['cate_id'];
+                        $send['pic_cover'] = Dever::pic($source['pic_cover']);
+                        $send['pic_index'] = Dever::pic($source['pic_cover_169']);
+                        $send['pdate'] = $source['pdate'];
+                        $send['desc'] = $source['share_title'];
+                        $send['template'] = $v['type'];
+                        $send['content'] = Dever::json_encode($content['content_array']);
 
-        if ($source) {
-            
+                        $data = Dever::load('jingpin/lib/article.up', $send);
+                    }
+                }
+            }
         }
     }
 

+ 9 - 2
config/env/localhost/default.php

@@ -20,6 +20,7 @@ $create = false;
 if (isset($dc['mysql']['create'])) {
     $create = $dc['mysql']['create'];
 }
+//$create = true;
 $ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
 
 $local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
@@ -103,7 +104,7 @@ if (DEVER_APP_NAME == 'tests' && isset($dc['mysql_test'])) {
     $config['database']['pay'] = $dc['mysql_test'];
     $config['database']['score'] = $dc['mysql_test'];
     $config['database']['message'] = $dc['mysql_test'];
-    $config['database']['oauth'] = $dc['mysql_user'];
+    $config['database']['oauth'] = $dc['mysql_test'];
     $config['database']['wechat'] = $dc['mysql_test'];
 }
 
@@ -143,10 +144,12 @@ $config['cache'] = array
         'buy.pay' => 0,
         'journal_v1.top' => 600,
         'journal_v1.subscribe' => 0,
+        'journal_v1.getView' => 0,
         //'journal_v1.getList' => 0,
         'journal_v1.view' => 0,
         'tests_api.user' => 0,
         'tests_api.buy' => 0,
+        'stat_' => 0,
     ),
 
     # 哪些路由中的参数不参与生成缓存的key
@@ -249,7 +252,7 @@ $config['host'] = array
         (
             'path' => $host. 'upload/upload/?',
         ),
-        'pay' => array
+        'pays' => array
         (
             'path' => $host. 'pay/pay/?',
         ),
@@ -257,6 +260,10 @@ $config['host'] = array
         (
             'path' => $host. 'wechat/wechat_applet/?',
         ),
+        'jingpin' => array
+        (
+            'path' => 'http://192.168.33.10/jingpin/content/?'
+        ),
     ),
 );