當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UnifiedOrder_pub::getResult方法代碼示例

本文整理匯總了PHP中UnifiedOrder_pub::getResult方法的典型用法代碼示例。如果您正苦於以下問題:PHP UnifiedOrder_pub::getResult方法的具體用法?PHP UnifiedOrder_pub::getResult怎麽用?PHP UnifiedOrder_pub::getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnifiedOrder_pub的用法示例。


在下文中一共展示了UnifiedOrder_pub::getResult方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildRequest

 public function buildRequest($req)
 {
     //使用統一支付接口
     $unifiedOrder = new UnifiedOrder_pub($this->wxConfig);
     $unifiedOrder->setParameter("body", $req['body']);
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", $req['order_sn']);
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", $req['order_paied'] * 100);
     //總金額
     $unifiedOrder->setParameter("notify_url", $this->wxConfig['NOTIFY_URL']);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //echo "通信出錯:".$unifiedOrderResult['return_msg']."<br>";
         return 0;
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //echo "錯誤代碼:".$unifiedOrderResult['err_code']."<br>";
         //echo "錯誤代碼描述:".$unifiedOrderResult['err_code_des']."<br>";
         return 0;
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         return $code_url;
     }
 }
開發者ID:nicklos17,項目名稱:littlemall,代碼行數:29,代碼來源:WechatClass.php

示例2: config_jsdz

 private function config_jsdz()
 {
     $config = $this->config;
     $unifiedOrder = new UnifiedOrder_pub();
     //設置統一支付接口參數
     //設置必填參數
     //appid已填,商戶無需重複填寫
     //mch_id已填,商戶無需重複填寫
     //noncestr已填,商戶無需重複填寫
     //spbill_create_ip已填,商戶無需重複填寫
     //sign已填,商戶無需重複填寫
     $unifiedOrder->setParameter("body", "雲購商品");
     //商品描述
     //自定義訂單號,此處僅作舉例
     $total_fee = $config['money'] * 100;
     $out_trade_no = $config['code'];
     //$total_fee=1;
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", $total_fee);
     //總金額
     $unifiedOrder->setParameter("notify_url", WxPayConf_pub::$NOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //非必填參數,商戶可根據實際情況選填
     //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商戶號
     //$unifiedOrder->setParameter("device_info","XXXX");//設備號
     //$unifiedOrder->setParameter("attach","XXXX");//附加數據
     //$unifiedOrder->setParameter("time_start","XXXX");//交易起始時間
     //$unifiedOrder->setParameter("time_expire","XXXX");//交易結束時間
     //$unifiedOrder->setParameter("goods_tag","XXXX");//商品標記
     //$unifiedOrder->setParameter("openid","XXXX");//用戶標識
     //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //print_r($unifiedOrderResult);
     //exit;
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
         echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         $this->url = $code_url;
         //echo 'xx';
         //header("location:".$code_url);
         //echo $code_url;
         // print_r($config);
         // print_r($unifiedOrderResult);exit;
         include 'native_dynamic_qrcode.php';
         //商戶自行增加處理流程
         //......
     }
 }
開發者ID:think-css,項目名稱:yungou,代碼行數:60,代碼來源:wxpay.class.php

