...
|
...
|
@@ -171,8 +171,17 @@ class LiveController extends BaseController |
|
|
$model = new Master();
|
|
|
|
|
|
if ($posts = Yii::$app->request->post()) {
|
|
|
$model->name = $posts['name'];
|
|
|
$model->meta = $posts['meta'];
|
|
|
if(empty($posts['pic']) || empty($posts['name'])){
|
|
|
Yii::$app->session->setFlash('warning', '昵称或头像不能为空');
|
|
|
return $this->redirect('/live/addmaster');
|
|
|
}
|
|
|
$master = Master::findOne(['name'=>$posts['name']]);
|
|
|
if(!empty($master)){
|
|
|
Yii::$app->session->setFlash('warning', '主播名称已存在');
|
|
|
return $this->redirect('/live/addmaster');
|
|
|
}
|
|
|
$model->name = trim($posts['name']);
|
|
|
$model->meta = trim($posts['meta']);
|
|
|
$model->pic = $posts['pic'];
|
|
|
$model->create_time = $model->update_time = time();
|
|
|
if($model->save()){
|
...
|
...
|
|