dever 6 years ago
parent
commit
e12b407456
7 changed files with 134 additions and 15 deletions
  1. 1 1
      doc/apidoc.json
  2. 20 6
      doc/apidoc.php
  3. 20 1
      main/src/Content.php
  4. 25 0
      main/src/Live.php
  5. 4 5
      push/database/data.php
  6. 5 2
      push/database/info.php
  7. 59 0
      push/lib/Data.php

+ 1 - 1
doc/apidoc.json

@@ -3,7 +3,7 @@
   "version": "1.0.0",
   "description": "精美时尚内容平台接口文档",
   "title": "精美时尚内容平台接口文档",
-  "url" : "https://huoxingkandiqiu.com/",
+  "url" : "http://www.huoxingkandiqiu.com/",
   "template": {
     "withCompare": true,
     "withGenerator": true

+ 20 - 6
doc/apidoc.php

@@ -25,7 +25,7 @@
 
 
 /**
- * @api {get} passport/?l=applet.bind 用户登录
+ * @api {get} wonderful/passport/?l=applet.bind 用户登录
  * @apiVersion 1.0.0
  * @apiName applet.bind
  * @apiGroup Passport
@@ -40,7 +40,7 @@
  */
 
 /**
- * @api {get} passport/?l=applet.update 更新用户信息
+ * @api {get} wonderful/passport/?l=applet.update 更新用户信息
  * @apiVersion 1.0.0
  * @apiName applet.update
  * @apiGroup Passport
@@ -63,7 +63,7 @@
 
 
 /**
- * @api {get} passport/?l=applet.mobile 更新用户手机号-微信绑定
+ * @api {get} wonderful/passport/?l=applet.mobile 更新用户手机号-微信绑定
  * @apiVersion 1.0.0
  * @apiName applet.mobile
  * @apiGroup Passport
@@ -83,7 +83,7 @@
  */
 
 /**
- * @api {get} passport/?l=applet.bind_mobile 绑定手机号-验证码绑定
+ * @api {get} wonderful/passport/?l=applet.bind_mobile 绑定手机号-验证码绑定
  * @apiVersion 1.0.0
  * @apiName applet.bind_mobile
  * @apiGroup Passport
@@ -101,7 +101,7 @@
  */
 
 /**
- * @api {get} passport/?l=reg.getMCode 获取手机验证码
+ * @api {get} wonderful/passport/?l=reg.getMCode 获取手机验证码
  * @apiVersion 1.0.0
  * @apiName reg.getMCode
  * @apiGroup Passport
@@ -115,7 +115,21 @@
  */
 
 /**
- * @api {get} content/?l=api.home 获取首页数据
+ * @api {get} wonderful/main/?l=live.get 获取直播推流信息
+ * @apiVersion 1.0.0
+ * @apiName live.get
+ * @apiGroup Live
+ *
+ * @apiDescription 获取直播推流信息
+ *
+ * @apiParam {String} key 流的key
+ * @apiParam {String} signature 请将字符串signature_dever_2018_jm经过md5加密
+ *
+ * @apiSuccess {String}   live 推流地址
+ */
+
+/**
+ * @api {get} wonderful/main/?l=content.home 获取首页数据
  * @apiVersion 1.0.0
  * @apiName api.home
  * @apiGroup Content

+ 20 - 1
main/src/Content.php

@@ -10,7 +10,26 @@ class Content extends Core
     # 首页精选
     public function home()
     {
-        
+        # 栏目
+        $this->data['menu'] = Dever::load('push/lib/data')->get('menu');
+
+        # 焦点图
+        $this->data['focus'] = Dever::load('push/lib/data')->get('focus');
+
+        # 推荐位
+        $this->data['link'] = Dever::load('push/lib/data')->get('link');
+
+        # 广告
+        $this->data['ad'] = Dever::load('push/lib/data')->get('ad');
+
+        # 精选推荐
+
+        # 更多
+
+
+        return $this->data;
+
+
     }
 
     # 查看详情

+ 25 - 0
main/src/Live.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+
+class Live
+{
+    # 获取直播地址
+    public function get()
+    {
+        $signature = Dever::input('signature');
+        if ($signature != md5('signature_dever_2018_jm')) {
+            Dever::alert('signature error');
+        }
+        $key = Dever::input('key');
+        $data = Dever::db('live/stream')->one(array('key' => $key));
+
+        if ($data) {
+            return array('live' => $data['live']);
+        } else {
+            return array('live' => '');
+        }
+    }
+}

+ 4 - 5
push/database/data.php

@@ -197,7 +197,7 @@ return array
         'pic'       => array
         (
             'type'      => 'varchar-200',
-            'name'      => '图片-手动干扰项,请上传,' . $info['col_pic'] . '大小的图片',
+            'name'      => '图片或图标-手动干扰项,请上传,' . $info['col_pic'] . '大小的图片',
             'default'   => '',
             'desc'      => '请选择图片',
             'match'     => $pic_state ? 'option' : 'option',
@@ -214,7 +214,7 @@ return array
             'default'   => '',
             'desc'      => '请输入描述',
             'match'     => $content_state ? 'option' : 'option',
-            'update'    => $content_state ? 'editor' : 'hidden',
+            //'update'    => $content_state ? 'editor' : 'hidden',
         ),
         
         'reorder'       => array
@@ -257,17 +257,16 @@ return array
     'request' => array
     (
         # 获取列表页
-        'getAllByType' => array
+        'getAll' => array
         (
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'type' => 'yes',
                 'info_id' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',
-            'order' => array('reorder' => 'desc'),
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
             //'col' => '*|type|',
             'col' => '*',
         ),

+ 5 - 2
push/database/info.php

@@ -40,7 +40,7 @@ $col = array
     1 => '标题',
     //2 => '链接',
     3 => '图片',
-    4 => '描述',
+    //4 => '描述',
 );
 
 return array
@@ -86,9 +86,10 @@ return array
             'default'   => '',
             'desc'      => '推送位标识',
             'match'     => 'is_string',
-            'update'    => 'text',
+            'update'    => 'disable',
             'search'    => 'fulltext',
             'list'      => true,
+            //'auth'      => '!{key}'
         ),
 
         'num'       => array
@@ -284,6 +285,8 @@ return array
 
     'manage' => array
     (
+        'delete' => false,
+        //'edit' => false,
         //'insert' => $curPage ? true : false,
         'list_button' => array
         (

+ 59 - 0
push/lib/Data.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace Push\Lib;
+
+use Dever;
+
+class Data
+{
+    public function get($key)
+    {
+        $info = Dever::db('push/info')->one(array('key' => $key));
+
+        $data = array();
+        if ($info) {
+            $data = Dever::db('push/data')->getAll(array('info_id' => $info['id']));
+
+            if ($data) {
+                foreach ($data as $k => $v) {
+                    $data[$k] = $this->getOne($v);
+                }
+            }
+        }
+
+        return $data;
+    }
+
+    private function getOne($info)
+    {
+        if ($info['type'] < 10) {
+            $table = Dever::config('base')->type_table[$info['type']];
+            if ($info['type'] == 1) {
+                $id = $info['article_id'];
+            } elseif ($info['type'] == 2) {
+                $id = $info['vod_id'];
+            } elseif ($info['type'] == 3) {
+                $id = $info['live_id'];
+            } elseif ($info['type'] == 4) {
+                $id = $info['journal_id'];
+            }
+
+            if ($id > 0) {
+                $data = Dever::db($table)->one($id);
+                if (isset($data) && $data) {
+                    if (isset($data['name']) && !$info['name']) {
+                        $info['name'] = $data['name'];
+                    }
+                    if (isset($data['pic_cover']) && !$info['pic']) {
+                        $info['pic'] = $data['pic_cover'];
+                    }
+                    if (isset($data['pic_view_cover']) && !$info['pic']) {
+                        $info['pic'] = $data['pic_view_cover'];
+                    }
+                }
+            }
+        }
+
+        return $info;
+    }
+}