示例3: strval

 function get_code($order, $payment)
 {
     $unifiedOrder = new UnifiedOrder_pub();
     $unifiedOrder->setParameter("body", $order['order_sn']);
     //商品描述
     $out_trade_no = $order['order_sn'];
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("attach", strval($order['log_id']));
     //商戶支付日誌
     $unifiedOrder->setParameter("total_fee", strval(intval($order['order_amount'] * 100)));
     //總金額
     $unifiedOrder->setParameter("notify_url", WXNOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     $unifiedOrderResult = $unifiedOrder->getResult();
     $html = '<button type="button" onclick="javascript:alert(\'出錯了\')">微信支付</button>';
     if ($unifiedOrderResult["code_url"] != NULL) {
         $code_url = $unifiedOrderResult["code_url"];
         $html = '<div class="wx_title">';
         $html .= '<span id="wxlogo"><img src="/themes/main/images/weixin/WePayLogo.jpg" width="148" height="40"/></span>';
         $html .= '<span id="tj"><img src="/themes/main/images/weixin/We_tj.jpg" width="47" height="20"/></span>';
         $html .= '<span id="desc">億萬用戶的選擇,更快更安全</span>';
         $html .= '<span id="price">支付:<font style="color:#ff6600">' . $order['order_amount'] . '</font> 元</span>';
         $html .= '</div>';
         $html .= '<div class="wx_qrcode" style="text-align:center">';
         $html .= $this->getcode($code_url);
         $html .= "</div>";
         $html .= "<div style=\"text-align:center\"><img src=\"/themes/main/images/weixin/wxfont.png\" width=\"186\" height=\"62\"></div>";
     }
     return $html;
 }
開發者ID:styleyoung,項目名稱:taoshop,代碼行數:33,代碼來源:wx_new_qrcode.php

示例4: strval

 function get_code($order, $payment)
 {
     $unifiedOrder = new UnifiedOrder_pub();
     $unifiedOrder->setParameter("body", $order['order_sn']);
     //商品描述
     $out_trade_no = $order['order_sn'];
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("attach", strval($order['log_id']));
     //商戶支付日誌
     $unifiedOrder->setParameter("total_fee", strval(intval($order['order_amount'] * 100)));
     //總金額
     $unifiedOrder->setParameter("notify_url", WXNOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     $unifiedOrderResult = $unifiedOrder->getResult();
     $html = '<button type="button" onclick="javascript:alert(\'出錯了\')">微信支付</button>';
     if ($unifiedOrderResult["code_url"] != NULL) {
         $code_url = $unifiedOrderResult["code_url"];
         $html = '<div class="wx_qrcode" style="text-align:center">';
         $html .= $this->getcode($code_url);
         $html .= "</div>";
         $html .= "<div style=\"text-align:center\">支付後點擊<a href=\"user.php?act=order_list\">此處</a>查看我的訂單</div>";
     }
     return $html;
 }
開發者ID:seanguo166,項目名稱:microdistribution,代碼行數:27,代碼來源:wx_new_qrcode.php

示例5: getPayUrlForQRCode

function getPayUrlForQRCode($paras = array())
{
    //使用統一支付接口
    $unifiedOrder = new UnifiedOrder_pub();
    //設置統一支付接口參數
    //設置必填參數
    //appid已填,商戶無需重複填寫
    //mch_id已填,商戶無需重複填寫
    //noncestr已填,商戶無需重複填寫
    //spbill_create_ip已填,商戶無需重複填寫
    //sign已填,商戶無需重複填寫
    $unifiedOrder->setParameter("openid", $paras['openid']);
    //用戶標識
    $unifiedOrder->setParameter("body", $paras['p_title']);
    //商品描述
    //自定義訂單號,此處僅作舉例
    $timeStamp = time();
    $unifiedOrder->setParameter("out_trade_no", $paras['out_trade_no'] . rand(1, 10));
    //商戶訂單號
    $unifiedOrder->setParameter("total_fee", $paras['p_fee']);
    //總金額
    $unifiedOrder->setParameter("notify_url", WxPayConf_pub::NOTIFY_URL);
    //通知地址
    $unifiedOrder->setParameter("trade_type", "NATIVE");
    //交易類型
    $unifiedOrder->setParameter("attach", $paras['attach']);
    //附加數據
    //支付交易5分鍾後關閉
    $time_expire = date('YmdHis', time() + 300);
    $unifiedOrder->setParameter("time_expire", "{$time_expire}");
    //交易結束時間
    //非必填參數,商戶可根據實際情況選填
    //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商戶號
    //$unifiedOrder->setParameter("device_info","XXXX");//設備號
    //$unifiedOrder->setParameter("attach","XXXX");//附加數據
    //$unifiedOrder->setParameter("time_start","XXXX");//交易起始時間
    //$unifiedOrder->setParameter("time_expire","XXXX");//交易結束時間
    //$unifiedOrder->setParameter("goods_tag","XXXX");//商品標記
    //$unifiedOrder->setParameter("openid","XXXX");//用戶標識
    //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
    //獲取統一支付接口結果
    $unifiedOrderResult = $unifiedOrder->getResult();
    $code_url = '';
    //商戶根據實際情況設置相應的處理流程
    if ($unifiedOrderResult["return_code"] == "FAIL") {
        //商戶自行增加處理流程
        //echo "通信出錯:".$unifiedOrderResult['return_msg']."<br>";
    } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
        //商戶自行增加處理流程
        //echo "錯誤代碼:".$unifiedOrderResult['err_code']."<br>";
        //echo "錯誤代碼描述:".$unifiedOrderResult['err_code_des']."<br>";
    } elseif ($unifiedOrderResult["code_url"] != NULL) {
        //從統一支付接口獲取到code_url
        $code_url = $unifiedOrderResult["code_url"];
        //商戶自行增加處理流程
        //......
    }
    return $code_url;
}
開發者ID:xingcuntian,項目名稱:weikanjia,代碼行數:59,代碼來源:qrcode_maker.php

示例6: createQrcode

 public function createQrcode()
 {
     $pkey = base64_decode(I("pkey"));
     $pkeys = explode("@", $pkey);
     if (count($pkeys) != 2) {
         $this->assign('out_trade_no', "");
     } else {
         $morders = D('Home/Orders');
         $obj["orderIds"] = $pkeys[1];
         $data = $morders->getPayOrders($obj);
         $orders = $data["orders"];
         $needPay = $data["needPay"];
         $this->assign("orderIds", $orderIds);
         $this->assign("orders", $orders);
         $this->assign("needPay", $needPay);
         $this->assign("orderCnt", count($orders));
         // 使用統一支付接口
         $unifiedOrder = new \UnifiedOrder_pub();
         $unifiedOrder->setParameter("body", "支付訂單費用");
         // 商品描述
         // 自定義訂單號,此處僅作舉例
         $timeStamp = time();
         $out_trade_no = "{$timeStamp}";
         // $out_trade_no = "1000001|1000002";
         $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
         // 商戶訂單號
         $unifiedOrder->setParameter("total_fee", $needPay * 100);
         // 總金額
         $unifiedOrder->setParameter("notify_url", C('WxPayConf_pub.NOTIFY_URL'));
         // 通知地址
         $unifiedOrder->setParameter("trade_type", "NATIVE");
         // 交易類型
         $unifiedOrder->setParameter("attach", "{$pkey}");
         // 附加數據
         // $unifiedOrder->setParameter ( "detail", "Ipad mini" );//附加數據
         $unifiedOrder->SetParameter("input_charset", "UTF-8");
         // 獲取統一支付接口結果
         $unifiedOrderResult = $unifiedOrder->getResult();
         // 商戶根據實際情況設置相應的處理流程
         if ($unifiedOrderResult["return_code"] == "FAIL") {
             // 商戶自行增加處理流程
             echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
         } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
             // 商戶自行增加處理流程
             echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
             echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
         } elseif ($unifiedOrderResult["code_url"] != NULL) {
             // 從統一支付接口獲取到code_url
             $code_url = $unifiedOrderResult["code_url"];
             // 商戶自行增加處理流程
         }
         $this->assign('out_trade_no', $obj["orderIds"]);
         $this->assign('code_url', $code_url);
         $this->assign('unifiedOrderResult', $unifiedOrderResult);
     }
     $this->display("default/payment/wxnative2/qrcode");
 }
