dever 5 rokov pred
rodič
commit
535d39fddd

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

@@ -36,9 +36,9 @@ return array
         'goods_id'     => array
         (
             'type'      => 'int-11',
-            'name'      => '选择品',
+            'name'      => '选择品',
             'default'   => '',
-            'desc'      => '选择品',
+            'desc'      => '选择品',
             'match'     => 'option',
             'update'    => 'select',
             'update_search' => 'goods/lib/manage.search',

+ 8 - 7
app/collection/database/times.php

@@ -1,5 +1,6 @@
 <?php
 
+$times_id = Dever::input('option_times_id', -1);
 return array
 (
 	# 表名
@@ -69,7 +70,7 @@ return array
 			'desc' 		=> '请选择上级时光',
 			'match' 	=> 'is_numeric',
 			'update'	=> 'hidden',
-			'value'		=> Dever::input('option_times_id', -1),
+			'value'		=> $times_id,
 			'list'		=> '{times_id} > 0 ? Dever::load("collection/times-one#name", {times_id}) : "主时间线"',
 		),
 
@@ -80,7 +81,7 @@ return array
             'default'   => '',
             'desc'      => '时光图标',
             'match'     => 'option',
-            'update'    => 'image',
+            'update'    => $times_id < 0 ? 'hidden': 'image',
             'key'       => '1',
             'place'     => '80*80',
         ),
@@ -92,7 +93,7 @@ return array
             'default'   => '',
             'desc'      => '图片',
             'match'     => 'option',
-            'update'    => 'image',
+            'update'    => $times_id < 0 ? 'hidden': 'image',
             'key'       => '1',
             'place'     => '330*330',
         ),
@@ -104,7 +105,7 @@ return array
             'default'   => '',
             'desc'      => '描述',
             'match'     => 'option',
-            'update'    => 'text',
+            'update'    => $times_id < 0 ? 'hidden': 'text',
             //'list'        => true,
         ),
 
@@ -115,7 +116,7 @@ return array
             'default'   => '#ffffff',
             'desc'      => '文字颜色',
             'match'     => 'is_string',
-            'update'    => 'color',
+            'update'    => $times_id < 0 ? 'hidden': 'color',
         ),
 
         'bgcolor'      => array
@@ -125,7 +126,7 @@ return array
             'default'   => '#cccccc',
             'desc'      => '背景颜色',
             'match'     => 'is_string',
-            'update'    => 'color',
+            'update'    => $times_id < 0 ? 'hidden': 'color',
         ),
 
 		'reorder'		=> array
@@ -172,7 +173,7 @@ return array
 		'list_type' => 'tree',
 		'list_button' => array
 		(
-			'update' => '编辑',
+			'update' => array('编辑', 'times&option_times_id={times_id}'),
 			'add' => array('新增时间线', '"{times_id}" == -1 ? "times&option_times_id={id}" : "times&option_times_id={times_id},{id}"', '{times_id} == -1'),
 			'delete' => '删除',
 		),

+ 10 - 0
app/collection/database/user_record.php

@@ -81,6 +81,16 @@ return array
             'update'    => 'text',
         ),
 
+        'day'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '时光下的日期',
+            'default'   => '',
+            'desc'      => '时光下的日期',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
         'content_id'      => array
         (
             'type'      => 'int-11',

+ 117 - 0
app/collection/database/user_times.php

@@ -0,0 +1,117 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'user_times',
+    # 显示给用户看的名称
+    'lang' => '用户时光选择记录',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'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}) : "匿名用户"',
+		),
+
+        'info_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合集',
+            'default'   => '',
+            'desc'      => '合集',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'times_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '父级章节id',
+            'default'   => '',
+            'desc'      => '章节id',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'day'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '时光下的日期-这个日期用于显示,所以是字符串',
+            'default'   => '',
+            'desc'      => '时光下的日期',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        '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
+    (
+        
+    ),
+
+    'request' => array
+    (
+        # 取所有下级
+        'getData' => array
+        (
+            'option' => array
+            (
+                'uid' => 'yes',
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*|times_id',
+        ),
+    ),
+);

+ 22 - 4
app/collection/lib/Core.php

@@ -12,6 +12,7 @@ class Core
     protected $user;
 	protected $year;
     protected $times;
+    protected $day = 0;
     protected $parent_page_id;
     protected $page_id;
     protected $key = 'dreamland1985';
