dever 6 years ago
parent
commit
115c409f48

+ 1 - 0
act/database/comment.php

@@ -2,6 +2,7 @@
 
 $page = 10;
 $table = Dever::config('base')->type;
+$table[5] = '小刊音视频';
 
 return array
 (

+ 131 - 0
act/database/feedback.php

@@ -0,0 +1,131 @@
+<?php
+
+$page = 10;
+$table = Dever::config('base')->type;
+
+return array
+(
+	# 表名
+	'name' => 'feedback',
+	# 显示给用户看的名称
+	'lang' => '反馈管理',
+	# 是否显示在后台菜单
+	'order' => 100,
+	# 数据结构
+	'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'	=> 'select',
+			//'search'	=> 'select',
+			'search'    => array
+            (
+                'api' => 'passport/user-all',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+			'list'		=> '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
+		),
+
+		'username' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '用户姓名',
+			'default' 	=> '',
+			'desc' 		=> '用户姓名',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> true,
+		),
+
+		'name' 		=> array
+		(
+			'type' 		=> 'varchar-200',
+			'name' 		=> '标题',
+			'default' 	=> '',
+			'desc' 		=> '标题',
+			'match' 	=> 'option',
+			'search'	=> 'fulltext',
+			//'list'		=> 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
+			//'list'		=> true,
+		),
+		
+		'content'		=> array
+		(
+			'type' 		=> 'text-255',
+			'name' 		=> '反馈内容',
+			'update' 	=> 'editor',
+			'key'		=> 1,
+			'default' 	=> '',
+			'desc' 		=> '请输入内容',
+			'match' 	=> 'is_string',
+			'search'	=> 'fulltext',
+			//'list'		=> 'table',
+			//'modal'		=> '查看详情',
+			'list'		=> 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
+	(
+		'insert' => false,
+		'edit' => false,
+	),
+
+	# request 请求接口定义
+	'request' => array
+	(
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'uid' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('id' => 'desc'),
+			'page' => array($page, 'list'),
+			'col' => '*',
+		),
+	)
+);

+ 25 - 0
act/lib/Feedback.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace Act\Lib;
+
+use Dever;
+
+class Feedback
+{
+    # 发表反馈
+    public function submit($uid, $username, $name, $content)
+    {
+        $where['uid'] = $uid;
+        $where['username'] = $username;
+        $where['name'] = $name;
+        $where['content'] = $content;
+        $table = $this->table($type);
+        $info = Dever::db($table)->one($where);
+        if (!$info) {
+            Dever::db($table)->insert($where);
+        }
+        Dever::score($uid, 'submit_feedback', '发表反馈');
+
+        return true;
+    }
+}

+ 36 - 2
combine/lib/Core.php

@@ -14,6 +14,7 @@ class Core
         (
             'passport/app',
             'passport/wechat',
+            'act/feedback',
             'act/comment',
             'act/form_id',
             'act/invite',
@@ -36,14 +37,47 @@ class Core
             'pay/order',
             'journal/order',
         );
+        if (is_string($drop)) {
+            $drop = explode(',', $drop);
+        }
         foreach ($drop as $k => $v) {
+            if ($v == $uid) {
+                continue;
+            }
             foreach ($table as $k1 => $v1) {
                 Dever::db($v1)->updates(array('set_uid' => $uid, 'option_uid' => $v));
+                echo 22;die;
             }
-            Dever::db('code/info')->updates(array('set_create_uid' => $uid, 'option_create_uid' => $v));
-            Dever::db('invite/relation')->updates(array('set_to_uid' => $uid, 'option_to_uid' => $v));
+
+            # 处理一些特殊的情况
+            $this->other($uid, $v);
 
             # 积分相关 要把积分加上,再删掉之前的
+            $this->score($uid, $v, 'score/user');
+            $this->score($uid, $v, 'act/score');
         }
     }
+
+    private function other($uid, $drop_uid)
+    {
+        Dever::db('code/info')->updates(array('set_create_uid' => $uid, 'option_create_uid' => $drop_uid));
+        Dever::db('invite/relation')->updates(array('set_to_uid' => $uid, 'option_to_uid' => $drop_uid));
+    }
+
+    private function score($uid, $drop_uid, $table, $col = 'score')
+    {
+        $db = Dever::db($table);
+        $user_score = $db->one(array('uid' => $uid));
+        $user_drop_score = $db->one(array('uid' => $drop_uid));
+        $score = $user_score[$col] + $user_drop_score[$col];
+
+        $update['where_id'] = $user_score['id'];
+        $update['score'] = $score;
+        $db->update($update);
+
+        $update['where_id'] = $user_drop_score['id'];
+        $update['score'] = 0;
+        $update['state'] = 0;
+        $db->update($update);
+    }
 }