開發者ID:moonlight-wang,項目名稱:flmall,代碼行數:57,代碼來源:WxNative2Action.class.php

示例7: wxqr_create

 public function wxqr_create()
 {
     $body = Req::post('body');
     $out_trade_no = Req::post('out_trade_no');
     $total_fee = Req::post('total_fee');
     $notify_url = Req::post('notify_url');
     $trade_type = Req::post('trade_type');
     $appid = Req::post('appid');
     $mch_id = Req::post('mch_id');
     $spbill_create_ip = Req::post('spbill_create_ip');
     $nonce_str = Req::post('nonce_str');
     $sign = Req::post('sign');
     $unifiedOrder = new UnifiedOrder_pub();
     $unifiedOrder->setParameter("body", "{$body}");
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", "{$total_fee}");
     //總金額
     $unifiedOrder->setParameter("notify_url", "{$notify_url}");
     //通知地址
     $unifiedOrder->setParameter("trade_type", "{$trade_type}");
     //交易類型
     $unifiedOrder->setParameter("appid", "{$appid}");
     //公眾賬號ID
     $unifiedOrder->setParameter("mch_id", "{$mch_id}");
     //商戶號
     $unifiedOrder->setParameter("spbill_create_ip", "{$spbill_create_ip}");
     //終端ip
     $unifiedOrder->setParameter("nonce_str", "{$nonce_str}");
     //隨機字符串
     $unifiedOrder->setParameter("sign", "{$sign}");
     //簽名
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         $msg = array('type' => 'fail', 'msg' => '通信出錯:' . $unifiedOrderResult['return_msg']);
         $this->redirect('/index/msg', false, $msg);
         exit;
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         $msg = array('type' => 'fail', 'msg' => $unifiedOrderResult['err_code'] . ':' . $unifiedOrderResult['err_code_des']);
         $this->redirect('/index/msg', false, $msg);
         exit;
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         $this->assign("code_url", $code_url);
         $this->assign("out_trade_no", $out_trade_no);
         $this->redirect('wxqr_page', false);
         //商戶自行增加處理流程
         //......
     }
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:55,代碼來源:payment.php

