dever 4 tahun lalu
induk
melakukan
baeeca2933

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

@@ -0,0 +1,200 @@
+<?php
+
+$type = array
+(
+    'cate' 		=> '集合',
+    'community' => '社区',
+    'shop' 		=> '商城',
+    //'year' 		=> '时光',
+    //'jump' 		=> '穿越',
+    //'befall' 	=> '降临',
+    //'music' 	=> '音乐',
+    //'ranking' 	=> '排行',
+);
+
+$status = array
+(
+    1 => '开启',
+    2 => '关闭',
+);
+
+$direction = array
+(
+	'left' => '左侧展开',
+);
+return array
+(
+    # 表名
+    'name' => 'function',
+    # 显示给用户看的名称
+    'lang' => '功能设置',
+    'menu' => false,
+    'check' => 'type',
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '功能名称',
+            'default'   => '',
+            'desc'      => '功能名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'status'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '功能状态',
+            'default'   => '1',
+            'desc'      => '功能状态',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $status,
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'type'     => array
+        (
+            'type'      => 'varchar-20',
+            'name'      => '功能类型',
+            'default'   => 'cate',
+            'desc'      => '功能类型',
+            'match'     => 'is_string',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'      => true,
+        ),
+
+        'color'      => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '文字颜色-默认为白色',
+            'default'   => '#ffffff',
+            'desc'      => '文字颜色',
+            'match'     => 'is_string',
+            'update'    => 'color',
+        ),
+
+        'bgcolor'      => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '背景颜色-默认为蓝色',
+            'default'   => '#16C2C2',
+            'desc'      => '背景颜色',
+            'match'     => 'is_string',
+            'update'    => 'color',
+        ),
+
+        'width'      => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '页面展开的宽度',
+            'default'   => '86%',
+            'desc'      => '页面展开的宽度',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'direction'      => array
+        (
+            'type'      => 'varchar-10',
+            'name'      => '页面展开方式',
+            'default'   => '',
+            'desc'      => '页面展开方式',
+            'match'     => 'is_string',
+            'update'    => 'radio',
+            'option'    => $direction,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        //'delete' => false,
+        # 列表 商城要加入选品列表
+        'list_button' => array
+        (
+            
+        ),
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+                'status' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+    ),
+);

+ 2 - 2
app/collection/database/info.php

@@ -448,13 +448,13 @@ $config = array
             'update' => '编辑',
             'br2' => array('<br />'),
 
-            'list1' => array('功能', '"page&search_option_info_id={id}&oper_table=info&page_type=1"' , '{audit} == 1'),
+            'list1' => array('功能', '"function&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
 
             'list2' => array('门票', '"buy&search_option_info_id={id}&oper_table=info"' , '{audit} == 1 && {buy} == 1'),
 
             'br3' => array('<br />'),
 
-            'list3' => array('章节', '"page&search_option_info_id={id}&oper_table=info&page_type=1"' , '{audit} == 1'),
+            'list3' => array('章节', '"page&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
 
             'list4' => array('榜单', '"ranking&project=collection&search_option_info_id={id}&oper_table=info&oper_project=collection&where_id={id}"', '{audit} == 1'),
             

+ 20 - 8
app/collection/database/ranking.php

@@ -10,8 +10,8 @@ $type = array
 
 $periods = array
 (
-    1 => '天',
-    2 => '周',
+    //1 => '天',
+    //2 => '周',
     3 => '月',
     4 => '年',
 );
@@ -90,7 +90,7 @@ return array
         (
             'type'      => 'int-11',
             'name'      => '榜单类型',
-            'default'   => '1',
+            'default'   => '3',
             'desc'      => '榜单类型',
             'match'     => 'is_numeric',
             'update'    => 'radio',
@@ -110,13 +110,24 @@ return array
             'list'      => true,
         ),
 
+        'unit'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '榜单单位',
+            'default'   => '',
+            'desc'      => '榜单单位',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
         'start'       => array
         (
             'type'      => 'int-11',
             'default'   => '',
-            'name'      => '榜单开始时间',
+            'name'      => '榜开始时间',
             'match'     => 'option',
-            'desc'      => '榜单开始时间',
+            'desc'      => '榜开始时间',
             'update'    => 'date',
             //'list'      => 'date("Y-m-d H:i:s", {start})',
             'callback'  => 'maketime',
@@ -126,9 +137,9 @@ return array
         (
             'type'      => 'int-11',
             'default'   => '',
-            'name'      => '榜结束时间',
+            'name'      => '榜结束时间',
             'match'     => 'option',
-            'desc'      => '榜结束时间',
+            'desc'      => '榜结束时间',
             'update'    => 'date',
             //'list'      => 'date("Y-m-d H:i:s", {end})',
             'callback'  => 'maketime',
@@ -189,6 +200,7 @@ return array
         # 列表
         'list_button' => array
         (
+            'list1' => array('榜单期数', '"ranking_periods&search_option_info_id={info_id}&search_option_ranking_id={id}&top_table=ranking_data&oper_table=ranking"'),
             'list' => array('榜单数据', '"ranking_data&search_option_info_id={info_id}&search_option_ranking_id={id}&top_table=ranking_data&oper_table=ranking"'),
         ),
     ),
@@ -205,7 +217,7 @@ return array
                 'status' => 1,
             ),
             'type' => 'all',
-            'order' => array('recorder' => 'desc', 'id' => 'desc'),
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
             'col' => '*',
         ),
     ),