+ 58 - 1
doc/apidoc.php

@@ -184,6 +184,24 @@
  * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  */
 
+/**
+ * @api {get} wonderful/passport/?l=app.bind_mobile 更新用户手机号-验证码绑定
+ * @apiVersion 1.0.0
+ * @apiName app.bind_mobile
+ * @apiGroup AppPassport
+ *
+ * @apiDescription 更新用户手机号-验证码绑定
+ *
+ * @apiParam {Number} uid 用户id
+ * @apiParam {Number} mobile 手机号
+ * @apiParam {String} mcode 验证码
+ * @apiParam {String} signature signature
+ *
+
+ * @apiSuccess {Number}   uid  用户id,请保存在本地
+ * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
+ */
+
 /**
  * @api {get} wonderful/passport/?l=app.update 更新用户信息
  * @apiVersion 1.0.0
@@ -204,6 +222,31 @@
  * @apiSuccess {String}   signature 用于登录后的uid验证,每次都要传入,请登录后将这个值保存在本地
  */
 
+/**
+ * @api {get} wonderful/main/?l=view.content 获取富文本内容
+ * @apiVersion 1.0.0
+ * @apiName view.content
+ * @apiGroup App
+ *
+ * @apiDescription 获取富文本内容
+ *
+ * @apiParam {Number} signature 用户signature
+ * @apiParam {String} type 类型1为图文、2为视频、3为直播、4为小刊内容,6为专题
+ * @apiParam {String} id 图文等内容id,如果为4,则为小刊的内容id,而非小刊id
+ *
+ * @apiSuccess {String}   html 直接返回html的信息,请注意里面的协议:jstyle://live_note?id=0&live_id=1&file=test
+
+ 其中有几个:
+
+ jstyle://video?id=0&vod_id=1&file=test 播放视频 id=0为content_array里的数组索引,vod_id为视频id,file为视频文件地址
+
+ jstyle://live?id=0&live_id=1&file=test 播放直播 id=0为content_array里的数组索引,live_id为直播id,file为直播文件地址
+
+ jstyle://live_note?id=0&live_id=1&file=test&note=1 设置直播提醒 id=0为content_array里的数组索引,live_id为直播id,file为直播文件地址,note值为1是已设置提醒,2为未设置提醒
+
+ jstyle://auido?id=0&file=test&note=1 播放视频 id=0为content_array里的数组索引,file为直播文件地址
+ */
+
 
 /**
  * @api {get} wonderful/live/?l=api.get 获取直播推流信息
@@ -703,7 +746,21 @@
  * @apiSuccess {Number}  id 当前的数据id
  */
 