示例8: define

 function get_payform($order_info)
 {
     if (!defined('WXAPPID')) {
         $_SESSION['order_info'] = $order_info;
         define("WXAPPID", $this->_config['appid']);
         define("WXMCHID", $this->_config['mchid']);
         define("WXKEY", $this->_config['key']);
         define("WXAPPSECRET", $this->_config['appsecret']);
         define("WXCURL_TIMEOUT", 30);
         define('WXNOTIFY_URL', $this->_create_notify_url($order_info["order_id"], $order_info['payment_code']));
         define('WXJS_API_CALL_URL', $this->_create_notify_url($order_info["order_id"], $order_info['payment_code']));
         define('WXSSLCERT_PATH', ROOT_PATH . '/data/cacert/1/apiclient_cert.pem');
         define('WXSSLKEY_PATH', ROOT_PATH . '/data/cacert/1/apiclient_key.pem');
     }
     require_once dirname(__FILE__) . "/WxPayPubHelper/WxPayPubHelper.php";
     $unifiedOrder = new UnifiedOrder_pub();
     $out_trade_no = $this->_get_trade_sn($order_info);
     $_SESSION['out_trade_on'] = $out_trade_no;
     $unifiedOrder->setParameter("body", $out_trade_no);
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("attach", $order_info['order_id']);
     //商戶支付日誌
     $unifiedOrder->setParameter("total_fee", strval(intval($order_info['order_amount'] * 100)));
     //總金額
     $unifiedOrder->setParameter("notify_url", WXNOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     $unifiedOrderResult = $unifiedOrder->getResult();
     $html = '<button type="button" onclick="javascript:alert(\'出錯了\')">微信支付</button>';
     if ($unifiedOrderResult["code_url"] != NULL) {
         $code_url = $unifiedOrderResult["code_url"];
         $html = '<div class="wxnative" style="text-align:center">';
         $html .= $this->getcode($code_url, $order_info['order_id']);
         $html .= "</div>";
         $html .= "<div style=\"text-align:center;font-size:14px;\"><a href=\"index.php?app=buyer_order\" style=\"color:#ff0000;\">支付後點擊此處</a>查看我的訂單</div>";
     }
     return $html;
 }
開發者ID:184609680,項目名稱:wcy_O2O_95180,代碼行數:41,代碼來源:wxnative.payment.php

示例9: dynamic_qrcode

 public function dynamic_qrcode($payid, $fee, $out_trade_no, $tUrl, $eUrl, $proDesc)
 {
     //使用統一支付接口
     $unifiedOrder = new \UnifiedOrder_pub();
     if (!$payid || !$fee || !$out_trade_no || !$tUrl || !$eUrl || !$proDesc) {
         showTips('/index.php?s=/Pc/Centerall/my_order.html', "參數提交有誤!");
     }
     //自定義訂單號,此處僅作舉例
     $fee = $fee * 100;
     $unifiedOrder->setParameter("body", "{$proDesc}");
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", "{$fee}");
     //總金額
     $unifiedOrder->setParameter("notify_url", WxPayConf_pub::NOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     $unifiedOrder->setParameter("attach", "{$payid}");
     //附加數據 訂單ID
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         return "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         return "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>" . "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         //商戶自行增加處理流程
         //......
         return $code_url;
     }
 }
開發者ID:tearys,項目名稱:lucky,代碼行數:38,代碼來源:native_dynamic_qrcode.php

示例10: NativeDynamicInterface

 /**
  * 動態模式支付   生成二維碼
  * $dataArr 提交參數內容
  */
 function NativeDynamicInterface($dataArr = array())
 {
     $unifiedOrder = new UnifiedOrder_pub();
     $unifiedOrder->setParameter("body", $dataArr['body']);
     //商品描述
     $timeStamp = time();
     $out_trade_no = WxPayConf_pub::APPID . "{$timeStamp}";
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", $dataArr['total_fee']);
     //總金額
     $unifiedOrder->setParameter("notify_url", WxPayConf_pub::NOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
         echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         //商戶自行增加處理流程
         //......
     }
     return $code_url;
 }
開發者ID:Molly2Molly,項目名稱:fiance,代碼行數:37,代碼來源:WxPay.class.php

示例11: natpayHtml

 function natpayHtml($order)
 {
     if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')) {
         $unifiedOrder = new UnifiedOrder_pub();
         // 設置統一支付接口參數
         $return_url = 'http://' . $_SERVER['HTTP_HOST'] . '/respond.php';
         $unifiedOrder->setParameter("body", $order['order_sn']);
         $unifiedOrder->setParameter("out_trade_no", $order['order_id']);
         // 商戶訂單號
         $unifiedOrder->setParameter("total_fee", $order['order_amount'] * 100);
         // 總金額
         $unifiedOrder->setParameter("notify_url", $return_url);
         // 通知地址
         $unifiedOrder->setParameter("trade_type", "NATIVE");
         // 交易類型
         $unifiedOrderResult = $unifiedOrder->getResult();
         if ($unifiedOrderResult["return_code"] == "FAIL") {
             return "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
         } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
             $log_id = $GLOBALS['db']->getOne("SELECT log_id FROM " . $GLOBALS['ecs']->table('pay_log') . "where order_id='{$order['order_id']}' and is_paid=0 order by log_id desc");
             if ($log_id > 0 && $unifiedOrderResult['err_code'] == 'ORDERPAID') {
                 order_paid($log_id, 2);
             }
             return "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
         }
         $product_url = $unifiedOrderResult["code_url"];
         return "<img src='http://qr.liantu.com/api.php?text=" . $product_url . "' alt='掃描進行支付'><iframe src='weixin_order_check.php?oid={$order['order_id']}' style='display:none'></iframe>";
     }
 }
