dever 5 yıl önce
ebeveyn
işleme
b169526d85

+ 37 - 3
app/collection/database/content.php

@@ -113,13 +113,47 @@ return array
         'pic'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '封面图-封面图尺寸150*150px,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '封面图-封面图尺寸300*300px,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => '封面图',
             'match'     => 'option',
             'update'    => 'image',
             'key'       => '1',
-            'place'     => '150*150',
+            'place'     => '300*300',
+        ),
+
+        'share_title'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '分享标题-不填写将使用标题',
+            'default'   => '',
+            'desc'      => '分享标题',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'share_pic'     => array
+        (
+            'type'      => 'text-255',
+            'name'      => '分享图片-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,不传将使用封面图,这里可以上传多张,作为海报使用',
+            'default'   => '',
+            'desc'      => '分享图片',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '300*300',
+            //'upload'  => 'qiniu',
+            //'large'   => true,
+        ),
+
+        'share_content'     => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '分享内容',
+            'default'   => '',
+            'desc'      => '分享内容',
+            'match'     => 'option',
+            'update'    => 'textarea',
         ),
 
         'reorder'       => array
@@ -188,7 +222,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('reorder' => 'asc', 'id' => 'desc'),
-            'page' => array(30, 'list'),
+            //'page' => array(30, 'list'),
             'col' => 'id,type,name,pic,info_id,page_id',
         ),
 

+ 1 - 0
app/collection/database/function.php

@@ -11,6 +11,7 @@ $type = array
     //'music' 	=> '音乐',
     //'ranking' 	=> '排行',
     //'my'    => '我的',
+    'share'     => '分享',
 );
 
 $status = array

+ 15 - 4
app/collection/database/page.php

@@ -125,10 +125,10 @@ return array
 			'list'		=> '{page_id} > 0 ? Dever::load("collection/page-one#name", {page_id}) : "主章节"',
 		),
 
-		'pic'     => array
+        'pic'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '图片-章节图片,图片尺寸330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '图片-章节图片,图片尺寸可随意,尽量为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => '章节图片',
             'match'     => 'option',
@@ -140,11 +140,22 @@ return array
         'desc'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '描述',
+            'name'      => '描述-添加描述将展示封面',
             'default'   => '',
             'desc'      => '描述',
             'match'     => 'option',
-            'update'    => 'text',
+            'update'    => 'textarea',
+            //'list'        => true,
+        ),
+
+        'desc_end'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '完结描述-添加完结描述将展示在本章节末尾',
+            'default'   => '',
+            'desc'      => '描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
             //'list'        => true,
         ),
 

+ 27 - 0
app/collection/lib/Content.php

@@ -28,6 +28,23 @@ class Content
         $result = array();
 		if ($data) {
             $i = 0;
+            # 获取章节信息
+            $page = Dever::db('collection/page')->one($page_id);
+            if ($page && $page['desc']) {
+                $parent_page = Dever::db('collection/page')->one($page['page_id']);
+                $page['name'] = $parent_page['name'] . ' ' . $page['name'];
+                $result[$i] = $page;
+                $result[$i]['data'] = -1;
+                $result[$i]['type'] = -1;
+                $result[$i]['times'] = $result[$i]['times_parent'] = '';
+                if ($page['times_id_parent'] && $page['times_id']) {
+                    $times = Dever::db('collection/times')->one($page['times_id']);
+                    $result[$i]['times'] = $times['name'];
+                    $times = Dever::db('collection/times')->one($page['times_id_parent']);
+                    $result[$i]['times_parent'] = $times['name'];
+                }
+                $i = 1;
+            }
 			foreach ($data as $k => $v) {
 				$data[$k] = $this->getOne($v);
                 if ($data[$k]['data']) {
@@ -35,6 +52,16 @@ class Content
                     $i++;
                 }
 			}
+
+            if ($page && $page['desc']) {
+                $result[$i] = $result[0];
+                if ($page['desc_end']) {
+                    $result[$i]['name'] .= ' 已完结';
+                    $result[$i]['desc'] = $page['desc_end'];
+                } else {
+                    $result[$i]['name'] .= ' 连载中';
+                }
+            }
 		}
 
 		return $result;

+ 12 - 2
app/collection/lib/Core.php

