Pārlūkot izejas kodu

add virtual goods

stanley-king 7 gadi atpakaļ
vecāks
revīzija
1bc1fd74c4

+ 13 - 13
data/logic/buy_virtual.logic.php

@@ -5,8 +5,8 @@
  
  */
 defined('InShopNC') or exit('Access Invalid!');
-class buy_virtualLogic {
-
+class buy_virtualLogic
+{
     /**
      * 虚拟商品购买第一步,得到购买数据(商品、店铺、会员)
      * @param int $goods_id 商品ID
@@ -36,7 +36,8 @@ class buy_virtualLogic {
      * @param int $member_id 会员ID
      * @return array
      */
-    public function getBuyStepData($goods_id, $quantity, $member_id) {
+    public function getBuyStepData($goods_id, $quantity, $member_id)
+    {
         $goods_info = Model('goods')->getVirtualGoodsOnlineInfoByID($goods_id);
         if (empty($goods_info)) {
             return callback(false, '该商品不符合购买条件,可能的原因有:下架、不存在、过期等');
@@ -108,12 +109,14 @@ class buy_virtualLogic {
             //生成订单
             $order_info = $this->_createOrder($input,$goods_info,$member_info);
 
-            if (!empty($post['password'])) {
+            if (!empty($post['password']))
+            {
                 if ($member_info['member_paypwd'] != '' && $member_info['member_paypwd'] == md5($post['password'])) {
                     //充值卡支付
                     if (!empty($post['rcb_pay'])) {
                         $order_info = $this->_rcbPay($order_info, $post, $member_info);
                     }
+
                     //预存款支付
                     if (!empty($post['pd_pay'])) {
                         $this->_pdPay($order_info, $post, $member_info);
@@ -139,7 +142,7 @@ class buy_virtualLogic {
         $param = array('order_id'=>$order_info['order_id'],'buyer_id'=>$member_id,'buyer_phone'=>$order_info['buyer_phone']);
         QueueClient::push('sendVrCode', $param);
 
-        return callback(true,'',array('order_id' => $order_info['order_id']));
+        return callback(true,'',array('order_id' => $order_info['order_id'],'order_sn' => $order_info['order_sn']));
     }
 
     /**
@@ -150,16 +153,13 @@ class buy_virtualLogic {
      * @throws Exception
      * @return array
      */
-    private function _createOrder($input, $goods_info, $member_info) {
+    private function _createOrder($input, $goods_info, $member_info)
+    {
         extract($input);
         $model_vr_order = Model('vr_order');
 
         //存储生成的订单,函数会返回该数组
-        $order_list = array();
-
-        $order = array();
-        $order_code = array();
-
+        $order = [];
         $order['order_sn'] = $this->_makeOrderSn($member_info['member_id']);
         $order['store_id'] = $goods_info['store_id'];
         $order['store_name'] = $goods_info['store_name'];
@@ -246,8 +246,8 @@ class buy_virtualLogic {
         $data_pd['amount'] = $order_amount;
         $data_pd['order_sn'] = $order_info['order_sn'];
 
-        if ($available_rcb_amount >= $order_amount) {
-    
+        if ($available_rcb_amount >= $order_amount)
+        {
             // 预存款立即支付,订单支付完成
             $model_pd->changeRcb('order_pay',$data_pd);
             $available_rcb_amount -= $order_amount;

+ 2 - 2
data/logic/payment.logic.php

@@ -175,7 +175,7 @@ class paymentLogic
      * @param int $member_id
      * @return array
      */
-    public function getVrOrderInfo($order_sn, $member_id = null)
+    public function getVrOrderInfo($order_sn, $member_id = null,$master = false)
     {
         //验证订单信息
         $model_order = Model('vr_order');
@@ -185,7 +185,7 @@ class paymentLogic
             $condition['buyer_id'] = $member_id;
         }
 
-        $order_info = $model_order->getOrderInfo($condition);
+        $order_info = $model_order->getOrderInfo($condition,'*',$master);
         if (empty($order_info)) {
             return callback(false, '该订单不存在');
         }

+ 13 - 0
helper/model/goods_summary.php

@@ -228,6 +228,19 @@ class goods_summary
         }
         $summary['goods_url'] = BASE_SITE_URL . "/mshop/goods_detail?goods_id={$summary['goods_id']}";
 
+        $is_virtual = boolval($this->goods_info['is_virtual']);
+        if($is_virtual) {
+            $summary['is_virtual'] = true;
+            $summary['virtual_indate'] = intval($this->goods_info['virtual_indate']);
+            $summary['virtual_limit'] = intval($this->goods_info['virtual_limit']);
+            $summary['virtual_invalid_refund'] = boolval($this->goods_info['virtual_limit']);
+        } else {
+            $summary['is_virtual'] = false;
+            $summary['virtual_indate'] = 0;
+            $summary['virtual_limit']  = 0;
+            $summary['virtual_invalid_refund'] = false;
+        }
+
         return $summary;
     }
 

+ 3 - 1
helper/pay/wxpay.php

@@ -22,7 +22,9 @@ use \OpenWxPayConfig;
 
 class wxpay implements IPay
 {
-    const wx_notifyurl  = BASE_SITE_URL . '/mobile/wxnotify.php';
+//    const wx_notifyurl  = BASE_SITE_URL . '/mobile/wxnotify.php';
+    const wx_notifyurl  = "http://a.lrlz.com" . '/mobile/wxnotify.php';
+    //todo 此处为零时变通
     const wx_orderquery = 'https://api.mch.weixin.qq.com/pay/orderquery';
 
     public function gen_pay($pay_sn,$fee,$order_sn,$subject)

+ 169 - 98
helper/pay_helper.php

@@ -22,30 +22,57 @@ class pay_helper
     const CMB_PAYMENT = "cmbpay";
     const PUBWX_PAYMENT = "jspay";
 
-    public function __construct() {
+    const virtual_order = 1;
+    const real_order = 2;
+
+    private $mOrderType;
+    private $logic_payment;
+    private $mPaysn;
+
+    public function __construct($paysn)
+    {
+        $this->logic_payment = Logic('payment');
+
+        $order_pay_info = Model('order')->getOrderPayInfo(array('pay_sn' => $paysn),true);
+        if (empty($order_pay_info)) {
+            $this->mOrderType = pay_helper::virtual_order;
+        } else {
+            $this->mOrderType = pay_helper::real_order;
+        }
+        $this->mPaysn = $paysn;
     }
 
     static public function pay_types()
     {
         //支付宝,微信,招商银行,各自的描述语
         $types = [];
-        $types[] = array("payment" => "wxpay","desc" => "");
-        $types[] = array("payment" => "alipay","desc" => "");
-        $types[] = array("payment" => "cmbpay","desc" => "");
+        $types[] = ["payment" => "wxpay","desc"  => ""];
+        $types[] = ["payment" => "alipay","desc" => ""];
+        $types[] = ["payment" => "cmbpay","desc" => ""];
         return $types;
     }
 
-    static public function pay_bonus($pay_sn)
+    private function pay_bonus()
     {
-        $member_info = array('member_id' => $_SESSION['member_id'], 'member_name'  => $_SESSION['member_name']);
-        $logic_payment = Logic('payment');
-        $logic_payment->payPredepositEx($pay_sn,$member_info);
+        $pay_sn = $this->mPaysn;
+        $member_info = array('member_id' => session_helper::memberid(), 'member_name'  => session_helper::nickname());
+        $this->logic_payment->payPredepositEx($pay_sn,$member_info);
     }
 
-    static public function pay($pay_sn, $payment,$usebonus,&$err)
+    public function pay($payment,$usebonus,&$err)
     {
+        if($this->mOrderType == self::real_order) {
+            return $this->real_pay($payment,$usebonus,$err);
+        } else {
+            return $this->virtual_pay($payment,$usebonus,$err);
+        }
+    }
+
+    private function real_pay($payment,$usebonus,&$err)
+    {
+        $pay_sn = $this->mPaysn;
         if($usebonus) {
-            self::pay_bonus($pay_sn);
+            $this->pay_bonus();
         }
 
         $logic_payment = Logic('payment');
@@ -72,52 +99,97 @@ class pay_helper
                         Log::record("Put order to oms error: pay_sn={$pay_sn},bonus pay.",Log::ERR);
                     }
                 }
-                $pay_helper = new pay_helper();
-                $pay_helper->OnSuccess($pay_sn);
+                $this->OnSuccess();
             }
             return $output;
         }
-        else
+        else {
+            return $this->third_pay($payment,$payinfo,$left_cents,$err);
+        }
+    }
+
+    private function virtual_pay($payment,$usebonus,&$err)
+    {
+        $order_sn = $this->mPaysn;
+
+        $logic_payment = Logic('payment');
+        $payinfo = $logic_payment->getVrOrderInfo($order_sn, $_SESSION['member_id'],true);
+
+        if(!$payinfo['state']) goto onerror;
+        if ($payinfo['data']['order_state'] != ORDER_STATE_NEW || empty($payinfo['data']['api_pay_amount'])) goto onerror;
+
+        $left_cents = intval(doubleval($payinfo['data']['api_pay_amount']) * 100 + 0.5);
+        if($left_cents == 0)
         {
-            $pay = null;
-            if($payment == "wxpay") {
-                $pay = new Pay\wxpay();
-            }
-            else if($payment == "jspay")
+            $output['need_pay'] = false;
+            $output['tips'] = "已经用红包支付完成";
+
+            $payinfo = self::update_order($order_sn, $pay_sn, 'bonus');  // 更新订单
+            if (isset($payinfo) && $payinfo['state'])
             {
-                $openid = session_helper::pub_openid();
-                Log::record("openid = {$openid}",Log::DEBUG);
-                if(empty($openid)) {
-                    $err = array('code' => errcode::ErrPayment, 'msg' => '微信未授权,不可以进行网页支付.');
-                    return false;
-                }
-                else {
-                    $pay = new Pay\jspay($openid);
+                if(is_pushoms())
+                {
+                    $logic_delivery = Logic('delivery');
+                    $ret = $logic_delivery->putOrder($pay_sn, $pay_sn);
+                    if(empty($ret)) { //todo must add to 定时任务
+                        Log::record("Put order to oms error: pay_sn={$pay_sn},bonus pay.",Log::ERR);
+                    }
                 }
+                $pay_helper = new pay_helper();
+                $pay_helper->OnSuccess($pay_sn);
             }
-            else if($payment == "alipay") {
-                $pay = new Pay\alipay();
-            }
-            else if($payment == "cmbpay") {
-                $pay = new Pay\cmbpay();
+            return $output;
+        }
+        else {
+            return $this->third_pay($payment,$payinfo,$left_cents,$err);
+        }
+
+
+        onerror:
+            $err = array('code' => errcode::ErrPayment, 'msg' => $payinfo['msg']);
+        return false;
+    }
+
+    private function third_pay($payment, $payinfo, $left_cents, &$err)
+    {
+        $pay = null;
+        if($payment == "wxpay") {
+            $pay = new Pay\wxpay();
+        }
+        else if($payment == "jspay")
+        {
+            $openid = session_helper::pub_openid();
+            Log::record("openid = {$openid}",Log::DEBUG);
+            if(empty($openid)) {
+                $err = array('code' => errcode::ErrPayment, 'msg' => '微信未授权,不可以进行网页支付.');
+                return false;
             }
             else {
-                $err = array('code' => errcode::ErrPayment, 'msg' => $payinfo['msg']);
-                return false;
+                $pay = new Pay\jspay($openid);
             }
+        }
+        else if($payment == "alipay") {
+            $pay = new Pay\alipay();
+        }
+        else if($payment == "cmbpay") {
+            $pay = new Pay\cmbpay();
+        }
+        else {
+            $err = array('code' => errcode::ErrPayment, 'msg' => $payinfo['msg']);
+            return false;
+        }
 
-            $subject = $payinfo['data']['subject'];
-            $pay_sn  = $payinfo['data']['pay_sn'];
-            $order_sn = $payinfo['data']['order_list'][0]['order_sn'];
+        $subject  = $payinfo['data']['subject'];
+        $pay_sn   = $payinfo['data']['pay_sn'];
+        $order_sn = $payinfo['data']['order_list'][0]['order_sn'];
 
-            $output['need_pay'] = true;
-            $output['tips'] = "";
+        $output['need_pay'] = true;
+        $output['tips'] = "";
 
-            $third_param = $pay->gen_pay($pay_sn,$left_cents,$order_sn,$subject);
-            $output['param'] = $third_param;
+        $third_param = $pay->gen_pay($pay_sn,$left_cents,$order_sn,$subject);
+        $output['param'] = $third_param;
 
-            return $output;
-        }
+        return $output;
     }
 
     public static function confirm($pay_sn,&$err,&$amount,&$fcode_state)
@@ -140,8 +212,9 @@ class pay_helper
         }
     }
 
-    public static function check_fee($pay_sn,$total_fee,&$need_pay)
+    public function check_fee($total_fee,&$need_pay)
     {
+        $pay_sn = $this->mPaysn;
         $logic_payment = Logic('payment');
         $result = $logic_payment->getRealOrderInfo($pay_sn,null,true);
 
@@ -155,12 +228,17 @@ class pay_helper
         return ($need_pay === $total_fee);
     }
 
-    static public function paied($pay_sn)
+    public function paied()
     {
-        $logic_payment = Logic('payment');
-        $result = $logic_payment->getRealOrderInfo($pay_sn,null,true);
-        if (intval($result['data']['api_pay_state']) != 0) {
-            return true;
+        $pay_sn = $this->mPaysn;
+        if($this->mOrderType == self::real_order)
+        {
+            $result = $this->logic_payment->getRealOrderInfo($pay_sn,null,true);
+            if (intval($result['data']['api_pay_state']) != 0) {
+                return true;
+            }
+        } else {
+
         }
 
         return false;
@@ -203,7 +281,7 @@ class pay_helper
             $pay_sn   = $result['pay_sn'];
             $trade_no = $result['trade_no'];
 
-            $cb_info = self::update_order($pay_sn,$trade_no,$payment);
+            $cb_info = $this->update_order($trade_no,$payment);
             if ($cb_info['state'] == false) {
                 Log::record("update_order fail: pay_sn={$pay_sn},trade_no={$trade_no}", Log::DEBUG);
                 return false;
@@ -215,7 +293,7 @@ class pay_helper
                     $logic_delivery->putOrder($pay_sn, $trade_no);
                     Log::record("update_order success: pay_sn={$pay_sn}", Log::DEBUG);
                 }
-                $this->OnSuccess($pay_sn);
+                $this->OnSuccess();
 
                 return true;
             }
@@ -224,73 +302,66 @@ class pay_helper
         }
     }
 
-    private function gen_payment($payment)
+    public function OnSuccess()
     {
-        if($payment == "wxpay") {
-            return new Pay\wxpay();
-        }
-        else if($payment == "jspay")
+        $pay_sn = $this->mPaysn;
+        if ($this->mOrderType == self::real_order)
         {
-            return new Pay\jspay("");
-        }
-        else if($payment == "alipay") {
-            return new Pay\alipay();
-        }
-        else if($payment == "cmbpay") {
-            return new Pay\cmbpay();
+            $logic_payment = Logic('payment');
+            $result = $logic_payment->getRealOrderInfo($pay_sn,null,true);
+
+            if($result['state'] != true) {
+                return false;
+            } else {
+                QueueClient::push('onAsyncOrderPaied',['pay_sn' => $pay_sn]);
+                return true;
+            }
         }
         else {
-            return null;
-        }
-    }
 
-    public function OnSuccess($pay_sn)
-    {
-        $logic_payment = Logic('payment');
-        $result = $logic_payment->getRealOrderInfo($pay_sn,null,true);
-
-        if($result['state'] != true) {
-            return false;
-        } else {
-            QueueClient::push('onAsyncOrderPaied',['pay_sn' => $pay_sn]);
-            return true;
         }
     }
 
-    public static function update_order($paysn, $trade_no, $payment)
+    public function update_order($trade_no, $payment)
     {
-        $logic_payment = Logic('payment');
-        $tmp = explode('|', $paysn);
-        $paysn = $tmp[0];
-        if (!empty($tmp[1])) {
-            $order_type = $tmp[1];
-        } else {
-            $order_pay_info = Model('order')->getOrderPayInfo(array('pay_sn' => $paysn),true);
-            if (empty($order_pay_info)) {
-                $order_type = 'v';
-            } else {
-                $order_type = 'r';
-            }
-        }
-
-        if ($order_type == 'r')
+        $paysn = $this->mPaysn;
+        if ($this->mOrderType == self::real_order)
         {
-            $result = $logic_payment->getRealOrderInfo($paysn,null,true);
+            $result = $this->logic_payment->getRealOrderInfo($paysn,null,true);
             if (intval($result['data']['api_pay_state'])) {
-                return array('state' => true);
+                return ['state' => true];
             }
             $order_list = $result['data']['order_list'];
-            $result = $logic_payment->updateRealOrder($paysn, $payment, $order_list, $trade_no);
+            $result = $this->logic_payment->updateRealOrder($paysn, $payment, $order_list, $trade_no);
         }
-        elseif ($order_type == 'v')
+        else
         {
-            $result = $logic_payment->getVrOrderInfo($paysn);
+            $result = $this->logic_payment->getVrOrderInfo($paysn);
             if ($result['data']['order_state'] != ORDER_STATE_NEW) {
-                return array('state' => true);
+                return ['state' => true];
             }
-            $result = $logic_payment->updateVrOrder($paysn, $payment, $result['data'], $trade_no);
+            $result = $this->logic_payment->updateVrOrder($paysn, $payment, $result['data'], $trade_no);
         }
 
         return $result;
     }
+    private function gen_payment($payment)
+    {
+        if($payment == "wxpay") {
+            return new Pay\wxpay();
+        }
+        else if($payment == "jspay")
+        {
+            return new Pay\jspay("");
+        }
+        else if($payment == "alipay") {
+            return new Pay\alipay();
+        }
+        else if($payment == "cmbpay") {
+            return new Pay\cmbpay();
+        }
+        else {
+            return null;
+        }
+    }
 }

+ 10 - 6
mobile/alipay_notify_url.php

@@ -17,6 +17,7 @@ Log::record("alipay_notify_url: pay_sn={$pay_sn} total_fee={$total_fee}", Log::D
 // 步骤一:验证数据来源正确性
 $alipayNotify = new AlipayNotify($alipay_config);
 $verify_result = $alipayNotify->verifyReturn();
+
 Log::record("verify_result={$verify_result}, pay_sn={$pay_sn},", Log::DEBUG);
 
 fcgi_header("Content-Type: text/plain; charset=UTF-8\r\n\r\n");
@@ -25,15 +26,17 @@ Log::record("ali post data:{$_SERVER['original_querystring']}",Log::DEBUG);
 
 if ($verify_result)
 {
+    $payer = new pay_helper($pay_sn);
+
     $trade_status = $_POST['trade_status'];
     if ($trade_status === 'TRADE_FINISHED' || $trade_status === 'TRADE_SUCCESS')
     {
-        if(pay_helper::paied($pay_sn)) {
+        if($payer->paied()) {
             echo('success'); //该订单已经支付
             return;
         }
 
-        $chk = pay_helper::check_fee($pay_sn,$total_fee,$need_pay);
+        $chk = $payer->check_fee($total_fee,$need_pay);
         if($chk == false) {
             Log::record("AliPay check: pay_sn={$pay_sn},total_fee={$total_fee},need_pay={$need_pay}",Log::WAIT_HANDLE);
             echo("fail");
@@ -43,7 +46,7 @@ if ($verify_result)
         {
             Log::record("AliPay check: pay_sn={$pay_sn},total_fee={$total_fee},need_pay={$need_pay}",Log::DEBUG);
             // 步骤二:更新订单状态
-            $cb_info = pay_helper::update_order($pay_sn, $trade_no, 'alipay');
+            $cb_info = $payer->update_order($trade_no, 'alipay');
             if ($cb_info['state'] == false) {
                 Log::record("update_order fail: pay_sn={$pay_sn}", Log::DEBUG);
                 echo('fail');
@@ -56,8 +59,7 @@ if ($verify_result)
                     $ret = $logic_delivery->putOrder($pay_sn, $trade_no);
                     Log::record("update_order success: pay_sn={$pay_sn}", Log::DEBUG);
                 }
-                $pay = new pay_helper();
-                $pay->OnSuccess($pay_sn);
+                $payer->OnSuccess();
 
                 echo('success');
                 return;
@@ -67,6 +69,9 @@ if ($verify_result)
     else if ($trade_status == 'WAIT_BUYER_PAY') {
 
     }
+    else {
+
+    }
     echo("success"); // 交易正确时,返回success
     return;
 }
@@ -76,5 +81,4 @@ else
     echo("fail");
     return;
 }
-
 ?>

+ 82 - 6
mobile/control/member_buy.php

@@ -67,10 +67,17 @@ class member_buyControl extends mbMemberControl
             return self::outerr(errcode::ErrParamter);
         }
 
-        $logic_buy = logic('buy');
-        $id_num = $this->pay_goods($cart_ids);
-        //得到购买数据
-        $result = $logic_buy->buyStep1($id_num, $_POST['ifcart'], $_SESSION['member_id'], $_SESSION['store_id']);
+        $virtual_goods = $this->virtual_goods($_POST,$cart_ids);
+        if($virtual_goods == false) {
+            $logic_buy = logic('buy');
+            $id_num = $this->pay_goods($cart_ids);
+            $result = $logic_buy->buyStep1($id_num, $_POST['ifcart'], session_helper::memberid(), $_SESSION['store_id']);
+        }
+        else {
+            $logic_buy = Logic('buy_virtual');
+            $result = $logic_buy->getBuyStep2Data($virtual_goods['goods_id'], $virtual_goods['num'], session_helper::memberid());
+        }
+
         if (!$result['state']) {
             return self::outerr(errcode::ErrOrder, $result['msg']);
         } else {
@@ -87,6 +94,37 @@ class member_buyControl extends mbMemberControl
         }
     }
 
+    private function virtual_goods($input,$cart_id)
+    {
+        if(boolval($input['ifcart']) == true) return false;
+
+        //存放所购商品ID和数量组成的键值对
+        $buy_items = [];
+        if (is_array($cart_id))
+        {
+            foreach ($cart_id as $value)
+            {
+                if (preg_match_all('/^(\d{1,10})\|(\d{1,6})$/', $value, $match)) {
+                    if (intval($match[2][0]) > 0) {
+                        $buy_items[$match[1][0]] = $match[2][0];
+                    }
+                }
+            }
+        }
+        if(count($buy_items) != 1) return false;
+
+        foreach ($buy_items as $key => $val) {
+            $goods_id = intval($key);
+            $num = intval($val);
+        }
+
+        $mod_goods = Model('goods');
+        $info = $mod_goods->getGoodsInfoByID($goods_id);
+        if($info['is_virtual'] != 1) return false;
+
+        return ['goods_id' => $goods_id,'num' => $num];
+    }
+
     public function step_secondOp()
     {
         $cart_ids = explode(',', urldecode($_POST['cart_id']));
@@ -125,7 +163,7 @@ class member_buyControl extends mbMemberControl
             $pay_sn = $result['data']['pay_sn'];
             $payment = $_POST['payment'];
 
-            $out_put = pay_helper::pay($pay_sn,$payment,$usebonus,$err);
+            $out_put = pay_helper::real_pay($pay_sn,$payment,$usebonus,$err);
             if($out_put == false) {
                 return self::outerr($err['code'],$err['msg']);
             } else {
@@ -136,6 +174,44 @@ class member_buyControl extends mbMemberControl
         }
     }
 
+    public function step_vsecondOp()
+    {
+        $cart_ids = explode(',', urldecode($_POST['cart_id']));
+        $virtual_goods = $this->virtual_goods($_POST,$cart_ids);
+
+        $logic_buy_virtual = Logic('buy_virtual');
+        $input = array();
+        $input['goods_id'] = $virtual_goods['goods_id'];
+        $input['quantity'] = $virtual_goods['quantity'];
+        $input['buyer_phone'] = $_POST['buyer_phone'];
+        $input['buyer_msg'] = $_POST['buyer_msg'];
+
+//        //是否使用充值卡支付0是/1否
+//        $input['rcb_pay'] = intval($_POST['rcb_pay']);
+//        //是否使用预存款支付0是/1否
+//        $input['pd_pay'] = intval($_POST['pd_pay']);
+
+        $input['order_from'] = 2;
+        $result = $logic_buy_virtual->buyStep3($input, session_helper::memberid());
+        if (!$result['state']) {
+            return self::outerr(errcode::ErrOrder, $result['msg']);
+        }
+        else {
+            $payment = $_POST['payment'];
+            $order_sn = $result['data']['order_sn'];
+
+            $out_put = pay_helper::virtual_pay($order_sn,$payment,false,$err);
+            if($out_put == false) {
+                return self::outerr($err['code'],$err['msg']);
+            } else {
+                $out_put['payment'] = $payment;
+                $out_put['pay_sn']  = $order_sn;
+                return self::outsuccess($out_put);
+            }
+        }
+    }
+
+
     public function pay_confirmOp()
     {
         $pay_sn = $_GET['pay_sn'];
@@ -277,7 +353,7 @@ class member_buyControl extends mbMemberControl
             return self::outerr(errcode::ErrParamter,"支付号或者支付类型错误");
         }
 
-        $out_put = pay_helper::pay($pay_sn,$payment,$usebonus,$err);
+        $out_put = pay_helper::real_pay($pay_sn,$payment,$usebonus,$err);
         if($out_put == false) {
             return self::outerr($err['code'],$err['msg']);
         } else {

+ 1 - 1
mobile/control/member_order.php

@@ -134,7 +134,7 @@ class member_orderControl extends mbMemberControl
             return self::outerr(errcode::ErrParamter,"支付号或者支付类型错误");
         }
 
-        $out_put = pay_helper::pay($pay_sn,$payment,false,$err);
+        $out_put = pay_helper::real_pay($pay_sn,$payment,false,$err);
         if($out_put == false) {
             return self::outerr($err['code'],$err['msg']);
         } else {

+ 1 - 0
mobile/control/member_vr_buy.php

@@ -30,6 +30,7 @@ class member_vr_buyControl extends mbMemberControl
         $_POST['goods_id'] = $_POST['cart_id'];
         $logic_buy_virtual = Logic('buy_virtual');
         $result = $logic_buy_virtual->getBuyStep2Data($_POST['goods_id'], $_POST['quantity'], $this->member_info['member_id']);
+
         if (!$result['state']) {
             output_error($result['msg']);
         } else {

+ 5 - 0
test/TestFuncargs.php

@@ -12,6 +12,11 @@ class TestFuncargs extends PHPUnit_Framework_TestCase
     {
         foo("1",2,3);
         $sum = add(1,3,4);
+
+//        array_map(function ($val,$key) use(&$goods_id,&$num) {
+//            $goods_id = $key;
+//            $num = $val;
+//        },$buy_items);
     }
 }