dever 6 years ago
parent
commit
599f8f0e9c
6 changed files with 244 additions and 8 deletions
  1. 15 2
      doc/apidoc.php
  2. 11 0
      journal/database/cate.php
  3. 156 6
      journal/database/content.php
  4. 23 0
      journal/lib/Manage.php
  5. 27 0
      main/lib/View.php
  6. 12 0
      main/src/Journal.php

+ 15 - 2
doc/apidoc.php

@@ -1082,12 +1082,12 @@
  *
  * @apiSuccess {Object[]} content 内容数据列表,每页显示10条,请在翻到第7或者第8条时,请求第2
  * @apiSuccess {String}   content.id 内容id
- * @apiSuccess {String}   content.type 内容类型1全屏图、2长图、3图文内容、11关联图文、12关联视频、13关联直播、4全屏视频、5留言视频、6留言音频
+ * @apiSuccess {String}   content.type 内容类型1全屏图、2长图、3图文内容、11关联图文、12关联视频、13关联直播、4全屏视频、5留言视频、6留言音频|||新增:7长屏图、8横屏图、9无边框图片、10四宫格图片、21对话模板
  * @apiSuccess {String}   content.name 标题。type=5,6时有效
  * @apiSuccess {String}   content.cover 音频或者视频的封面图,type=4,5,6时有效
  * @apiSuccess {String}   content.video 视频地址。type=4,5时有效
  * @apiSuccess {String}   content.music 音频地址。type=6时有效
- * @apiSuccess {String}   content.pic 全屏图或者长图,type=1,2时有效
+ * @apiSuccess {String}   content.pic 全屏图或者长图,type=1,2,7,8,9时有效
  * @apiSuccess {String}   content.is_button 全屏图上的保存按钮,1显示2不显示,type=1时有效
  * @apiSuccess {String}   content.button_name 全屏图上的保存按钮的文字,type=1时有效
  * @apiSuccess {String}   content.button_color 全屏图上的保存按钮的文字颜色,type=1时有效
@@ -1105,6 +1105,19 @@
  * @apiSuccess {String}   content.info.content 内容
  * @apiSuccess {String}   content.info.content_array 数组内容
  * @apiSuccess {Object[]}   content.info.author 作者