開發者ID:seanguo166,項目名稱:yinoos,代碼行數:29,代碼來源:weixin.php

示例12: array

 function wechat_qcode_pay()
 {
     require_once APPPATH . 'libraries/wechat/WxPayPubHelper.php';
     $out_trade_no = $this->uri->segment(3);
     $order_temp = $this->tickets->select('orders', array('to_order_sn' => $out_trade_no));
     $order = $order_temp[0];
     if ($order->to_status == ORDER_PAYED) {
         redirect('/member/order_list');
     }
     $wechat_config_temp = $this->tickets->select('payment', array('name' => 'wechat'));
     $weipay = $wechat_config_temp[0];
     //使用統一支付接口
     $unifiedOrder = new UnifiedOrder_pub($weipay->app_id, $weipay->payname, $weipay->partner_key, $weipay->app_secret);
     //設置統一支付接口參數
     //設置必填參數
     //appid已填,商戶無需重複填寫
     //mch_id已填,商戶無需重複填寫
     //noncestr已填,商戶無需重複填寫
     //spbill_create_ip已填,商戶無需重複填寫
     //sign已填,商戶無需重複填寫
     $unifiedOrder->setParameter("body", "小樹好吃");
     //商品描述
     //自定義訂單號,此處僅作舉例
     $timeStamp = time();
     $notify_url = base_url() . '/wechat/wnotice';
     //$out_trade_no = $weipay->app_id."$timeStamp";
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", 100 * $order->to_order_amount);
     //總金額
     $unifiedOrder->setParameter("notify_url", $notify_url);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //非必填參數,商戶可根據實際情況選填
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
         echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         //商戶自行增加處理流程
         //......
     }
     $data['out_trade_no'] = $out_trade_no;
     $data['code_url'] = $code_url;
     $data['unifiedOrderResult'] = $unifiedOrderResult;
     $this->load->view('/wechat/qcode', $data);
 }