+ 38 - 39
app/collection/database/ranking_data.php

@@ -1,26 +1,17 @@
 <?php
 
-$type = array
-(
-    1 => '门票榜单',
-    2 => '购物榜单',
-    3 => '贡献榜单',
-    4 => '积分榜单',
-);
-
-$periods = array
-(
-    1 => '天',
-    2 => '周',
-    3 => '月',
-    4 => '年',
-);
-
-$status = array
-(
-    1 => '开启',
-    2 => '关闭',
-);
+$ranking_id = Dever::input('search_option_ranking_id');
+$periods = function() use($ranking_id)
+{
+    $array = array();
+    $info = Dever::db('collection/ranking_periods')->state(array('ranking_id' => $ranking_id));
+    
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
 
 return array
 (
@@ -29,6 +20,7 @@ return array
     # 显示给用户看的名称
     'lang' => '榜单数据',
     'menu' => false,
+    'check' => 'info_id,ranking_id,uid,periods_id',
     # 数据结构
     'struct' => array
     (
@@ -85,14 +77,16 @@ return array
 			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
 		),
 
-		'periods'     => array
+		'periods_id'     => array
         (
             'type'      => 'int-11',
             'name'      => '期数',
-            'default'   => '',
+            'default'   => '1',
             'desc'      => '期数',
             'match'     => 'is_numeric',
-            'update'    => 'text',
+            'update'    => 'select',
+            'option'    => $periods,
+            'search'    => 'select',
             'list'      => true,
         ),
 
@@ -105,26 +99,17 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'text',
             'order'		=> 'desc',
-            'list'      => '{num}{unit}',
-        ),
-
-        'unit'      => array
-        (
-            'type'      => 'varchar-80',
-            'name'      => '单位',
-            'default'   => '',
-            'desc'      => '单位',
-            'match'     => 'is_string',
-            //'update'    => 'text',
+            'list'      => '"{num}"',
         ),
 
         'day'     => array
         (
             'type'      => 'int-11',
             'name'      => '日期',
-            'default'   => 'day',
+            'default'   => '',
             'desc'      => '日期',
             'match'     => 'is_numeric',
+            'update'    => 'day',
             'list'      => true,
         ),
 
@@ -146,18 +131,32 @@ return array
             # 只有insert时才生效
             'insert'    => true,
             'search'    => 'date',
-            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
         ),
     ),
 
     'manage' => array
     (
-    	'edit' => false,
+    	//'insert' => false,
         'delete' => false,
     ),
 
     'request' => array
     (
-        
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'ranking_id' => 'yes',
+                'periods_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('num' => 'desc', 'cdate' => 'desc'),
+            'limit' => '0,20',
+            'col' => '*',
+        ),
     ),
 );