@@ -8,6 +8,7 @@ class Core
 {
 	protected $token;
 	protected $uid;
+    protected $share_uid = 0;
     protected $user;
 	protected $year;
     protected $times;
@@ -35,14 +36,23 @@ class Core
             $this->page_id = $code[3];
             $this->index = $code[4];
             $this->times = $code[5];
+            if (isset($code[6]) && $code[6] && $code[6] != $this->uid) {
+                $this->share_uid = $code[6];
+            }
+            
         } else {
             $this->id = Dever::input('id');
         }
     }
 
-    protected function getCode($id, $parent_page_id, $page_id, $index, $times_id)
+    protected function getCode($id, $parent_page_id, $page_id, $index, $times_id, $uid = 0)
     {
-        $key = 'dlv1_' . $id. '_' . $parent_page_id . '_' . $page_id . '_' . $index . '_' . $times_id;
+        if (Dever::project('invite')) {
+            $invite = Dever::input('invite');
+            $uid = Dever::load('invite/api')->getUid($invite);
+        }
+
+        $key = 'dlv1_' . $id. '_' . $parent_page_id . '_' . $page_id . '_' . $index . '_' . $times_id . '_' . $uid;
 
         $code = Dever::encode($key, $this->key);
 

+ 22 - 7
app/collection/src/Api.php

@@ -37,6 +37,12 @@ class Api extends Core
         return $data;
     }
 
+    # 获取分享的链接
+    public function getShare()
+    {
+        
+    }
+
     # 获取合集内容
     public function getInfo()
     {
@@ -80,7 +86,7 @@ class Api extends Core
             } else {
                 # 获取最新的章节页id
                 $page_where['info_id'] = $data['info']['id'];
-                $page_where = $this->getTimes($page_where);
+                $page_where = $this->getTimesId($page_where);
                 $page = Dever::db('collection/page')->child($page_where);
                 $parent_page_id = $page_id = 0;
                 if ($page) {
@@ -116,6 +122,8 @@ class Api extends Core
 
         # 获取每个模块
         $data['items'] = Dever::load('collection/lib/content')->getList($this->id, $this->page_id);
+        # 滑动到多少时,加载下一页
+        $data['total'] = count($data['items']) - 2;
 
         
         $data['func'] = $this->getFunc();
@@ -190,7 +198,7 @@ class Api extends Core
     }
 
     # 获取合集下的分类
-    public function category()
+    public function getCategory()
     {
         $parent_page_id = $this->parent_page_id;
         $page_id = $this->page_id;
@@ -198,8 +206,15 @@ class Api extends Core
         $data['cate'] = Dever::db('collection/page')->main($where);
         if ($data['cate']) {
             $content = Dever::db('collection/content')->child($where);
+            $page = Dever::db('collection/page')->one($page_id);
+
+            # 步长
+            $data['num'] = 0;
+            if ($page && $page['desc']) {
+                $data['num'] = 1;
+            }
 
-            $where = $this->getTimes($where);
+            $where = $this->getTimesId($where);
             $data['child'] = Dever::db('collection/page')->child($where);
             
             $data['show'] = array();
@@ -222,7 +237,7 @@ class Api extends Core
     }
 
     # 获取合集下的时光
-    public function times()
+    public function getTimes()
     {
         $where['info_id'] = $this->id;
         $data['cur'] = $this->times;
@@ -261,7 +276,7 @@ class Api extends Core
         $where['page_id'] = $this->page_id;
         $where['times_id'] = $this->times;
         $where['content_id'] = Dever::input('content_id');
-        $where['index'] = Dever::input('index');
+        $where['index'] = Dever::input('index', 0);
         if ($record) {
             $where['where_id'] = $record['id'];
             Dever::db('collection/user_record')->update($where);
@@ -341,8 +356,8 @@ class Api extends Core
         return $result;
     }
 
-    # 获取时光
-    private function getTimes($where)
+    # 获取时光id
+    private function getTimesId($where)
     {
         # 获取当前年份的最新的时光
         if (!$this->times) {

+ 1 - 1
app/content/database/pic.php

@@ -98,7 +98,7 @@ return array
 		'pic'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '图片-全屏图图片尺寸750*1386px或等比尺寸,长屏图图片尺寸750*高度不限或等比尺寸,横屏图图片尺寸宽度不限*1386px或等比尺寸,无边框图片尺寸长和宽均没有限制,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '图片-长屏图图片尺寸750*高度不限或等比尺寸,横屏图图片尺寸宽度不限*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => '图片',
             'match'     => 'option',