@@ -36,8 +37,14 @@ 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];
+            if (isset($code[6]) && $code[6]) {
+                $this->day = $code[6];
+            } else {
+                $this->day = 0;
+            }
+            
+            if (isset($code[7]) && $code[7] && $code[7] != $this->uid) {
+                $this->share_uid = $code[7];
             }
             
         } else {
@@ -45,14 +52,25 @@ class Core
         }
     }
 
-    protected function getCode($id, $parent_page_id, $page_id, $index, $times_id, $uid = 0)
+    protected function getCode($id, $parent_page_id, $page_id, $index, $times_id, $day = 0, $uid = 0)
     {
         if (Dever::project('invite')) {
             $invite = Dever::input('invite');
             $uid = Dever::load('invite/api')->getUid($invite);
         }
+        if (!$day) {
+            $day = $this->day;
+        }
+
+        if ($day) {
+            if (strstr($day, '-')) {
+                $day = str_replace('-', '', $day);
+            }
+        } else {
+            $day = 0;
+        }
 
-        $key = 'dlv1_' . $id. '_' . $parent_page_id . '_' . $page_id . '_' . $index . '_' . $times_id . '_' . $uid;
+        $key = 'dlv1_' . $id. '_' . $parent_page_id . '_' . $page_id . '_' . $index . '_' . $times_id . '_' . $day . '_' . $uid;
 
         $code = Dever::encode($key, $this->key);
 

+ 47 - 5
app/collection/src/Api.php

@@ -59,7 +59,7 @@ class Api extends Core
         $data['info']['platform_name'] = $info['name'];
         $data['info']['qrcode'] = $data['info']['name'] = $data['info']['price'] = $data['info']['s_price'] = '';
 
-        $code = $this->getCode($this->id, $this->parent_page_id, $this->page_id, $index, $this->times, $this->uid);
+        $code = $this->getCode($this->id, $this->parent_page_id, $this->page_id, $index, $this->times, $this->day, $this->uid);
         $url .= '?code=' . $code;
 
         $data['info']['qrcode'] = $this->qrcode($url, $content_id);
@@ -191,6 +191,7 @@ class Api extends Core
                 $page_id = $record['page_id'];
                 $times = $record['times_id'];
                 $index = $record['index'];
+                $day = $record['day'];
             } else {
                 # 获取最新的章节页id
                 $page_where['info_id'] = $data['info']['id'];
@@ -201,17 +202,18 @@ class Api extends Core
                     $parent_page_id = $page[0]['page_id'];
                     $page_id = $page[0]['id'];
                 } else {
-                    Dever::alret('内容还没有准备好');
+                    Dever::alert('内容还没有准备好');
                 }
                 $times = 0;
                 if ($this->times) {
                     $times = $this->times;
                 }
                 $index = 0;
+                $day = 0;
             }
 
             # 获取code
-            $data['code'] = $this->getCode($data['info']['id'], $parent_page_id, $page_id, $index, $times);
+            $data['code'] = $this->getCode($data['info']['id'], $parent_page_id, $page_id, $index, $times, $day);
         }
 
         return $data;
