public function actionAlipayReturn() { //ali验证不允许有多余参数 if (isset($_GET['r'])) { unset($_GET['r']); } $out_trade_no = $_GET['out_trade_no']; $trade_no = $_GET['trade_no']; $trade_status = $_GET['trade_status']; global $sysSettings; $alipay = new Alipay($sysSettings['payment']['aliPartner'], $sysSettings['payment']['aliKey']); if ($alipay->verifyReturn()) { $order = Order::model()->findByPk($out_trade_no); $course = Course::model()->findByAttributes(array('entityId' => $order->produceEntityId)); // modified by wzh if ($order->status == Order::ORDER_PAID) { Yii::app()->user->setFlash('success', '购买成功!你已经成功选上课程'); } $this->redirect(array('view', 'id' => $course->id)); } else { throw new CHttpException(404, '验证错误!'); } }