dever 6 years ago
parent
commit
6ce6756cc1

+ 27 - 0
act/database/subscribe.php

@@ -145,5 +145,32 @@ return array
 			'page' => array(6, 'list'),
 			'col' => '*',
 		),
+
+		'getMyAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'data_id' => 'yes',
+				'type' => 'yes',
+				'source' => array('yes', 'in'),
+				'cate_id' => 'yes-t_2.cate_id',
+				'state' => 1,
+			),
+			# 联表
+			'join' => array
+			(
+				array
+				(
+					'table' => 'journal/info',
+					'type' => 'left join',
+					'on' => array('data_id','id'),
+				),
+			),
+			'type' => 'all',
+			'order' => array('t_1.id' => 'desc'),
+			'page' => array(10, 'list'),
+			'col' => '*,t_2.*',
+		),
 	)
 );

+ 2 - 0
config/base.php

@@ -4,6 +4,8 @@ $config['base'] = array
 	'name' => '精美时尚',
 	'version' => '1.0.0 Beta',
 
+	# 后台头部菜单
+	'top' => 'passport/system_id',
 
 	# 功能选择
 	'function' => array

+ 87 - 0
doc/apidoc.php

@@ -696,6 +696,23 @@
  * @apiSuccess {String}   user_act.note 是否预约提醒1为已预约,2为未预约
  */
 
+/**
+ * @api {get} wonderful/main/?l=view.getPage 查看单页内容
+ * @apiVersion 1.0.0
+ * @apiName view.getPage
+ * @apiGroup Content
+ *
+ * @apiDescription 查看单页内容
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {Number} key 单页key
+ *
+ * @apiSuccess {Object[]} info 单页数据
+ * @apiSuccess {String}   info.id 
+ * @apiSuccess {String}   info.name 名称
+ * @apiSuccess {String}   info.content 内容
+ */
+
 /**
  * @api {get} wonderful/main/?l=user.poster 获取海报
  * @apiVersion 1.0.0
@@ -829,6 +846,7 @@
  * @apiDescription 小刊首页
  *
  * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id
  *
  * @apiSuccess {Object[]} journal 小刊数据列表,每页显示10条,请在翻到第7或者第8条时,请求第2
  * @apiSuccess {String}   journal.id 小刊id
@@ -860,6 +878,75 @@
   * @apiSuccess {Number} push_jingxuan_more 是否显示更多按钮1显示2不显示
  */
 