開發者ID:snamper,項目名稱:CI_xiaoshuhaochi,代碼行數:56,代碼來源:main20150416.php

示例13: native_pays

 public function native_pays()
 {
     //全局引入微信支付類
     Vendor('Wxpay.WxPayPubHelper.WxPayPubHelper');
     //使用統一支付接口
     $unifiedOrder = new \UnifiedOrder_pub();
     //設置統一支付接口參數
     //設置必填參數
     //appid已填,商戶無需重複填寫
     //mch_id已填,商戶無需重複填寫
     //noncestr已填,商戶無需重複填寫
     //spbill_create_ip已填,商戶無需重複填寫
     //sign已填,商戶無需重複填寫
     $unifiedOrder->setParameter("body", "貢獻一分錢");
     //商品描述
     //自定義訂單號,此處僅作舉例
     $timeStamp = time();
     $out_trade_no = \WxPayConf_pub::APPID . $timeStamp;
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", "1");
     //總金額
     $unifiedOrder->setParameter("notify_url", \WxPayConf_pub::NOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //非必填參數,商戶可根據實際情況選填
     //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商戶號
     //$unifiedOrder->setParameter("device_info","XXXX");//設備號
     //$unifiedOrder->setParameter("attach","XXXX");//附加數據
     //$unifiedOrder->setParameter("time_start","XXXX");//交易起始時間
     //$unifiedOrder->setParameter("time_expire","XXXX");//交易結束時間
     //$unifiedOrder->setParameter("goods_tag","XXXX");//商品標記
     //$unifiedOrder->setParameter("openid","XXXX");//用戶標識
     //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
         echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         //商戶自行增加處理流程
         //......
     }
     $this->assign('out_trade_no', $out_trade_no);
     $this->assign('code_url', $code_url);
     $this->assign('unifiedOrderResult', $unifiedOrderResult);
     $this->display();
 }
開發者ID:Fireky1in,項目名稱:WX,代碼行數:56,代碼來源:WxpayController.class.php