@@ -272,7 +274,12 @@ class Api extends Core
     {
         $where['id'] = Dever::input('product_id');
         $table = Dever::input('table');
-        $data['product'] = Dever::db($table)->one($where);
+        if ($table) {
+            $data['product'] = Dever::db($table)->one($where);
+        } else {
+            $data['product']['goods_id'] = $where['id'];
+        }
+        
 
         if ($data['product'] && isset($data['product']['goods_id']) && $data['product']['goods_id'] > 0) {
             $data['product']['goods'] = Dever::load('goods/lib/info')->getInfo($data['product']['goods_id']);
@@ -351,6 +358,8 @@ class Api extends Core
         $data['cur'] = $this->times;
         $data['times'] = Dever::db('collection/times')->main($where);
         if ($data['times']) {
+            $where['uid'] = $this->uid;
+            $data['user_times'] = Dever::db('collection/user_times')->getData($where);
             foreach ($data['times'] as $k => $v) {
                 $where['times_id'] = $v['id'];
                 $data['times'][$k]['child'] = Dever::db('collection/times')->child($where);
@@ -368,7 +377,12 @@ class Api extends Core
         $page = Dever::db('collection/page')->getOne($where);
         if ($page) {
             # 获取code
-            $data['code'] = $this->getCode($this->id, $page['page_id'], $page['id'], 0, $page['times_id']);
+            $this->day = $day = Dever::input('day', 0);
+            $data['code'] = $this->getCode($this->id, $page['page_id'], $page['id'], 0, $page['times_id'], $day);
+
+            # 记录选择的时光id和日期
+            $this->recordTimes($page['times_id'], $day);
+            
             return $data;
         }
         Dever::alert('error');
@@ -383,6 +397,11 @@ class Api extends Core
         $where['parent_page_id'] = $this->parent_page_id;
         $where['page_id'] = $this->page_id;
         $where['times_id'] = $this->times;
+        if (!$this->day) {
+            $where['day'] = 0;
+        } else {
+            $where['day'] = $this->day;
+        }
         $where['content_id'] = Dever::input('content_id');
         $where['index'] = Dever::input('index', 0);
         if ($record) {
@@ -395,6 +414,29 @@ class Api extends Core
         return 'yes';
     }
 
+    # 记录用户时光选择操作
+    public function recordTimes($times_id, $day)
+    {
+        $where['info_id'] = $this->id;
+        $where['uid'] = $this->uid;
+        $where['times_id'] = $times_id;
+        $record = Dever::db('collection/user_times')->one($where);
+        if (!$day) {
+            $where['day'] = 0;
+        } else {
+            $where['day'] = $day;
+        }
+        
+        if ($record) {
+            $where['where_id'] = $record['id'];
+            Dever::db('collection/user_times')->update($where);
+        } else {
+            Dever::db('collection/user_times')->insert($where);
+        }
+
+        return 'yes';
+    }
+
     public function ding($data)
     {
         if (isset($data['num_add_buy']) && isset($data['num_ratio_buy'])) {

+ 45 - 15
app/community/database/info.php

@@ -1,5 +1,5 @@
 <?php
-
+$audit = Dever::config('base')->audit;
 $table = Dever::config('base')->table;
 $table_name = Dever::config('base')->table_name;
 
@@ -49,7 +49,7 @@ return array
 			'default' 	=> '0',
 			'desc' 		=> '请选择用户',
 			'match' 	=> 'is_numeric',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 			//'search'	=> 'select',
 			'search'    => array
             (
@@ -67,7 +67,7 @@ return array
 			'default' 	=> '0',
 			'desc' 		=> '引用的信息id',
 			'match' 	=> 'is_numeric',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'to_uid'		=> array
@@ -77,7 +77,7 @@ return array
 			'default' 	=> '0',
 			'desc' 		=> '引用的信息所属uid',
 			'match' 	=> 'is_numeric',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'cate_id'		=> array
@@ -87,7 +87,7 @@ return array
 			'default' 	=> '1',
 			'desc' 		=> '所属类别',
 			'match' 	=> 'is_numeric',
-			'update'	=> 'select',
+			//'update'	=> 'select',
 			'option'	=> $cate,
 			//'list'		=> '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
 		),
@@ -101,8 +101,8 @@ return array
 			'match' 	=> 'option',
 			'option' 	=> $table,
 			'search'	=> 'select',
-			'update'	=> 'select',
-			'list'		=> true,
+			//'update'	=> 'select',
+			//'list'		=> true,
 		),
 		
 		'type_id' 		=> array
@@ -112,7 +112,7 @@ return array
 			'default' 	=> '',
 			'desc' 		=> '数据源id',
 			'match' 	=> 'option',
-			'update'	=> 'text',
+			//'update'	=> 'text',
 		),
 
 		'type_name' 		=> array
@@ -123,10 +123,20 @@ return array
 			'desc' 		=> '数据源标题',
 			'match' 	=> 'option',
 			'search'	=> 'fulltext',
-			'update'	=> 'text',
-			'list'		=> true,
+			//'update'	=> 'text',
+			//'list'		=> true,
 		),
 
+		'day'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '日期',
+            'default'   => '-1',
+            'desc'      => '日期',
+            'match'     => 'is_numeric',
+            //'update'    => 'text',
+        ),
+
 		'num_up'		=> array
 		(
 			'type' 		=> 'int-11',
@@ -135,7 +145,7 @@ return array
 			'desc' 		=> '点赞数',
 			'match' 	=> 'option',
 			//'search'	=> 'order',
-			'list'		=> true,
+			//'list'		=> true,
 		),
 
 		'num_oppose'		=> array
@@ -146,7 +156,7 @@ return array
 			'desc' 		=> '反对数',
 			'match' 	=> 'option',
 			//'search'	=> 'order',
-			'list'		=> true,
+			//'list'		=> true,
 		),
 
 		'num_comment'		=> array
@@ -157,7 +167,7 @@ return array
 			'desc' 		=> '评论数',
 			'match' 	=> 'option',
 			//'search'	=> 'order',
-			'list'		=> true,
+			//'list'		=> true,
 		),
 		
 		'pic'		=> array