+/**
+ * @api {get} wonderful/main/?l=journal.getList 小刊列表
+ * @apiVersion 1.0.0
+ * @apiName journal.getList
+ * @apiGroup Journal
+ *
+ * @apiDescription 小刊列表,按照分类读取
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id
+ *
+ * @apiSuccess {Object[]} journal 小刊数据列表
+ * @apiSuccess {String}   journal.id 小刊id
+ * @apiSuccess {String}   journal.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   journal.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   journal.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   journal.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   journal.pic_gd 小刊推广图
+ * @apiSuccess {String}   journal.pdate 时间
+ * @apiSuccess {String}   journal.num_ding 订阅数
+ * @apiSuccess {String}   journal.num_view 浏览量
+ * @apiSuccess {String}   journal.num_comment 评论量
+ * @apiSuccess {String}   journal.buy 小刊是否收费 1收费 2免费 3会员
+ * @apiSuccess {String}   journal.bgmusic 小刊背景音乐
+ *
+ * @apiSuccess {Object[]} subscribe 订阅列表
+ * @apiSuccess {String}   subscribe.id 
+ * @apiSuccess {String}   subscribe.username 用户名
+ * @apiSuccess {String}   subscribe.avatar 头像
+ */
+
+/**
+ * @api {get} wonderful/main/?l=journal.getMyList 我的小刊列表
+ * @apiVersion 1.0.0
+ * @apiName journal.getMyList
+ * @apiGroup Journal
+ *
+ * @apiDescription 我的小刊列表,按照分类读取
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} system 分类id
+ *
+ * @apiSuccess {Object[]} user 用户基本信息
+ * @apiSuccess {String}   user.id 用户id
+ * @apiSuccess {String}   user.username 用户名
+ * @apiSuccess {String}   user.avatar 头像
+ *
+ * @apiSuccess {Object[]} journal 小刊数据列表
+ * @apiSuccess {String}   journal.id 小刊id
+ * @apiSuccess {String}   journal.name 名称
+ * @apiSuccess {String}   journal.subname 期号
+ * @apiSuccess {String}   journal.pic_cover 列表封面图片 暂时无效
+ * @apiSuccess {String}   journal.pic_view_cover 小刊封面图片 封面图都用这个
+ * @apiSuccess {String}   journal.pic_view_bg 全屏背景图,多张图片,这是一个数组
+ * @apiSuccess {String}   journal.pic_gd 小刊推广图
+ * @apiSuccess {String}   journal.pdate 时间
+ * @apiSuccess {String}   journal.num_ding 订阅数
+ * @apiSuccess {String}   journal.num_view 浏览量
+ * @apiSuccess {String}   journal.num_comment 评论量
+ * @apiSuccess {String}   journal.buy 小刊是否收费 1收费 2免费 3会员
+ * @apiSuccess {String}   journal.bgmusic 小刊背景音乐
+ *
+ * @apiSuccess {Object[]} subscribe 订阅列表
+ * @apiSuccess {String}   subscribe.id 
+ * @apiSuccess {String}   subscribe.username 用户名
+ * @apiSuccess {String}   subscribe.avatar 头像
+ */
+
 /**
  * @api {get} wonderful/main/?l=journal.jingxuan 小刊精选更多
  * @apiVersion 1.0.0

+ 34 - 1
journal/database/cate.php

@@ -1,5 +1,22 @@
 <?php
 
+$type = array
+(
+    # 默认类型
+    3 => '图文内容',
+    1 => '全屏图',
+    2 => '长图',
+    # 2018-12-11 增加3个类型
+    4 => '全屏视频',
+    5 => '留言视频',
+    6 => '留言音频',
+
+    # 关联类型 > 10
+    11 => '关联图文',
+    12 => '关联视频',
+    13 => '关联直播',
+);
+
 return array
 (
     # 表名
@@ -8,6 +25,11 @@ return array
     'lang' => '小刊分类设置',
     # 后台菜单排序
     'order' => 9,
+    'end' => array
+    (
+        'update' => 'passport/lib/manage.updateSystem',
+        'insert' => 'passport/lib/manage.updateSystem',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -35,6 +57,17 @@ return array
             'list'      => true,
         ),
 
+        'type'     => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '内容类型-定义小刊下的内页内容类型',
+            'default'   => '1,2,3,4,5,6,11,12,13',
+            'desc'      => '内容类型',
+            'match'     => 'is_numeric',
+            'update'    => 'checkbox',
+            'option'    => $type,
+        ),
+
         'title'      => array
         (
             'type'      => 'varchar-32',
@@ -72,7 +105,7 @@ return array
         'logo'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => 'logo图-公众号支付中的logo图,图片尺寸100*100px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => 'logo图-当前分类的logo图,图片尺寸100*100px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => 'logo图',
             'match'     => 'option',

+ 28 - 2
journal/database/content.php

@@ -1,6 +1,13 @@
 <?php
 
-$type = array
+$id = Dever::input('search_option_info_id');
+$cate = array();
+if ($id) {
+    $journal = Dever::db('journal/info')->one($id);
+    $cate = Dever::db('journal/cate')->one($journal['cate_id']);
+}
+
+$type_config = array
 (
     # 默认类型
     3 => '图文内容',
@@ -17,6 +24,25 @@ $type = array
     13 => '关联直播',
 );
 
+$type_default = 3;
+
+if ($cate) {
+    $type = array();
+    $cate_type = explode(',', $cate['type']);
+    $i = 0;
+    foreach ($cate_type as $k => $v) {
+        if (isset($type_config[$v])) {
+            if ($i == 0) {
+                $type_default = $v;
+            }
+            $type[$v] = $type_config[$v];
+            $i++;
+        }
+    }
+} else {
+    $type = $type_config;
+}
+
 $is_button = array
 (
     1 => '显示',
@@ -97,7 +123,7 @@ return array
         (
             'type'      => 'int-11',
             'name'      => '类型',
-            'default'   => '3',
+            'default'   => $type_default,
             'desc'      => '类型',
             'match'     => 'is_numeric',
             'update'    => 'radio',

+ 18 - 0
journal/database/info.php

@@ -507,6 +507,7 @@ return array
 			(
 				'ids' => array('yes-id', 'in'),
 				//'cate_id' => 'yes',
+				'cate_id' => 1,//暂时先只显示分类id为1的小刊
 				'name' => array('yes', 'like'),
 				'id' => 'yes',
 				'state' => 1,
@@ -533,6 +534,23 @@ return array
 			//'page' => array(10, 'list'),
 			'col' => $col,
 		),
+
+		'getAllByPage' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				//'audit' => 2,
+				'buy' => 'yes',
+				'cate_id' => 'yes',
+				'status' => 2,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'page' => array(10, 'list'),
+			'col' => $col,
+		),
 		
 		# 更新浏览量
 		'addView' => array

+ 23 - 0
journal/database/order.php

@@ -41,6 +41,17 @@ $buy = function()
     return Dever::db('journal/buy_num')->state();
 };
 
+$cate = function()
+{
+    $array = array();
+    $info = Dever::db('journal/cate')->state();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
+
 $seller = function()
 {
     return Dever::db('code/seller')->state();
@@ -87,6 +98,18 @@ return array
             //'list'        => '"{order_id}" ? "{order_id}" : "{code}"',
         ), 
 
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            'search'    => 'select',
+        ),
+
         'name'      => array
         (
             'type'      => 'varchar-80',

+ 72 - 0
main/src/Journal.php

@@ -7,14 +7,35 @@ use Main\Lib\Core;
 
 class Journal extends Core
 {
+    private function getCate()
+    {
+        $id = Dever::input('system', 1);
+
+        $cate = array();
+        if ($id > 0) {
+            $cate = Dever::db('journal/cate')->one($id);
+        }
+
+        if (!$cate) {
+            Dever::alert('分类错误');
+        }
+
+        $this->data['cate'] = $cate;
+
+        return $cate;
+    }
+
     # 小刊首页
     public function home()
     {
         # 精选推荐
         $this->jingxuan(-1, 5);
 
+        $cate = $this->getCate();
+
         # 小刊列表
         $where = array();
+        $where['cate_id'] = $cate['id'];
         if (checkVersion()->journal_buy == 2) {
             # 隐藏支付的小刊
             //$where['buy'] = 2;
@@ -32,6 +53,57 @@ class Journal extends Core
         return $this->data;
     }
 
+    # 根据分类获取小刊列表
+    public function getList()
+    {
+        $cate = $this->getCate();
+
+        # 小刊列表
+        $where = array();
+        $where['cate_id'] = $cate['id'];
+        $data = Dever::db('journal/info')->getAllByPage($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->info($v);
+            }
+            $this->data['journal'] = $data;
+        } else {
+            $this->data['journal'] = array();
+        }
+
+        return $this->data;
+    }
+
+    # 根据分类获取我已订阅的小刊列表
+    public function getMyList()
+    {
+        if (!$this->data['uid']) {
+            Dever::alert('错误的用户信息');
+        }
+
+        $cate = $this->getCate();
+
+        # 获取我的信息
+        $this->data['user'] = Dever::load('passport/api')->info($this->data['uid']);
+        
+        # 我的小刊列表
+        $where = array();
+        $where['type'] = 4;
+        $where['source'] = '1,2';
+        $where['cate_id'] = $cate['id'];
+        $data = Dever::db('act/subscribe')->getMyAll($where);
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k] = $this->info($v);
+            }
+            $this->data['journal'] = $data;
+        } else {
+            $this->data['journal'] = array();
+        }
+
+        return $this->data;
+    }
+
     # 获取详细信息
     private function info($data, $subscribe = true)
     {

+ 8 - 0
main/src/View.php

@@ -136,6 +136,14 @@ class View extends Core
         return $this->get('feature/lib/info', '专题', 6, 'feature');
     }
 
+    # 获取单页详情
+    public function getPage()
+    {
+        $this->data['info'] = $this->page();
+
+        return $this->data;
+    }
+
     # 获取单页详情
     public function page()
     {

+ 22 - 1
stat/database/journal.php

@@ -9,7 +9,16 @@ $journal = function()
     }
     return $array;
 };
-
+$cate = function()
+{
+    $array = array();
+    $info = Dever::db('journal/cate')->state();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
 $list = array
 (
     # 匹配的正则或函数 选填项
@@ -80,6 +89,18 @@ return array
             //'list'        => true,
         ),
 
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            'search'    => 'select',
+        ),
+
         'journal_id'      => array
         (
             'type'      => 'int-11',

+ 22 - 1
stat/database/source.php

@@ -19,7 +19,16 @@ $source = function()
     }
     return $array;
 };
-
+$cate = function()
+{
+    $array = array();
+    $info = Dever::db('journal/cate')->state();
+    if($info)
+    {
+        $array += $info;
+    }
+    return $array;
+};
 $list = array
 (
     # 匹配的正则或函数 选填项
@@ -104,6 +113,18 @@ $config = array
             'list'      => true,
         ),
 
+        'cate_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '小刊分类',
+            'default'   => '1',
+            'desc'      => '小刊分类',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $cate,
+            'search'    => 'select',
+        ),
+
         'journal_id'      => array
         (
             'type'      => 'int-11',

+ 3 - 2
stat/lib/Journal.php

@@ -82,10 +82,10 @@ class Journal
                 }
             }
         }
-        $this->update($info['id'], $day, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash);
+        $this->update($info['cate_id'], $info['id'], $day, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash);
     }
 
-    public function update($info_id, $day, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash)
+    public function update($cate_id, $info_id, $day, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash)
     {
         $update = array();
         $update['day_string'] = $day;
@@ -95,6 +95,7 @@ class Journal
         $update['order_no_num'] = $order_no_num;
         $update['buy_num'] = $buy_num;
         $update['buy_cash'] = $buy_cash;
+        $update['cate_id'] = $cate_id;
         $update['journal_id'] = $info_id;
         $update['cdate'] = time();
 

+ 3 - 2
stat/lib/Source.php

@@ -87,10 +87,10 @@ class Source
             }
         }
 
-        $this->update($source['id'], $info['id'], $day, $pv, $uv, $user_num, $user_yes_num, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash);
+        $this->update($source['id'], $info['cate_id'], $info['id'], $day, $pv, $uv, $user_num, $user_yes_num, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash);
     }
 
-    public function update($source_id, $info_id, $day, $pv, $uv, $user_num, $user_yes_num, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash)
+    public function update($source_id, $cate_id, $info_id, $day, $pv, $uv, $user_num, $user_yes_num, $order_num, $order_yes_num, $order_no_num, $buy_num, $buy_cash)
     {
         $update = array();
         $update['day_string'] = $day;
@@ -105,6 +105,7 @@ class Source
         $update['buy_num'] = $buy_num;
         $update['buy_cash'] = $buy_cash;
         $update['source_id'] = $source_id;
+        $update['cate_id'] = $cate_id;
         $update['journal_id'] = $info_id;
         $update['cdate'] = time();