dever 6 tahun lalu
induk
melakukan
0c361b7253

+ 1 - 1
act/database/subscribe.php

@@ -171,7 +171,7 @@ return array
 			'type' => 'all',
 			'order' => array('t_1.id' => 'desc'),
 			'page' => array(10000, 'list'),
-			'col' => '*,t_2.*,t_2.num_add_view+t_2.num_view as num_view,ROUND((t_2.num_ding+t_2.num_add_ding)*t_2.num_ratio_ding) as num_ding',
+			'col' => '*,t_2.*,t_2.num_add_view+t_2.num_view as num_view,ROUND((t_2.num_ding+t_2.num_add_ding)*t_2.num_ratio_ding) as num_ding,t_2.num_add_ding,t_2.num_ratio_ding',
 		),
 	)
 );

+ 42 - 0
config/env/localhost/default.php

@@ -41,6 +41,48 @@ $config['database'] = array
 	),
 );
 
+# 缓存配置
+$config['cache'] = array
+(
+    # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
+    'mysql' => 3600,
+    # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
+    'html' => 0,
+    # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
+    'data' => 3600,
+    # 启用load加载器缓存,一般不加载
+    'load' => 0,
+    # 启用load加载器的远程加载缓存
+    'curl' => 3600,
+
+    # 缓存精细控制,可以根据缓存的key(mysql为表名、service为小写类名,规则是模糊匹配),来控制每一条缓存
+    'loadKey' => array
+    (
+        # 定义缓存名为auth.data的缓存时间
+        //'auth.data' => 200,
+    ),
+    
+    # 缓存清理的参数名,请通过shell=clearcache执行
+    'shell' => 'clearcache',
+
+    # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
+    'expire' => true,
+
+    # 缓存类型
+    'type' => 'redis',//memcache、redis
+
+    # 缓存保存方式,支持多个数据源、多台缓存服务器
+    'store' => array
+    (
+        array
+        (
+            'host' => 'jstyle-cache',
+            'port' => '6379',
+            'weight' => 100,
+        ),
+    ),
+);
+
 $config['debug'] = array
 (
 	'log' => array('type' => 'file'),

+ 9 - 0
journal/database/content.php

@@ -162,6 +162,15 @@ return array
             'show'      => 'type=4,5',      
         ),
 
+        'video_info'        => array
+        (
+            'type'      => 'text-255',
+            'name'      => '视频信息',
+            'default'   => '',
+            'desc'      => '视频信息',
+            'match'     => 'is_string',
+        ),
+
         'music'     => array
         (
             'type'      => 'varchar-800',

+ 1 - 1
journal/database/info.php

@@ -49,7 +49,7 @@ $buy = array
 $page = 15;
 
 # 常用的col
-$col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_add_view+num_view as num_view,ROUND((num_ding+num_add_ding)*num_ratio_ding) as num_ding,num_comment,buy,share_yes,share_title,share_pic,share_content,pic_gd,cate_id,cash,bgmusic';
+$col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_add_view+num_view as num_view,ROUND((num_ding+num_add_ding)*num_ratio_ding) as num_ding,num_add_ding,num_ratio_ding,num_comment,buy,share_yes,share_title,share_pic,share_content,pic_gd,cate_id,cash,bgmusic';
 
 $config = array
 (

+ 9 - 0
main/src/Journal.php

@@ -116,6 +116,14 @@ class Journal extends Core
             $data['pdate_time'] = date('Y-m-d H:i:s', $data['pdate']);
         }
 
+        if (isset($data['num_add_ding']) && isset($data['num_ratio_ding'])) {
+            $stat = Dever::db('stat/journal')->getNumByJournal(array('journal_id' => $data['id']));
+            if ($stat) {
+                $data['num_ding'] = $stat['buy_num'];
+                $data['num_ding'] = round(($data['num_ding']+$data['num_add_ding'])*$data['num_ratio_ding']);
+            }
+        }
+
         if ($data['pic_view_bg']) {
             $data['pic_view_bg'] = explode(',', $data['pic_view_bg']);
         } else {
@@ -507,6 +515,7 @@ class Journal extends Core
             $info['info'] = Dever::load('content/lib/article')->getContent($info['info'], $this->data['uid']);
         } elseif ($info['type'] == 4 || $info['type'] == 5) {
             $info['video'] = convert($info['video'], 'mp4', 'journal/content', $info['id'], 'video');
+            $info = Dever::load('video/lib/vod')->avinfo($info, 'video', 'journal/content');
             if ($info['type'] == 5) {
                 $info['name'] = $name;
             }

+ 13 - 0
stat/database/journal.php

@@ -254,5 +254,18 @@ return array
             //'group' => 'day_int',
             'col' => '*',
         ),
+
+        'getNumByJournal' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'journal_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            //'group' => 'day_int',
+            'col' => 'sum(buy_num) as buy_num',
+        ),
     ),
 );