<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                為了方便我們所有的邏輯您都按照我下面的走,然后就會都走余額的控制,這樣在一個地方寫就可以了,然后如果不懂的可以加我微信或手機咨詢17854945210 >自提不會走一下邏輯 [TOC] ## 小程序訂單微信支付邏輯 ``/ewei_shopv2/payment/wechat/notify.php`` ``` /** * 小程序 訂單支付 */ public function wxapp_order() { $tid = $this->get['out_trade_no']; $transaction_id = $this->get['transaction_id']; if (strexists($tid, 'GJ')) { $tids = explode('GJ', $tid); $tid = $tids[0]; } $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `module`=:module AND `tid`=:tid limit 1'; $params = array(); $params[':tid'] = $tid; $params[':module'] = 'ewei_shopv2'; $log = pdo_fetch($sql, $params); if (!empty($log) && $log['status'] == '0' && $log['fee'] == $this->total_fee) { $site = WeUtility::createModuleSite($log['module']); if (!is_error($site)) { $method = 'payResult'; if (method_exists($site, $method)) { $ret = array(); $ret['acid'] = $log['acid']; $ret['uniacid'] = $log['uniacid']; $ret['result'] = 'success'; $ret['type'] = $log['type']; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; $ret['tag'] = $log['tag']; pdo_update('ewei_shop_order', array('paytype' => 21, 'apppay' => 2, 'transid' => $transaction_id), array('ordersn' => $log['tid'], 'uniacid' => $log['uniacid'])); $result = $site->{$method}($ret); if ($result) { //----------------------------------------------------------------------------------------訂單成功邏輯 // $log['tag'] = iunserializer($log['tag']); $log['tag']['transaction_id'] = $this->get['transaction_id']; $record = array(); $record['status'] = '1'; $record['tag'] = iserializer($log['tag']); pdo_update('core_paylog', $record, array('plid' => $log['plid'])); } } } } else { $this->fail(); } } ``` ## 余額支付成功走的控制器 路徑 ``/addons/ewei_shopv2/core/model/order.php`` ``` public function payResult($params) ``` ## 支付寶支付成功走的邏輯 /addons/ewei_shopv2/payment/alipay/notify.php 在這個位置,然后走payResult的余額邏輯,所有邏輯寫在payResult即可 ``` ![](https://img.kancloud.cn/d4/da/d4dacd379001929818b8af832bf81656_773x308.png) /** * 訂單支付 */ public function order() { if (!$this->publicMethod()) { exit('order'); } $tid = $this->post['out_trade_no']; if (strexists($tid, 'GJ')) { $tids = explode('GJ', $tid); $tid = $tids[0]; } $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `tid`=:tid and `module`=:module limit 1'; $params = array(); $params[':tid'] = $tid; $params[':module'] = 'ewei_shopv2'; $log = pdo_fetch($sql, $params); if (!$this->isapp && $this->post['sign_type'] == 'RSA') { if ($this->post['total_amount'] != $log['fee']) { exit('fail'); } } else { $total_fee = $this->post['total_fee']; if (empty($total_fee)) { $total_fee = $this->post['total_amount']; } if ($total_fee != $log['fee']) { exit('fail'); } } if (!empty($log) && $log['status'] == '0') { $site = WeUtility::createModuleSite($log['module']); if (!is_error($site)) { $method = 'payResult'; if (method_exists($site, $method)) { $ret = array(); $ret['acid'] = $log['acid']; $ret['uniacid'] = $log['uniacid']; $ret['result'] = 'success'; $ret['type'] = 'alipay'; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; $ret['is_usecard'] = $log['is_usecard']; $ret['card_type'] = $log['card_type']; $ret['card_fee'] = $log['card_fee']; $ret['card_id'] = $log['card_id']; pdo_update('ewei_shop_order', array('paytype' => 22), array('uniacid' => $log['uniacid'], 'ordersn' => $log['tid'])); $result = $site->{$method}($ret); if ($result) { $log['tag'] = iunserializer($log['tag']); $log['tag']['transid'] = $this->post['trade_no']; $record = array(); $record['status'] = '1'; $record['type'] = 'alipay'; $record['tag'] = iserializer($log['tag']); --------------------------------------------------------- 把這行代碼加進去 //這里寫邏輯 $pay_result = m('order')->payResult($ret); --------------------------------------------------------------- pdo_update('core_paylog', $record, array('plid' => $log['plid'])); pdo_update('ewei_shop_order', array('paytype' => 22, 'apppay' => $this->isapp ? 1 : 0, 'transid' => $this->post['trade_no']), array('ordersn' => $log['tid'], 'uniacid' => $log['uniacid'])); exit('success'); } } } } } ``` ## 微信支付成功后走的邏輯 700來行 /www/wwwroot/www.doujiao.su/addons/ewei_shopv2/core/mobile/order/pay.php ``` if ($go_flag == 1) { $pay_result = true; ----------------------------------------------- 把這行代碼加進去 $log = pdo_fetch('SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid limit 1', array(':uniacid' => $uniacid, ':module' => 'ewei_shopv2', ':tid' => $order['ordersn'])); $ret = array(); $ret['result'] = 'success'; $ret['type'] = 'wechat'; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $order['openid']; $ret['fee'] = $order['price']; $ret['weid'] = $_W['uniacid']; $ret['uniacid'] = $_W['uniacid']; $pay_result = m('order')->payResult($ret); ------------------------------------------------------------------------- if ($_W['ispost']) { $_SESSION[EWEI_SHOPV2_PREFIX . '_order_pay_complete'] = 1; show_json(1, array('result' => $pay_result)); } else { header('location:' . mobileUrl('order/pay/success', array('id' => $order['id'], 'result' => $pay_result))); exit(); } } ``` ## APP微信支付成功后走的邏輯 **ewei_shopv2/core/mobile/account/app_pay.php** orderstatus方法里,最后幾行,47行左右 ``` else { //$orderid = intval($_GPC["globe_orderid_"]); //$app_paytype= intval($_GPC["app_paytype"]); $ordersn = $_GPC["ordersn"]; $tradeno = $_GPC["tradeno"]; $log = pdo_fetch('SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid limit 1', array(':uniacid' => $uniacid, ':module' => 'ewei_shopv2', ':tid' => $order['ordersn'])); $ret = array(); $ret['result'] = 'success'; $ret['type'] = 'wechat'; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $order['openid']; $ret['fee'] = $order['price']; $ret['weid'] = $_W['uniacid']; $ret['uniacid'] = $_W['uniacid']; $pay_result = m('order')->payResult($ret); $result=pdo_update("ewei_shop_order", array( "status" =>1,"paytime"=>time(),"paytype" =>$paytype ), array( "ordersn" => $ordersn, "uniacid" => $_W["uniacid"] )); echo json_encode($result) ; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看