@@ -181,10 +191,24 @@ return array
 			'desc' 		=> '请输入内容',
 			'match' 	=> 'is_string',
 			'search'	=> 'fulltext',
-			//'list'		=> 'table',
+			//'list'		=> true,
 			//'modal'		=> '查看详情',
-			'list'		=> 'Dever::load("community/lib/info.content", "{content}", {id})',
+			'list'		=> 'Dever::load("community/lib/info.content", "{id}")',
 		),
+
+		'audit'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核',
+            'default'   => '1',
+            'desc'      => '审核',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $audit,
+            //'search'  => 'select',
+            'list'        => true,
+            'edit'        => true,
+        ),
 		
 		'state'		=> array
 		(
@@ -226,7 +250,9 @@ return array
 				'cate_id' => 'yes',
 				'type' => 'yes',
 				'type_id' => 'yes',
+				'day' => 'yes',
 				'noid' => array('yes-id', '!='),
+				'audit' => 1,
 				'state' => 1,
 			),
 			'type' => 'all',
@@ -244,6 +270,8 @@ return array
 				'cate_id' => 'yes',
 				'type' => 'yes',
 				'type_id' => 'yes',
+				'day' => 'yes',
+				'audit' => 1,
 				'state' => 1,
 			),
 			'type' => 'all',
@@ -261,6 +289,8 @@ return array
 				'cate_id' => 'yes',
 				'type' => 'yes',
 				'type_id' => 'yes',
+				'day' => 'yes',
+				'audit' => 1,
 				'state' => 1,
 			),
 			'type' => 'count',

+ 46 - 17
app/community/lib/Info.php

@@ -12,7 +12,7 @@ class Info
         return $table;
     }
 
-    public function getData($method = 'getAll', $uid, $cate_id = false, $type = false, $type_id = false, $total = false, $id = false)
+    public function getData($method = 'getAll', $uid, $cate_id = false, $type = false, $type_id = false, $total = false, $id = false, $times = false, $day = false)
     {
         # 获取分类下的帖子
         $where['cate_id'] = $cate_id;
@@ -21,6 +21,11 @@ class Info
         if ($id > 0) {
             $where['noid'] = $id;
         }
+        if ($day && $day > 0) {
+            $where['day'] = $day;
+        } else {
+            $where['day'] = -1;
+        }
         $data['info'] = Dever::db('community/info')->$method($where);
         if ($total) {
             if ($method == 'getAll') {
@@ -29,34 +34,39 @@ class Info
                 $data['total'] = Dever::db('community/info')->getTotal($where);
             }
         }
+        if ($times && $times > 0) {
+            $times = Dever::db('collection/times')->one($times);
+        }
         if ($data['info']) {
             foreach ($data['info'] as $k => $v) {
-                $data['info'][$k] = $this->one($uid, $v);
+                $data['info'][$k] = $this->one($uid, $v, $times);
             }
         }
 
         return $data;
     }
 
