Commit 7c5368750a280e87b6066abbb7aaed34c422185b
1 parent
d16e87bd
Sms send
Showing
1 changed file
with
23 additions
and
4 deletions
Show diff stats
controllers/OrderController.php
| ... | ... | @@ -237,7 +237,12 @@ |
| 237 | 237 | $model->published = false; |
| 238 | 238 | $model->save(); |
| 239 | 239 | |
| 240 | - return $this->redirect(['update', 'id' => $model->id]); | |
| 240 | + return $this->redirect( | |
| 241 | + [ | |
| 242 | + 'update', | |
| 243 | + 'id' => $model->id, | |
| 244 | + ] | |
| 245 | + ); | |
| 241 | 246 | |
| 242 | 247 | $dataProvider = new ActiveDataProvider( |
| 243 | 248 | [ |
| ... | ... | @@ -353,7 +358,7 @@ |
| 353 | 358 | } |
| 354 | 359 | } |
| 355 | 360 | |
| 356 | - public function actionFindProduct($q = NULL, $id = NULL) | |
| 361 | + public function actionFindProduct($q = null, $id = null) | |
| 357 | 362 | { |
| 358 | 363 | \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
| 359 | 364 | $out = [ |
| ... | ... | @@ -409,7 +414,7 @@ |
| 409 | 414 | |
| 410 | 415 | protected function findModel($id) |
| 411 | 416 | { |
| 412 | - if (( $model = Order::findOne($id) ) !== NULL) { | |
| 417 | + if (( $model = Order::findOne($id) ) !== null) { | |
| 413 | 418 | return $model; |
| 414 | 419 | } else { |
| 415 | 420 | throw new NotFoundHttpException('The requested page does not exist.'); |
| ... | ... | @@ -472,9 +477,23 @@ |
| 472 | 477 | $model->save(); |
| 473 | 478 | } |
| 474 | 479 | |
| 475 | - public function actionPublishOrder($id) { | |
| 480 | + public function actionPublishOrder($id) | |
| 481 | + { | |
| 476 | 482 | $model = Order::findOne($id); |
| 477 | 483 | $model->published = true; |
| 478 | 484 | $model->save(); |
| 485 | + /** | |
| 486 | + * @var SmsSender $sender | |
| 487 | + */ | |
| 488 | + $sender = \Yii::$app->sender; | |
| 489 | + $sender->send( | |
| 490 | + $model->phone, | |
| 491 | + $this->renderPartial( | |
| 492 | + '@common/mail/smsorder', | |
| 493 | + [ | |
| 494 | + 'order_id' => $model->id, | |
| 495 | + ] | |
| 496 | + ) | |
| 497 | + ); | |
| 479 | 498 | } |
| 480 | 499 | } | ... | ... |