예제 #1
0
 public function actionFrontNotify()
 {
     $channel = $this->sGet('channel');
     unset($_GET['channel']);
     switch ($channel) {
         case 'nowPay':
             $orderId = $this->sGet('mhtOrderNo');
             break;
         default:
             $orderId = $this->sGet('out_trade_no');
             break;
     }
     $model = Pay::getPayByOrderId($orderId);
     if ($model === null) {
         throw new CHttpException(404, 'Not Found');
     }
     Yii::log(json_encode($_GET), 'pay', 'notify.front');
     $result = $model->validateNotify($channel, $_GET);
     if ($result) {
         switch ($model->type) {
             case Pay::TYPE_REGISTRATION:
                 Yii::app()->user->setFlash('success', Yii::t('common', 'Paid successfully'));
                 $competition = $model->competition;
                 $this->redirect($competition->getUrl('competitors'));
                 break;
         }
     }
     $this->render('result', array('model' => $model, 'result' => $result));
 }