Authored by wuxiao

Merge branch 'release'

... ... @@ -485,13 +485,15 @@
| like_num | int|点赞数
| audience_num | int|正在观看人数
| live_title | str|直播时的房间标题
| live_start_time | int|直播开始时间(时间戳)
| live_end_time | int|直播结束时间(时间戳)
| live_start_time | int|本次视频片段开始时间(时间戳)
| live_end_time | int|本次视频片段结束时间(时间戳)
| background_pic | str|房间背景图片url
| share_url | str|分享链接url
| share_title | str|分享标题
| share_content | str|分享内容
###### notice:
回放视频时长自己播放器就能显示,不要用live_end_time-live_start_time。
# **获取回放弹幕**
... ...
... ... @@ -38,11 +38,12 @@ class Room extends \yii\db\ActiveRecord
public function rules()
{
return [
[['room_id', 'master_id', 'app', 'starting_time', 'living', 'status', 'create_time', 'update_time'], 'integer'],
[['best', 'vest'], 'string'],
[['room_id', 'master_id', 'starting_time', 'best', 'vest', 'living', 'status', 'create_time', 'update_time'], 'integer'],
[['title', 'watermark'], 'string', 'max' => 100],
[['secret'], 'string', 'max' => 50],
[['app', 'secret'], 'string', 'max' => 50],
[['pic'], 'string', 'max' => 255],
[['room_id'], 'unique'],
[['secret'], 'unique'],
];
}
... ...
... ... @@ -153,17 +153,17 @@
// 文件上传过程中创建进度条实时显示。
uploader.on('uploadProgress', function(file, percentage) {
var $li = $('#' + file.id),
$percent = $li.find('.progress span');
// 避免重复创建
if (!$percent.length) {
$percent = $('<p class="progress"><span></span></p>')
.appendTo($li)
.find('span');
}
$percent.css('width', percentage * 100 + '%');
var $li = $( '#'+file.id ),
$percent = $li.find('.progress .progress-bar');
// 避免重复创建
if ( !$percent.length ) {
$percent = $('<div class="progress progress-striped active">' +
'<div class="progress-bar" role="progressbar" style="width: 0%">' +
'</div>' +
'</div>').appendTo($li).find('.progress-bar');
}
$li.find('p.state').text("上传中");
$percent.css( 'width', percentage * 100 + '%' );
});
// 文件上传成功,给item添加成功class, 用样式标记上传成功。
... ... @@ -189,7 +189,7 @@
// 完成上传完了,成功或者失败,先删除进度条。
uploader.on('uploadComplete', function(file) {
$('#' + file.id).find('.progress').remove();
$('#' + file.id).find('.progress').remove();
});
uploader.on('ready', function() {
... ...
... ... @@ -37,13 +37,12 @@ class Room extends \yii\db\ActiveRecord
public function rules()
{
return [
[['room_id', 'master_id', 'app', 'starting_time', 'living', 'status', 'create_time', 'update_time'], 'integer'],
[['best', 'vest'], 'string'],
[['room_id', 'master_id', 'starting_time', 'best', 'vest', 'living', 'status', 'create_time', 'update_time'], 'integer'],
[['title', 'watermark'], 'string', 'max' => 100],
[['secret'], 'string', 'max' => 50],
[['app', 'secret'], 'string', 'max' => 50],
[['pic'], 'string', 'max' => 255],
[['create_time', 'update_time'], 'default', 'value' => time()],
[['create_time', 'update_time'], 'required'],
[['room_id'], 'unique'],
[['secret'], 'unique'],
];
}
... ...
... ... @@ -19,14 +19,14 @@ class RoomController extends Controller
//获取未开始的房间
$result = Room::find()
->where(['living'=>0])
->where(['living'=>[0,2]])
->orderBy(['starting_time'=>SORT_ASC])
->all();
if($result){
foreach($result as $row){
//当前时间大于开始时间-》标记成已结束
if(time() > $row->starting_time){
//状态为未开始 && 当前时间大于预告时间->标记成已结束
if(($row->living == 0) && (time() > $row->starting_time)){
$room_id = $row->room_id;
$row->setAttributes([
'living'=>2,
... ... @@ -38,6 +38,19 @@ class RoomController extends Controller
echo "room ".$room_id."reset failed. \n";
}
}
//状态为已结束 && 当前时间小于预告时间->标记成未开始
if(($row->living == 2) && (time() < $row->starting_time)){
$room_id = $row->room_id;
$row->setAttributes([
'living'=>0,
'update_time'=>time()
]);
if($row->save()){
echo "room ".$room_id."has been reset to 0. \n";
}else{
echo "room ".$room_id."reset failed. \n";
}
}
}
}
sleep(10);
... ...
... ... @@ -270,8 +270,8 @@ class LivingController extends BaseController
$ret['background_pic'] = 'http://img11.static.yhbimg.com/global/2016/08/17/18/01f17a9cd44149052482e4ee58e590cf1b.png';
$ret['share_url'] = 'http://m.yohobuy.com/activity/live/'.$room_id;
$ret['share_title'] = '分享标题';
$ret['share_content'] = '分享内容';
$ret['share_title'] = '有货潮流新品节直播开始啦,快来看!';
$ret['share_content'] = 'YO\'HOOD嘉年华现场火热直播中,明星潮牌等你来!';
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
->createCommand('SELECT update_time FROM {{%room}} WHERE room_id=:room_id')
->bindValue(':room_id', $room_id)
... ... @@ -335,8 +335,8 @@ class LivingController extends BaseController
$ret['background_pic'] = 'http://img11.static.yhbimg.com/global/2016/08/17/18/01f17a9cd44149052482e4ee58e590cf1b.png';
$ret['share_url'] = 'http://m.yohobuy.com/activity/live/replay/'.$video_id;
$ret['share_title'] = '分享标题';
$ret['share_content'] = '分享内容';
$ret['share_title'] = '有货潮流新品节直播开始啦,快来看!';
$ret['share_content'] = 'YO\'HOOD嘉年华现场火热直播中,明星潮牌等你来!';
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
->createCommand('SELECT update_time FROM {{%video}} WHERE id=:video_id')
... ...