コード例 #1
0
 public function actionNotify()
 {
     $channel = $this->sGet('channel');
     unset($_GET['channel']);
     switch ($channel) {
         case 'nowPay':
             $paramsStr = file_get_contents('php://input');
             parse_str($paramsStr, $params);
             $orderId = isset($params['mhtOrderNo']) ? $params['mhtOrderNo'] : '';
             break;
         default:
             $orderId = $this->sPost('out_trade_no');
             $params = $_POST;
             break;
     }
     $model = Pay::getPayByOrderId($orderId);
     if ($model === null) {
         echo Pay::notifyReturn($channel, false);
         exit;
     }
     Yii::log(json_encode($params), 'pay', 'notify');
     $result = $model->validateNotify($channel, $params);
     if ($result) {
         echo Pay::notifyReturn($channel, true);
     } else {
         echo Pay::notifyReturn($channel, false);
     }
 }