+ 153 - 0
app/collection/database/ranking_periods.php

@@ -0,0 +1,153 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'ranking_periods',
+    # 显示给用户看的名称
+    'lang' => '榜单期数',
+    'menu' => false,
+    'check' => 'info_id,ranking_id,periods',
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_info_id')
+        ),
+
+        'ranking_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '榜单id',
+            'default'   => '',
+            'desc'      => '榜单id',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_ranking_id')
+        ),
+
+        'name'     => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '本期标题',
+            'default'   => '',
+            'desc'      => '本期标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+		'periods'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '期数',
+            'default'   => '',
+            'desc'      => '期数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'users'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '参与人数',
+            'default'   => '0',
+            'desc'      => '参与人数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'order'		=> 'desc',
+            'list'      => true,
+        ),
+
+        'start'       => array
+        (
+            'type'      => 'int-11',
+            'default'   => '',
+            'name'      => '本期开始时间',
+            'match'     => 'option',
+            'desc'      => '本期开始时间',
+            'update'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {start})',
+            'callback'  => 'maketime',
+        ),
+
+        'end'       => array
+        (
+            'type'      => 'int-11',
+            'default'   => '',
+            'name'      => '本期结束时间',
+            'match'     => 'option',
+            'desc'      => '本期结束时间',
+            'update'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {end})',
+            'callback'  => 'maketime',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'ranking_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('periods' => 'desc', 'cdate' => 'desc'),
+            'limit' => '0,20',
+            'col' => '*',
+        ),
+    ),
+);

+ 6 - 1
app/collection/lib/Core.php

@@ -6,12 +6,17 @@ use Dever;
 
 class Core
 {
+	protected $token;
+	protected $uid;
+    protected $user;
+	protected $year;
+
     public function __construct()
     {
     	# 获取当前的用户信息
         $this->token = Dever::input('token');
         $this->uid = 1;
-
+        $this->user = Dever::load('passport/api')->info($this->uid);
         # 获取最新的年份-时光专用
         $this->year = Dever::input('year', date('Y'));
     }

+ 51 - 1
app/collection/src/Api.php

@@ -10,6 +10,7 @@ class Api extends Core
     public function __construct()
     {
         $this->id = Dever::input('id');
+        parent::__construct();
     }
 
     public function data()
@@ -80,6 +81,29 @@ class Api extends Core
         return $data;
     }
 
+    # 获取榜单数据
+    public function getRankingData()
+    {
+        $where['info_id'] = $this->id;
+        $where['ranking_id'] = Dever::input('ranking_id');
+
+        # 获取所有期数
+        $data['ranking_periods'] = Dever::db('collection/ranking_periods')->getAll($where);
+
+        if ($data['ranking_periods']) {
+            $where['periods_id'] = Dever::input('ranking_periods', $data['ranking_periods'][0]['id']);
+            $data['ranking_data'] = Dever::db('collection/ranking_data')->getAll($where);
+
+            if ($data['ranking_data']) {
+                foreach ($data['ranking_data'] as $k => $v) {
+                    $data['ranking_data'][$k]['user'] = Dever::load('passport/api')->info($v['uid']);
+                }
+            }
+        }
+
+        return $data;
+    }
+
     # 获取合集下的内容
     public function getContent()
     {
@@ -92,7 +116,33 @@ class Api extends Core
         $data['parent_page_id'] = $page['page_id'];
 
         # 获取用户信息
-        $data['user'] = Dever::load('passport/api')->info($this->uid);
+        $data['user'] = $this->user;
+
+        # 获取功能
+        $where['info_id'] = $this->id;
+        $func = Dever::db('collection/function')->getAll($where);
+        $data['func'] = array();
+        if ($func) {
+            foreach ($func as $k => $v) {
+                $data['func'][$v['type']] = array
+                (
+                    'show' => false,
+                    'index' => 5,
+                    'top' => 0,
+                    'padding' => '0rpx',
+                    'width' => $v['width'],
+                    'direction' => strtolower($v['direction']),
+                    'param' => array(),
+                    'button' => array
+                    (
+                        'bgColor' => $v['bgcolor'],
+                        'text' => $v['name'],
+                        'fontSize' => 28,
+                        'color' => $v['color'],
+                    ),
+                );
+            }
+        }
         return $data;
     }
 

