/** * Get order id from the alipay return. * * @param string $mode return|notify * @access public * @return object */ public function getOrderFromAlipay($mode = 'return') { $this->app->loadClass('alipay', true); $alipay = new alipay($this->config->alipay); $orderID = 0; if ($mode == 'return') { if (1 or $alipay->checkNotify($_GET) and $this->get->trade_status == 'TRADE_FINISHED' || $this->get->trade_status == 'TRADE_SUCCESS') { $orderID = $this->get->out_trade_no; $sn = $this->get->trade_no; } } elseif ($mode == 'notify') { if ($alipay->checkNotify($_POST) and $this->post->trade_status == 'TRADE_FINISHED' || $this->post->trade_status == 'TRADE_SUCCESS') { $orderID = $this->post->out_trade_no; $sn = $this->post->trade_no; } } if ($orderID) { $orderID = $this->getRawOrder($orderID); } $order = $this->getByID($orderID); $order->sn = $sn; return $order; }