-    public function content($content, $id)
+    public function content($id)
     {
-        $content = $this->getContent($content);
-
-        return '<span class=dever-emoji>'.$content.'</span>';
-    }
-
-    public function getContent($content)
-    {
-        if (strstr($content, '_b64')) {
-            $content = str_replace('_b64', '', $content);
-            $content = base64_decode($content);
+        $info = Dever::db('community/info')->one($id);
+        $table = array();
+
+        $pic = '';
+        if ($info['pic']) {
+            $temp = explode(',', $info['pic']);
+            foreach ($temp as $k => $v) {
+                $pic .= '<img src="'.$v.'" width="150" />';
+            }
         }
+        
+        $table['内容'] = $info['content'];
+        $table['图片'] = $pic;
 
-        return $content;
+        return Dever::table($table);
     }
 
     # 发表信息
-    public function submit($uid, $cate_id, $id, $type, $pic, $content, $to_id, $to_uid)
+    public function submit($uid, $cate_id, $id, $type, $pic, $content, $to_id, $to_uid, $day = false)
     {
         $where['uid'] = $uid;
         $where['cate_id'] = $cate_id;
@@ -75,6 +85,9 @@ class Info
         if ($to_uid) {
             $where['to_uid'] = $to_uid;
         }
+        if ($day) {
+            $where['day'] = $day;
+        }
         $data_table = $this->table($type);
         if (!$info) {
             $data = Dever::db($data_table)->one($id);
@@ -101,11 +114,27 @@ class Info
         return true;
     }
 
-    private function one($uid, $info)
+    private function one($uid, $info, $times = false)
     {
         $info['pic'] = explode(',', $info['pic']);
         $info['user'] = Dever::load('passport/api')->info($info['uid']);
-        $info['cdate_string'] = Dever::mdate($info['cdate'], 2);
+        if ($info['day'] > 0) {
+            if ($times && $times['year']) {
+                $year = $times['year'];
+            } else {
+                $year = substr($info['day'],0,4);
+            }
+            
+            $month = substr($info['day'],4,2);
+            $day = substr($info['day'],6,2);
+            $string = $year . '-' . $month . '-' . $day;
+        } elseif ($times && $times['year']) {
+            $string = $times['year'] . '-m-d';
+        } else {
+            $string = 'Y-m-d';
+        }
+
+        $info['cdate_string'] = date($string . ' H:i', $info['cdate']);
 
         # 点赞数
         $info['num_up'] = $info['num_up'] + 0;

+ 2 - 2
app/community/src/Api.php

@@ -31,7 +31,7 @@ class Api extends Core
     public function info()
     {
     	$id = Dever::input('id');
-    	$data = Dever::load('community/lib/info')->getData('getAll', $this->uid, $this->cate_id, $this->type, $this->type_id, false, $id);
+    	$data = Dever::load('community/lib/info')->getData('getAll', $this->uid, $this->cate_id, $this->type, $this->type_id, false, $id, $this->times, $this->day);
         return $data;
     }
 
@@ -92,7 +92,7 @@ class Api extends Core
         $to_id = Dever::input('to_id');
         $to_uid = Dever::input('to_uid');
         
-        Dever::load('community/lib/info')->submit($this->uid, $cate_id, $type_id, $type, $pic, $content, $to_id, $to_uid);
+        Dever::load('community/lib/info')->submit($this->uid, $cate_id, $type_id, $type, $pic, $content, $to_id, $to_uid, $this->day);
 
         return 'yes';
     }

+ 11 - 0
app/content/database/pic.php

@@ -180,6 +180,17 @@ return array
                     'match'     => 'is_numeric',
                     'update'    => 'text',
                 ),
+
+                array
+                (
+                    'col'      => 'goods_id',
+                    'name'      => '选择商品',
+                    'default'   => '',
+                    'desc'      => '选择商品',
+                    'match'     => 'option',
+                    'update'    => 'select',
+                    'update_search' => 'goods/lib/manage.search',
+                ),
             ),
         ),
 

+ 2 - 2
app/content/database/product.php

@@ -75,9 +75,9 @@ return array
 		'goods_id'     => array
         (
             'type'      => 'int-11',
-            'name'      => '选择品',
+            'name'      => '选择品',
             'default'   => '',
-            'desc'      => '选择品',
+            'desc'      => '选择品',
             'match'     => 'option',
             'update'    => 'select',
             'show'      => 'type=11',

+ 11 - 0
app/content/database/video_short.php

@@ -200,6 +200,17 @@ return array
                     'match'     => 'is_numeric',
                     'update'    => 'text',
                 ),
+
+                array
+                (
+                    'col'      => 'goods_id',
+                    'name'      => '选择商品',
+                    'default'   => '',
+                    'desc'      => '选择商品',
+                    'match'     => 'option',
+                    'update'    => 'select',
+                    'update_search' => 'goods/lib/manage.search',
+                ),
             ),
         ),
 

+ 2 - 2
config/base.php

@@ -30,8 +30,8 @@ $config['base'] = array
 
     'audit' => array
     (
-        1 => '审核',
-        2 => '审核',
+        1 => '审核',
+        2 => '审核',
         3 => '审核未通过',
     ),