当前位置: 首页>>代码示例>>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;未经允许,请勿转载。