Showing
1 changed file
with
3 additions
and
3 deletions
@@ -157,14 +157,13 @@ class LiveController extends BaseController | @@ -157,14 +157,13 @@ class LiveController extends BaseController | ||
157 | $post = Yii::$app->getRequest()->post(); | 157 | $post = Yii::$app->getRequest()->post(); |
158 | $post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']); | 158 | $post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']); |
159 | $model->setAttributes($post); | 159 | $model->setAttributes($post); |
160 | - $model->save(); | ||
161 | if ($model->save()){ | 160 | if ($model->save()){ |
162 | Yii::$app->session->setFlash('success', '创建成功。'); | 161 | Yii::$app->session->setFlash('success', '创建成功。'); |
163 | }else{ | 162 | }else{ |
164 | Yii::$app->session->setFlash('error', '创建失败。'); | 163 | Yii::$app->session->setFlash('error', '创建失败。'); |
165 | } | 164 | } |
166 | 165 | ||
167 | - $this->redirect('/live/room'); | 166 | + return $this->redirect('/live/room'); |
168 | } | 167 | } |
169 | 168 | ||
170 | return $this->render('roomedit',[ | 169 | return $this->render('roomedit',[ |
@@ -189,13 +188,14 @@ class LiveController extends BaseController | @@ -189,13 +188,14 @@ class LiveController extends BaseController | ||
189 | $post = Yii::$app->getRequest()->post(); | 188 | $post = Yii::$app->getRequest()->post(); |
190 | $post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']); | 189 | $post['starting_time'] = !$post['starting_time'] ? : strtotime($post['starting_time']); |
191 | $model->setAttributes($post); | 190 | $model->setAttributes($post); |
191 | + Yii::$app->session->setFlash('success', '编辑成功。'); | ||
192 | if ($model->save()){ | 192 | if ($model->save()){ |
193 | Yii::$app->session->setFlash('success', '编辑成功。'); | 193 | Yii::$app->session->setFlash('success', '编辑成功。'); |
194 | }else{ | 194 | }else{ |
195 | Yii::$app->session->setFlash('error', '编辑失败。'); | 195 | Yii::$app->session->setFlash('error', '编辑失败。'); |
196 | } | 196 | } |
197 | 197 | ||
198 | - $this->redirect('/live/room'); | 198 | + return $this->redirect('/live/room'); |
199 | } | 199 | } |
200 | 200 | ||
201 | return $this->render('roomedit',[ | 201 | return $this->render('roomedit',[ |
-
Please register or login to post a comment