";echo "parent.location.href='".$nurlx."';";echo "";exit;} $ddbh=$_GET[ddbh];if(empty($ddbh)){php_toheader("../../car.php");exit;} $sql="select * from yjcode_dingdang where ddbh='".$ddbh."'";mysql_query("SET NAMES 'GBK'");$res=mysql_query($sql); if(!$row=mysql_fetch_array($res)){php_toheader("../../car.php");exit;} if(1==$row[ifok]){php_toheader("../../order.php");} function updatetable($utable,$ures,$uwhere=""){$sqlupdate="update ".$utable." set ".$ures." ".$uwhere;mysql_query("SET NAMES 'GBK'");mysql_query($sqlupdate);} ini_set('date.timezone','Asia/Shanghai'); //error_reporting(E_ERROR); require_once "../lib/WxPay.Api.php"; require_once "WxPay.NativePay.php"; require_once 'log.php'; $notify = new NativePay(); //模式二 /** * 流程: * 1、调用统一下单,取得code_url,生成二维码 * 2、用户扫描二维码,进行支付 * 3、支付完成之后,微信服务器会通知支付成功 * 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php) */ $input = new WxPayUnifiedOrder(); $input->SetBody($g_webname); $input->SetAttach("test"); $wxddbh=WxPayConfig::MCHID.date("YmdHis");if(!empty($row[wxddbh])){$wxddbh=$row[wxddbh];} $input->SetOut_trade_no($wxddbh); $input->SetTotal_fee($row[money1]*100); $input->SetTime_start(date("YmdHis")); $input->SetTime_expire(date("YmdHis", time() + 600)); $input->SetGoods_tag("test"); $input->SetNotify_url(weburl."user/wxpay/example/buy_notify.php"); $input->SetTrade_type("NATIVE"); $input->SetProduct_id($ddbh); $result = $notify->GetPayUrl($input); $url2 = $result["code_url"]; updatetable("yjcode_dingdang","wxddbh='".$wxddbh."' where ddbh='".$ddbh."'"); ?>