dever 6 лет назад
Родитель
Сommit
741ad814ab

+ 13 - 1
act/database/comment.php

@@ -63,7 +63,19 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+		),
+
+		'data_name' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			'list'		=> true,
 		),
 
 		'num_up'		=> array

+ 13 - 1
act/database/live_comment.php

@@ -64,7 +64,19 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '标题',
 			'match' 	=> 'option',
-			'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+		),
+
+		'data_name' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			'list'		=> true,
 		),
 		
 		'content'		=> array

+ 4 - 0
act/lib/Comment.php

@@ -60,6 +60,10 @@ class Comment
         $table = $this->table($type);
         $info = Dever::db($table)->one($where);
         if (!$info) {
+            if (isset($info['name']) && $info['name']) {
+                $where['data_name'] = $info['name'];
+            }
+            
             Dever::db($table)->insert($where);
         }
         Dever::score($uid, 'submit_commit', '发表评论');

+ 24 - 0
act/lib/Manage.php

@@ -20,4 +20,28 @@ class Manage
         }
         return '未知';
     }
+
+    # 根据data_id获取data_name
+    public function getName()
+    {
+        $data = Dever::db('act/comment')->state();
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $name = $this->load($v['type'], $v['data_id']);
+                if ($name && $name != $v['data_name']) {
+                    Dever::db('act/comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
+                }
+            }
+        }
+
+        $data = Dever::db('act/live_comment')->state();
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $name = $this->load($v['type'], $v['data_id']);
+                if ($name && $name != $v['data_name']) {
+                    Dever::db('act/live_comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
+                }
+            }
+        }
+    }
 }

+ 4 - 0
config/base.php

@@ -28,6 +28,9 @@ $config['base'] = array
 		6 => '专题',
 		7 => '小程序',
 		//8 => '商品',
+		//11 => '评论',
+		//12 => '直播评论',
+		13 => '小刊活动页',
 	),
 
 	# 功能类型
@@ -43,6 +46,7 @@ $config['base'] = array
 		//8 => 'shop/product',
 		11 => 'act/comment',
 		12 => 'act/live_comment',
+		13 => 'journal/active',
 	),
 
 	'audit' => array

+ 5 - 6
content/lib/Article.php

@@ -6,9 +6,8 @@ use Dever;
 
 class Article
 {
-    public $uid;
     # 根据文章id 获取文章信息
-    public function get($data)
+    public function get($data, $uid = false)
     {
         if (!is_array($data)) {
             $data = Dever::db('content/article')->getOne($data);
@@ -18,12 +17,12 @@ class Article
             Dever::alert('错误的文章信息');
         }
     
-        $data = $this->getContent($data);
+        $data = $this->getContent($data, $uid);
 
         return $data;
     }
 
-    public function getContent($data)
+    public function getContent($data, $uid = false)
     {
         //embed
         $data['content_array'] = array();
@@ -141,8 +140,8 @@ class Article
 
                     if ($type == 3) {
                         # 查看是否有预约
-                        if ($this->uid > 0) {
-                            $info['user_act']['note'] = Dever::load('act/lib/note')->get($this->uid, $v, $type);
+                        if ($uid > 0) {
+                            $info['user_act']['note'] = Dever::load('act/lib/note')->get($uid, $v, $type);
                         } else {
                             $info['user_act']['note'] = 2;
                         }

+ 1 - 1
doc/apidoc.php

@@ -33,7 +33,7 @@
  * @apiDescription 类型设置说明
  *
  * @apiParam {String} source_type 请在header中定义,ios:ios | android:android | 移动h5:h5  | 小程序:applet | 公众号:service | pc网站:pc
- * @apiParam {Number} type 图文:1 | 视频:2 | 直播:3 | 小刊:4 | 音视频:5 | 专题:6 | 小程序:7 | 链接:10 | 评论: 11
+ * @apiParam {Number} type 图文:1 | 视频:2 | 直播:3 | 小刊:4 | 小刊音视频:5 | 专题:6 | 小程序:7 | 商品:8 | 链接:10 | 评论: 11 || 直播评论:12 | 小刊活动页:13
  * @apiParam {Number} push_ 所有带push_开头的返回参数,返回字典都是一样的,参考获取首页数据中的push_focus
  */
 

+ 2 - 2
feature/lib/Info.php

@@ -7,7 +7,7 @@ use Dever;
 class Info
 {
     # 根据文章id 获取文章信息
-    public function get($data)
+    public function get($data, $uid = false)
     {
         if (!is_array($data)) {
             $data = Dever::db('feature/info')->getOne($data);
@@ -17,7 +17,7 @@ class Info
             Dever::alert('错误的专题信息');
         }
     
-        $data = Dever::load('content/lib/article')->getContent($data);
+        $data = Dever::load('content/lib/article')->getContent($data, $uid);
 
         return $data;
     }

+ 2 - 0
journal/database/info.php

@@ -482,6 +482,8 @@ return array
 		'list_button' => array
 		(
 			'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
+			'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13'))),
+			'br2' => array('<br />'),
 			'list10' => array('积分排行', '"score&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
 			'list11' => array('邀请排行', '"invite&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
 			'br1' => array('<br />'),

+ 1 - 1
main/src/View.php

@@ -39,7 +39,7 @@ class View extends Core
         if (!$id) {
             Dever::alert('错误的'.$name.'ID');
         }
-        $this->data['info'] = Dever::load($method)->get($id);
+        $this->data['info'] = Dever::load($method)->get($id, $this->data['uid']);
         if (!$this->data['info']) {
             Dever::alert('错误的'.$name.'ID');
         }

+ 1 - 1
video/lib/Live.php

@@ -6,7 +6,7 @@ use Dever;
 class Live
 {
 	# 根据id 获取信息
-    public function get($data)
+    public function get($data, $uid = false)
     {
         if (!is_array($data)) {
             $data = Dever::db('video/live')->getOne($data);

+ 1 - 1
video/lib/Vod.php

@@ -6,7 +6,7 @@ use Dever;
 class Vod
 {
 	# 根据id 获取信息
-    public function get($data)
+    public function get($data, $uid = false)
     {
         if (!is_array($data)) {
             $data = Dever::db('video/vod')->getOne($data);