Authored by xiaofeng.yao@yoho.cn

开始直播接口修改

@@ -8,7 +8,8 @@ return [ @@ -8,7 +8,8 @@ return [
8 ], 8 ],
9 'redis' => [ 9 'redis' => [
10 'class' => 'yii\redis\Connection', 10 'class' => 'yii\redis\Connection',
11 - 'hostname' => 'localhost', 11 + 'hostname' => '123.56.138.21',
  12 + 'password' => 'yohoglobal',
12 'port' => 6379, 13 'port' => 6379,
13 'database' => 0, 14 'database' => 0,
14 ], 15 ],
1 <?php 1 <?php
2 return [ 2 return [
  3 + 'cache_prefix'=>'ImDev',
3 ]; 4 ];
@@ -145,6 +145,18 @@ class Video extends \yii\db\ActiveRecord @@ -145,6 +145,18 @@ class Video extends \yii\db\ActiveRecord
145 $result = Yii::$app->db->createCommand() 145 $result = Yii::$app->db->createCommand()
146 ->update('{{%room}}', ['living' => 1,'update_time'=>time()], ['room_id' => $room_id]) 146 ->update('{{%room}}', ['living' => 1,'update_time'=>time()], ['room_id' => $room_id])
147 ->execute(); 147 ->execute();
  148 + $cache_prefix = Yii::$app->params['cache_prefix'];
  149 + /*------------清除弹幕相关redis--------------*/
  150 + //##主播app 向弹幕服务器发送开始命令时也清除,这里也清除是为了防止弹幕服务器连不上没有清掉
  151 + //清掉在线马甲数
  152 + Yii::$app->redis->del(sprintf($cache_prefix . ":vestnum_%s", $room_id));
  153 + //清在线观看数
  154 + Yii::$app->redis->del(sprintf($cache_prefix . ":audience_nums_room_%s", $room_id));
  155 + //清点赞数
  156 + Yii::$app->redis->del(sprintf($cache_prefix . ":like_numbers_room_%s", $room_id));
  157 + //清直播状态
  158 + Yii::$app->redis->del(sprintf($cache_prefix . ":play_stat_room_%s", $room_id));
  159 + /*------------清除弹幕相关redis--------------*/
148 if (!$result) { 160 if (!$result) {
149 throw new \Exception('tbl_room update error'); 161 throw new \Exception('tbl_room update error');
150 } 162 }