+ 145 - 0
app/community/database/comment.php

@@ -0,0 +1,145 @@
+<?php
+
+$table = Dever::config('base')->table;
+$table_name = Dever::config('base')->table_name;
+
+$cate = function()
+{
+	$array = array();
+	$info = Dever::load('attr/cate-state');
+	if($info)
+	{
+		$array += $info;
+	}
+	return $array;
+};
+
+
+return array
+(
+	# 表名
+	'name' => 'comment',
+	# 显示给用户看的名称
+	'lang' => '评论管理',
+	# 是否显示在后台菜单
+	'menu' => false,
+	'order' => 80,
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			//'list'		=> true,
+		),
+		
+		'uid'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '用户名',
+			'default' 	=> '0',
+			'desc' 		=> '请选择用户',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'type' 		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '所属数据源',
+			'default' 	=> '',
+			'desc' 		=> '所属数据源',
+			'match' 	=> 'option',
+			'option' 	=> $table,
+			'search'	=> 'select',
+			'update'	=> 'select',
+			'list'		=> true,
+		),
+		
+		'type_id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '数据源id',
+			'default' 	=> '',
+			'desc' 		=> '数据源id',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+		),
+
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '内容',
+			'update' 	=> 'editor',
+			'key'		=> 1,
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'search'	=> 'fulltext',
+			//'list'		=> 'table',
+			//'modal'		=> '查看详情',
+			//'list'		=> 'Dever::load("community/lib/info.content", "{content}", {id})',
+		),
+		
+		'state'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '状态',
+			'default' 	=> '1',
+			'desc' 		=> '请选择状态',
+			'match' 	=> 'is_numeric',
+		),
+		
+		'cdate'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '时间',
+			'match' 	=> array('is_numeric', time()),
+			'desc' 		=> '',
+			# 只有insert时才生效
+			'insert'	=> true,
+			'search'	=> 'date',
+			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
+		),
+	),
+
+	'manage' => array
+	(
+		//'insert' => false,
+		//'edit' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'type' => 'yes',
+				'type_id' => 'yes',
+				'noid' => array('yes-id', '!='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'page' => array(30, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 49 - 0
app/community/lib/Comment.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace Community\Lib;
+
+use Dever;
+
+class Comment
+{
+    private function table($type)
+    {
+        $table = Dever::db('community/comment')->config['set']['table_name'][$type];
+        return $table;
+    }
+
+    public function getData($method = 'getAll', $uid, $type = false, $type_id = false)
+    {
+        $where['type'] = $type;
+        $where['type_id'] = $type_id;
+        $info = Dever::db('community/comment')->$method($where);
+        $data['info'] = $info;
+        $data['total'] = Dever::total();
+        if ($info) {
+            foreach ($info as $k => $v) {
+            	$data['info'][$k]['uid'] = $v['uid'];
+                $data['info'][$k]['content'] = $v['content'];
+            }
+        }
+
+        return $data;
+    }
+
+    # 发表信息
+    public function submit($uid, $id, $type, $pic, $content, $to_id, $to_uid)
+    {
+        $where['uid'] = $uid;
+        $where['type_id'] = $id;
+        $where['type'] = $type;
+        $where['content'] = $content;
+        $table = 'community/comment';
+        $info = false;
+        $data_table = $this->table($type);
+        if (!$info) {
+            Dever::db($table)->insert($where);
+            Dever::score($uid, 'submit_comment', '发布弹幕');
+        }
+
+        return true;
+    }
+}

+ 8 - 0
app/community/src/Api.php

@@ -34,6 +34,14 @@ class Api
         return $data;
     }
 
+    # 获取弹幕、评论
+    public function comment()
+    {
+        $id = Dever::input('id');
+        $data = Dever::load('community/lib/comment')->getData('getAll', $this->uid, $this->type, $this->type_id);
+        return $data;
+    }
+
     # 发布信息
     public function add()
     {