Authored by wuxiao

Merge branch 'test' of http://git.yoho.cn/web/yoho-live into test

@@ -57,7 +57,6 @@ class ForbiddenController extends BaseController @@ -57,7 +57,6 @@ class ForbiddenController extends BaseController
57 die('缺少room_id'); 57 die('缺少room_id');
58 } 58 }
59 59
60 -  
61 } 60 }
62 61
63 /** 62 /**
@@ -121,8 +120,8 @@ class ForbiddenController extends BaseController @@ -121,8 +120,8 @@ class ForbiddenController extends BaseController
121 $gets = Yii::$app->request->get(); 120 $gets = Yii::$app->request->get();
122 $room_id = $gets['room_id']; 121 $room_id = $gets['room_id'];
123 if($room_id) { 122 if($room_id) {
124 - $sqlwhere = ['cmd' => 5];  
125 - 123 + //$sqlwhere = ['cmd' => 5];
  124 + $sqlwhere = [];
126 $count = (new \yii\db\Query()) 125 $count = (new \yii\db\Query())
127 ->from($this->getTableName($room_id)) 126 ->from($this->getTableName($room_id))
128 ->where($sqlwhere) 127 ->where($sqlwhere)
@@ -171,8 +171,17 @@ class LiveController extends BaseController @@ -171,8 +171,17 @@ class LiveController extends BaseController
171 $model = new Master(); 171 $model = new Master();
172 172
173 if ($posts = Yii::$app->request->post()) { 173 if ($posts = Yii::$app->request->post()) {
174 - $model->name = $posts['name'];  
175 - $model->meta = $posts['meta']; 174 + if(empty($posts['pic']) || empty($posts['name'])){
  175 + Yii::$app->session->setFlash('warning', '昵称或头像不能为空');
  176 + return $this->redirect('/live/addmaster');
  177 + }
  178 + $master = Master::findOne(['name'=>$posts['name']]);
  179 + if(!empty($master)){
  180 + Yii::$app->session->setFlash('warning', '主播名称已存在');
  181 + return $this->redirect('/live/addmaster');
  182 + }
  183 + $model->name = trim($posts['name']);
  184 + $model->meta = trim($posts['meta']);
176 $model->pic = $posts['pic']; 185 $model->pic = $posts['pic'];
177 $model->create_time = $model->update_time = time(); 186 $model->create_time = $model->update_time = time();
178 if($model->save()){ 187 if($model->save()){
@@ -20,7 +20,15 @@ use backend\widgets\LinkPager; @@ -20,7 +20,15 @@ use backend\widgets\LinkPager;
20 <?php foreach($list as $v):?> 20 <?php foreach($list as $v):?>
21 <tr> 21 <tr>
22 <td><?php echo $v['name']."(".$v['uid'].")"?></td> 22 <td><?php echo $v['name']."(".$v['uid'].")"?></td>
23 - <td><?php echo $v['comment']?></td> 23 + <td>
  24 + <?php
  25 + if($v['cmd']==5){
  26 + echo $v['comment'];
  27 + }elseif($v['cmd']==4){
  28 + echo '@'.$v['name'].'加入了房间';
  29 + }
  30 + ?>
  31 + </td>
24 <td><?php echo date('Y-m-i H:i:s',$v['create_time'])?></td> 32 <td><?php echo date('Y-m-i H:i:s',$v['create_time'])?></td>
25 <td><button class="btn btn-danger jinyan" uid="<?php echo $v['uid']?>" name="<?php echo $v['name']?>" room_id="<?php echo $v['room_id']?>">禁言</button></td> 33 <td><button class="btn btn-danger jinyan" uid="<?php echo $v['uid']?>" name="<?php echo $v['name']?>" room_id="<?php echo $v['room_id']?>">禁言</button></td>
26 </tr> 34 </tr>