-
+/**
+ * @api {get} wonderful/main/?l=user.submit_feedback 提交反馈
+ * @apiVersion 1.0.0
+ * @apiName user.submit_feedback
+ * @apiGroup UserAction
+ *
+ * @apiDescription 提交反馈
+ *
+ * @apiParam {String} signature signature
+ * @apiParam {String} content 反馈内容 必填
+ * @apiParam {String} username 用户名 选填
+ * @apiParam {String} name 反馈标题 选填
+ *
+ * @apiSuccess {Number}  id 当前的数据id
+ */
 
 /**
  * @api {get} wonderful/main/?l=journal.home 小刊首页

+ 97 - 0
main/assets/mobile/content.html

@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <title></title>
+<link href="css/global.css?v=6e375888" rel="stylesheet"><link href="css/index.css?v=6e375888" rel="stylesheet"></head>
+
+<body>
+    <div class="rich-wrapper">
+        <{loop($content):}>  
+
+        <{if($v['type'] == 1):}>
+        <{$v['content']}>
+
+        <{elseif($v['type'] == 2):}>
+
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_<{$k}>" href="jstyle://video?id=<{$k}>&vod_id=<{$v['content']['id']}>&file=<{$v['content']['video']}>">
+                <img src="<{$v['content']['pic_cover']}>" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit"><{$v['content']['name']}></div>
+            <!--视频/图片副标题-->
+            <div class="tit-mini">已有 <{$v['content']['num_view']}> 人观看了视频</div>
+        </div>
+
+        <{elseif($v['type'] == 3):}>
+
+        <div class="p-img">
+            <a class="poster" id="live_<{$k}>" href="jstyle://live?id=<{$k}>&live_id=<{$v['content']['id']}>&file=<{$v['content']['url']}>">
+                <img src="<{$v['content']['pic_cover']}>" alt="" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+        </div>
+
+        <!--直播-->
+        <div class="live-notice" style="display:none;">
+            <div class="watch-user"><{$v['content']['num_view']}> 人观看</div>
+        </div>
+        <!--直播-->
+        <div class="live-notice">
+            <div class="notice-time">开播时间 <{$v['content']['sdate_time']}></div>
+            <{if($v['content']['user_act'] == 1):}>
+            <a id="live_note_<{$k}>" href="jstyle://live_note?id=<{$k}>&live_id=<{$v['content']['id']}>&note=1" class="btn-notice">已设置提醒</a>
+            <{else:}>
+            <a id="live_note_<{$k}>" href="jstyle://live_note?id=<{$k}>&live_id=<{$v['content']['id']}>&note=2" class="btn-notice">提醒我</a>
+            <{endif}>
+        </div>
+        <!--直播-->
+        <div class="live-notice" style="display:none;">
+            <div class="online-user"><{$v['content']['num_user']}>人在线</div>
+        </div>
+
+        <{elseif($v['type'] == 5):}>
+        <!--音频-->
+        <a class="p-voice" id="auido_<{$k}>" href="jstyle://auido?id=<{$k}>&file=<{$v['content']}>">
+            <img src="<{$v['cover']}>" alt="<{$v['name']}>" class="mavatar">
+            <div class="sound"></div>
+        </a>
+
+        <{elseif($v['type'] == 6):}>
+        <!--视频-->
+        <div class="p-img">
+            <a class="poster" id="video_<{$k}>" href="jstyle://video?id=<{$k}>&file=<{$v['content']}>">
+                <img src="<{$v['cover']}>" alt="<{$v['name']}>" class="media-cover">
+                <div class="ico-video-play"></div>
+            </a>
+            <!--视频/图片标题-->
+            <div class="tit"><{$v['name']}></div>
+        </div>
+
+        <{elseif($v['type'] == 7):}>
+        <!--图片-->
+        <div class="p-img">
+            <img class="img" src="<{$v['pic_cover']}>" alt="">
+            <!--视频/图片标题-->
+            <div class="tit" style="display:none;">段宜恩:强大精神力的猫系偶像</div>
+        </div>
+
+        <{endif}>
+
+        <{endloop}>
+    </div>
+<script type="text/javascript" src="js/global.js?v=6e375888"></script><script type="text/javascript" src="js/index.js?v=6e375888"></script></body>
+<script>
+function audioPlay(id){
+    $('#auido_'+ id).find('.sound').addClass('playing');
+}
+function audioPause(id){
+    $('#auido_'+ id).find('.sound').removeClass('playing');
+}
+</script>
+</html>

+ 1 - 1
main/src/Journal.php

@@ -388,7 +388,7 @@ class Journal extends Core
         return $this->data;
     }
 
-    private function readContent($info)
+    public function readContent($info)
     {
         $name = $info['name'];
         $focus = $info['focus'];

+ 21 - 0
main/src/User.php

@@ -240,4 +240,25 @@ class User extends Core
 
         return array('id' => $id, 'type' => $type);
     }
+
+    # 发布反馈
+    public function submit_feedback()
+    {
+        $username = Dever::input('username');
+        if (!$username) {
+            //Dever::alert('错误的用户姓名');
+        }
+        $name = Dever::input('name');
+        if (!$name) {
+            //Dever::alert('错误的标题');
+        }
+        $content = Dever::input('content');
+        if (!$content) {
+            Dever::alert('错误的内容');
+        }
+
+        Dever::load('act/lib/feedback')->submit($this->data['uid'], $username, $name, $content);
+
+        return array('id' => $id, 'type' => $type);
+    }
 }

+ 47 - 0
main/src/View.php

@@ -146,4 +146,51 @@ class View extends Core
         
         return Dever::db('content/page')->one(array('key' => $key));
     }
+
+    # 根据类型,获取详情的html页面
+    public function content()
+    {
+        $type = Dever::input('type');
+        $id = Dever::input('id');
+        $signature = Dever::input('signature');
+        $data = array();
+        switch($type) {
+            case 1:
+                $data = $this->article();
+                break;
+            case 2:
+                $data = $this->vod();
+                break;
+            case 3:
+                $data = $this->live();
+                break;
+            case 4:
+                # 这个有点特殊
+                $info = Dever::db('journal/content')->one($id);
+                if (!$info) {
+                    Dever::alert('错误的数据');
+                }
+                $data = Dever::load('main/journal')->readContent($info);
+                break;
+            case 6:
+                $data = $this->feature();
+                break;
+        }
+
+        if ($data) {
+            if (isset($data['info']['content_array'])) {
+                $data['content'] = $data['info']['content_array'];
+            } elseif (isset($data['info']['content'])) {
+                $data['content'][] = array
+                (
+                    'type' => 1,
+                    'content' => $data['info']['content']
+                );
+            }
+            
+            return Dever::render('content', $data);
+        } else {
+            Dever::alert('错误的数据');
+        }
+    }
 }