Index.php 1015 Bytes
<?php

use Action\WebAction;
use Shopping\PaymentModel;
use WebPlugin\Helpers;

/**
 * 支付
 */
class IndexController extends WebAction
{
    public function indexAction()
    {
        /* 判断用户是否登录 */
        $uid = $this->getUid(true);
        if (!$uid) {
            $this->go( Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))) );
        }

        $orderCode = $this->get('order_code', $this->get('ordercode'));
        $paymentType = $this->get('payment_type');
        $alipayToken = $this->getSession('alipay_user_token');
        $data = PaymentModel::getPayData($uid, $orderCode, $paymentType, $this->_uname, $alipayToken);
        if (isset($data['error'])) {
            $this->helpJsRedirect($data['message']);
        }

        // GET方式直接跳转到支付界面
        if (isset($data['go'])) {
            $this->go($data['payUrl']);
        }

        $this->_view->display('index', $data);
    }
}