+
+ * @apiSuccess {Object[]}   content.palaces 四宫格图片的四个图片,type=10时有效
+ * @apiSuccess {String}   content.palaces.palaces 图片位置,1上左2上右3下左4下右
+ * @apiSuccess {String}   content.palaces.pic 图片
+
+ * @apiSuccess {String}   content.talk_pic 对话模板的置顶图片,为空则不显示,type=21时有效
+ * @apiSuccess {Object[]}   content.talk 对话模板里的对话内容,type=21时有效
+ * @apiSuccess {String}   content.talk.talk_location 对话位置,12
+ * @apiSuccess {String}   content.talk.talk_type 对话类型,1文字,2图片,3音频
+ * @apiSuccess {String}   content.talk.avatar 头像
+ * @apiSuccess {String}   content.talk.text 文字
+ * @apiSuccess {String}   content.talk.pic 图片
+ * @apiSuccess {String}   content.talk.audio 音频
  */
 
 /**

+ 11 - 0
journal/database/cate.php

@@ -6,12 +6,23 @@ $type = array
     # 默认类型
     3 => '图文内容',
     1 => '全屏图',
+    
+    # 2019-03-27 增加两个类型
+    7 => '长屏图',
+    8 => '横屏图',
+
     2 => '长图',
+    9 => '无边框图片',
+    10 => '四宫格图片',
+
     # 2018-12-11 增加3个类型
     4 => '全屏视频',
     5 => '留言视频',
     6 => '留言音频',
 
+    # 2019-03-27 增加三个类型
+    21 => '对话模板',
+
     # 关联类型 > 10
     11 => '关联图文',
     12 => '关联视频',

+ 156 - 6
journal/database/content.php

@@ -12,12 +12,23 @@ $type_config = array
     # 默认类型
     3 => '图文内容',
     1 => '全屏图',
+    
+    # 2019-03-27 增加两个类型
+    7 => '长屏图',
+    8 => '横屏图',
+
     2 => '长图',
+    9 => '无边框图片',
+    10 => '四宫格图片',
+
     # 2018-12-11 增加3个类型
     4 => '全屏视频',
     5 => '留言视频',
     6 => '留言音频',
 
+    # 2019-03-27 增加三个类型
+    21 => '对话模板',
+
     # 关联类型 > 10
     11 => '关联图文',
     12 => '关联视频',
@@ -63,11 +74,32 @@ $text = array
     //10 => '自定义',
 );
 
+
+$palaces = array
+(
+    1 => '上左',
+    2 => '上右',
+    3 => '下左',
+    4 => '下右',
+);
+
 $bgcolor_type = array
 (
     1 => '设置背景颜色',
     2 => '不设置背景颜色',
 );
+$talk_type = array
+(
+    1 => '文字',
+    2 => '图片',
+    3 => '音频',
+);
+
+$talk_location = array
+(
+    1 => '显示在左侧',
+    2 => '显示在右侧',
+);
 
 $author = function()
 {
@@ -280,14 +312,14 @@ return array
         'pic'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '图片-全屏图图片尺寸750*1386px或等比尺寸,长图图片尺寸750*高度不限 或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '图片-全屏图图片尺寸750*1386px或等比尺寸,长屏图图片尺寸750*高度不限或等比尺寸,横屏图图片尺寸高度不限*1386px或等比尺寸,长图图片尺寸750*高度不限或等比尺寸,无边框图片尺寸长和宽均没有限制,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => '图片',
             'match'     => 'option',
             'update'  => 'image',
             'key'       => '1',
             'place'     => '150',
-            'show'      => 'type=1,2',      
+            'show'      => 'type=1,2,7,8,9',      
         ),
 
         'is_button'     => array
@@ -300,7 +332,7 @@ return array
             'update'    => 'radio',
             'option'    => $is_button,
            // 'search'    => 'select',
-            'show'      => 'type=1',      
+            'show'      => 'type=1,7,8',      
             'control'   => 'is_button',
         ),
 
@@ -312,7 +344,7 @@ return array
             'desc'      => '保存按钮文字内容',
             'match'     => 'option',
             'update'    => 'textarea',
-            'show'      => 'type=1',      
+            'show'      => 'type=1,7,8',      
         ),
 
         'button_color'     => array
@@ -323,7 +355,7 @@ return array
             'desc'      => '保存按钮文字颜色',
             'match'     => 'option',
             'update'    => 'color',
-            'show'      => 'type=1',      
+            'show'      => 'type=1,7,8',      
         ),
 
         'article_id'     => array
@@ -370,7 +402,7 @@ return array
             'desc'      => '文字设置',
             'match'     => 'is_string',
             'option'    => $text,
-            'show'      => 'type=1',
+            'show'      => 'type=1,7,8',
             'update'    => array
             (
                 array
@@ -428,6 +460,124 @@ return array
             ),
         ),
 
+        'palaces'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '四宫格图片',
+            'default'   => '',
+            'desc'      => '四宫格图片',
+            'match'     => 'is_string',
+            'option'    => $palaces,
+            'show'      => 'type=10',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'pic',
+                    'name'      => '图片',
+                    'default'   => '',
+                    'desc'      => '图片',
+                    'match'     => 'is_string',
+                    'update'    => 'image',
+                    'key'       => 1,
+                ),
+            ),
+        ),
+
+        'talk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '置顶图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。为空则不显示',
+            'default'   => '',
+            'desc'      => '图片',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+            'show'      => 'type=21',      
+        ),
+
+        'talk'       => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '对话设置',
+            'default'   => '',
+            'desc'      => '对话设置',
+            'match'     => 'is_string',
+            'show'      => 'type=21',
+            'update'    => array
+            (
+                array
+                (
+                    'col'       => 'talk_location',
+                    'name'      => '对话位置',
+                    'default'   => '1',
+                    'desc'      => '对话位置',
+                    'match'     => 'is_string',
+                    'update'    => 'radio',
+                    'option'    => $talk_location,
+                ),
+
+                array
+                (
+                    'col'       => 'avatar',
+                    'name'      => '头像-图片尺寸120*120px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式。',
+                    'default'   => '',
+                    'desc'      => '头像',
+                    'match'     => 'option',
+                    'update'    => 'image',
+                    'key'       => 1,
+                ),
+
+                array
+                (
+                    'col'       => 'talk_type',
+                    'name'      => '对话类型',
+                    'default'   => '1',
+                    'desc'      => '对话类型',
+                    'match'     => 'is_string',
+                    'update'    => 'radio',
+                    'option'    => $talk_type,
+                    'control'   => 'talk_type',
+                ),
+
+                array
+                (
+                    'col'       => 'text',
+                    'name'      => '文字内容-为空则不显示',
+                    'default'   => '',
+                    'desc'      => '文字内容',
+                    'match'     => 'option',
+                    'update'    => 'textarea',
+                    'show'      => 'talk_type=1'
+                ),
+
+                array
+                (
+                    'col'       => 'pic',
+                    'name'      => '图片-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,可以上传GIF格式。为空则不显示',
+                    'default'   => '',
+                    'desc'      => '图片',
+                    'match'     => 'option',
+                    'update'    => 'image',
+                    'key'       => 1,
+                    'show'      => 'talk_type=2'
+                ),
+
+                array
+                (
+                    'col'       => 'audio',
+                    'name'      => '音频-音频格式mp3,上传大小不能超过100M,为空则不显示',
+                    'default'   => '',
+                    'desc'      => '音频',
+                    'match'     => 'option',
+                    'update'    => 'upload',
+                    'key'       => 2,
+                    'show'      => 'talk_type=3'
+                ),
+            ),
+        ),
+
         'reorder'       => array
         (
             'type'      => 'int-11',

+ 23 - 0
journal/lib/Manage.php

@@ -259,6 +259,29 @@ class Manage
                     }
                 }
 
+                if ($v['type'] == 10) {
+                    $palaces = Dever::array_decode($v['palaces']);
+                    if (isset($palaces[0])) {
+                        $data[$k]['pic'] = $palaces[0]['pic'];
+                    }
+                }
+
+                if ($v['type'] == 21) {
+                    if ($data[$k]['talk_pic']) {
+                        $data[$k]['pic'] = $data[$k]['talk_pic'];
+                    } else {
+                        $talk = Dever::array_decode($v['talk']);
+                        if ($talk) {
+                            foreach ($talk as $tk => $tv) {
+                                if ($tv['pic']) {
+                                    $data[$k]['pic'] = $tv['pic'];
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+
                 $data[$k]['typename'] = $type[$v['type']];
 
                 /*

+ 27 - 0
main/lib/View.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace Main\Lib;
+
+use Dever;
+
+class View
+{
+    # 执行结束时执行的
+    public function end($param)
+    {
+    	# 不再执行syncone等后续操作
+    	Dever::config('base')->after = 1;
+        # 用户预约
+        if ($param['type'] == 3) {
+            if (isset($param['status']) && $param['status'] == 2) {
+                # 直播中
+                Dever::load('act/lib/watch')->submit($this->data['uid'], $id, $type);
+            }
+        }
+
+        if ($param['addview']) {
+            # 浏览量+1
+            Dever::load($param['method'])->addView($param['id']);
+        }
+    }
+}

+ 12 - 0
main/src/Journal.php

@@ -736,6 +736,18 @@ class Journal extends Core
             unset($info['text']);
         }
 
+        if ($info['type'] == 10 && $info['palaces']) {
+            $info['palaces'] = Dever::array_decode($info['palaces']);
+        } else {
+            unset($info['palaces']);
+        }
+
+        if ($info['type'] == 21 && $info['talk']) {
+            $info['talk'] = Dever::array_decode($info['talk']);
+        } else {
+            unset($info['talk']);
+        }
+
         if ($info['type'] == 3) {
             $info['info'] = array();
             $info['info']['name'] = $name;