示例14: send_pay

    public function send_pay()
    {
        //使用統一支付接口
        $unifiedOrder = new UnifiedOrder_pub();
        $amount = trim($this->config['money']) * 100;
        $notify_url = $this->config['NotifyUrl'];
        //通知URL
        $weixinMoney = $amount / 100 + '.00';
        //設置統一支付接口參數
        //設置必填參數
        //appid已填,商戶無需重複填寫
        //mch_id已填,商戶無需重複填寫
        //noncestr已填,商戶無需重複填寫
        //spbill_create_ip已填,商戶無需重複填寫
        //sign已填,商戶無需重複填寫
        //iconv("gb2312","utf-8//IGNORE",
        $unifiedOrder->setParameter("body", $this->config['title']);
        //商品描述
        //自定義訂單號,此處僅作舉例
        $out_trade_no = $this->config['code'];
        $unifiedOrder->setParameter("out_trade_no", $out_trade_no);
        //商戶訂單號
        $unifiedOrder->setParameter("total_fee", $amount);
        //總金額
        $unifiedOrder->setParameter("notify_url", $notify_url);
        //通知地址
        $unifiedOrder->setParameter("trade_type", "NATIVE");
        //交易類型
        //非必填參數,商戶可根據實際情況選填
        //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商戶號
        //$unifiedOrder->setParameter("device_info","XXXX");//設備號
        $unifiedOrder->setParameter("attach", "111");
        //附加數據
        //$unifiedOrder->setParameter("time_start","XXXX");//交易起始時間
        //$unifiedOrder->setParameter("time_expire","XXXX");//交易結束時間
        //$unifiedOrder->setParameter("goods_tag","XXXX");//商品標記
        //$unifiedOrder->setParameter("openid","XXXX");//用戶標識
        //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
        //         ["parameters"]=> array(6) {
        //          ["body"]=> string(10) "1元雨購"
        //           ["out_trade_no"]=> string(18) "C14523207927686403"
        //           ["total_fee"]=> int(1000)
        //           ["notify_url"]=> string(54) "http://www.gd1yyg.com/index.php/pay/weixin_url/houtai/"
        //            ["trade_type"]=> string(6) "NATIVE"
        //             ["attach"]=> string(3) "111" }
        //             ["response"]=> NULL
        //             ["result"]=> NULL
        //              ["url"]=> string(46) "https://api.mch.weixin.qq.com/pay/unifiedorder"
        //              ["curl_timeout"]=> int(30)
        //獲取統一支付接口結果
        $unifiedOrderResult = $unifiedOrder->getResult();
        var_dump($unifiedOrder);
        exit;
        //商戶根據實際情況設置相應的處理流程
        if ($unifiedOrderResult["return_code"] == "FAIL") {
            //商戶自行增加處理流程
            echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
        } else {
            if ($unifiedOrderResult["result_code"] == "FAIL") {
                //商戶自行增加處理流程
                echo iconv("utf-8", "gb2312//IGNORE", "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>");
                echo iconv("utf-8", "gb2312//IGNORE", "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>");
            } else {
                if ($unifiedOrderResult["code_url"] != NULL) {
                    $qrcode = 'http://www.gd1yyg.com/statics/templates/auto-moban/js/qrcode.js';
                    //從統一支付接口獲取到code_url
                    $code_url = $unifiedOrderResult["code_url"];
                    $saomiao = "微信安全支付,請掃我";
                    //		//參數1表示圖像大小,取值範圍1-10;參數2表示質量,取值範圍'L','M','Q','H'
                    if ($unifiedOrderResult["code_url"] != NULL) {
                        $hehe = '	var url = "' . $code_url . '";var qr = qrcode(10, "M");qr.addData(url);qr.make();var wording=document.createElement("p");	var code=document.createElement("DIV");	code.innerHTML = qr.createImgTag();var element=document.getElementById("qrcode");
					element.appendChild(wording);element.appendChild(code);';
                    }
                    $def_url = '
                    <html>
                        <head></head>
                        <body>
                        <div class="wx_header">
                            <div class="wx_logo">
                                <img title="微信支付" alt="微信支付標誌" src="http://skin.1yyg.com/mycart/images/wxlogo_pay.png?v=1">
                            </div>
                        </div>
                        <div class="weixin">
        <div class="weixin2">
            <b class="wx_box_corner left pngFix"></b><b class="wx_box_corner right pngFix"></b>
            <div class="wx_box pngFix">
                <div class="wx_box_area">
                    <div class="pay_box qr_default">
                        <div class="area_bd"><span class="wx_img_wrapper" id="qr_box">
                                                 <div  id="qrcode" ></div>
                            <img style="left: 50%; opacity: 0; display: none; margin-left: -101px;" class="guide pngFix" src="http://skin.1yyg.com/mycart/images/wxwebpay_guide.png" alt="" id="guide">
                        </span>
                            <div class="msg_default_box1"><i class="icon60_qr pngFix"></i>
                                <p>
                                    請使用微信<br>
                                    掃一掃完成支付
                                </p>
                            </div>
                        </div>
                    </div>
//.........這裏部分代碼省略.........
開發者ID:shuay,項目名稱:projectYG,代碼行數:101,代碼來源:weixin.class.php

示例15: actionNative

 /**
  *掃描二維碼支付
  * 測試地址:http://test.idaiyan.cn/index.php?r=weixin/native
  */
 public function actionNative()
 {
     //使用統一支付接口
     $unifiedOrder = new \UnifiedOrder_pub();
     //設置統一支付接口參數
     //設置必填參數
     //appid已填,商戶無需重複填寫
     //mch_id已填,商戶無需重複填寫
     //noncestr已填,商戶無需重複填寫
     //spbill_create_ip已填,商戶無需重複填寫
     //sign已填,商戶無需重複填寫
     $unifiedOrder->setParameter("body", "貢獻一分錢");
     //商品描述
     //自定義訂單號,此處僅作舉例
     $timeStamp = time();
     $out_trade_no = \WxPayConf_pub::APPID . "{$timeStamp}";
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商戶訂單號
     $unifiedOrder->setParameter("total_fee", "1");
     //總金額
     $unifiedOrder->setParameter("notify_url", \WxPayConf_pub::NOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "NATIVE");
     //交易類型
     //非必填參數,商戶可根據實際情況選填
     //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商戶號
     //$unifiedOrder->setParameter("device_info","XXXX");//設備號
     //$unifiedOrder->setParameter("attach","XXXX");//附加數據
     //$unifiedOrder->setParameter("time_start","XXXX");//交易起始時間
     //$unifiedOrder->setParameter("time_expire","XXXX");//交易結束時間
     //$unifiedOrder->setParameter("goods_tag","XXXX");//商品標記
     //$unifiedOrder->setParameter("openid","XXXX");//用戶標識
     //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
     //獲取統一支付接口結果
     $unifiedOrderResult = $unifiedOrder->getResult();
     //要傳遞到前台
     //商戶根據實際情況設置相應的處理流程
     if ($unifiedOrderResult["return_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "通信出錯:" . $unifiedOrderResult['return_msg'] . "<br>";
     } elseif ($unifiedOrderResult["result_code"] == "FAIL") {
         //商戶自行增加處理流程
         echo "錯誤代碼:" . $unifiedOrderResult['err_code'] . "<br>";
         echo "錯誤代碼描述:" . $unifiedOrderResult['err_code_des'] . "<br>";
     } elseif ($unifiedOrderResult["code_url"] != NULL) {
         //從統一支付接口獲取到code_url
         $code_url = $unifiedOrderResult["code_url"];
         //要傳遞到前台
         //商戶自行增加處理流程
         //......
         $url = Yii::$app->request->baseurl;
         // return $this->render('native', ['code_url' => $code_url, 'out_trade_no' => $out_trade_no, 'url' => $url, 'unifiedOrderResult' => $unifiedOrderResult]);
         $str = '<div align="center" id="qrcode"></div>';
         $str .= "<script src='{$url}/static/weixin/js/qrcode.js'></script>";
         $str .= '<script>';
         if ($unifiedOrderResult["code_url"] != NULL) {
             $str .= 'var url = "' . $code_url . '";';
             $str .= "var qr = qrcode(10, 'M');";
             $str .= 'qr.addData(url);';
             $str .= 'qr.make();';
             $str .= "var wording=document.createElement('p');";
             $str .= 'wording.innerHTML = "pay";';
             $str .= "var code=document.createElement('DIV');";
             $str .= 'code.innerHTML = qr.createImgTag();';
             $str .= 'var element=document.getElementById("qrcode");';
             $str .= 'element.appendChild(wording);';
             $str .= 'element.appendChild(code);';
         }
         $str .= '</script>';
         echo $str;
     }
 }
開發者ID:songhongyu,項目名稱:idaiyan,代碼行數:76,代碼來源:WeixinController_bak.php


注:本文中的UnifiedOrder_pub::getResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。