$value){ echo "$key : $value
"; } } //①、获取用户openid $tools = new JsApiPay(); $openId = $tools->GetOpenid(); //var_dump($_GET['orderid']);exit(); if (!empty($_GET['orderid']) && $_GET['orderid'] !=='false'){ $orderno=$_GET['orderid']; }else{ echo ""; exit; } if (isset($_GET['disney']) && $_GET['disney']==1){ $url="http://xmwxc.zhizhuchuxing.cn/php_include/order_details.php?order_id=".$orderno; $result=http_request($url); wlog("disney::".$openId."--".$orderno."--".$url."--".$result); $orderDetail=json_decode($result,true); $money=$orderDetail['order_price']*100; $money=1; if ($money == 0){ $successurl="http://xmwxc.zhizhuchuxing.cn/php_include/order_details.php?order_id=".$orderno."&disney=1"; Header("Location: $successurl"); exit; } $name=$orderDetail['prod_name']; //$name='迪士尼'; $reurl="http://".$_SERVER['HTTP_HOST']."/php_include/disney_pay_callback.php"; wlog("disney::".$reurl); }else{ $url="http://xmwxc.zhizhuchuxing.cn/core/order_detail.asp?orderno=".$orderno; $result=http_request($url); wlog($openId."--".$orderno."--".$url."--".$result); $orderDetail=json_decode($result,true); $money=$orderDetail['price']*100; if ($money == 0){ $successurl="http://xmwxc.zhizhuchuxing.cn/core/order_confirm1.asp?orderno=".$orderno; Header("Location: $successurl"); exit; } $name=$orderDetail['prod_name']; $reurl=dirname("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])."/success_notify.php"; } //$openId='oCVcbv1udkL4iZm-t1h8YMrMDSyU'; //②、统一下单 $input = new WxPayUnifiedOrder(); $SetBody=$name.": ".$orderno; $input->SetBody($SetBody); //$input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis")); $SetOut_trade_no=$orderno."-".date("ymdHis"); $input->SetOut_trade_no($SetOut_trade_no); $input->SetTotal_fee($money); $SetTime_start=date("YmdHis"); $input->SetTime_start($SetTime_start); $SetTime_expire=date("YmdHis", time() + 600); $input->SetTime_expire($SetTime_expire); $SetGoods_tag="代金券"; $input->SetGoods_tag($SetGoods_tag); wlog($reurl); $input->SetNotify_url($reurl); $SetTrade_type="JSAPI"; $input->SetTrade_type($SetTrade_type); $input->SetOpenid($openId); wlog($SetBody."^".$SetOut_trade_no."^".$money."^".$SetTime_start."^".$SetTime_expire."^".$SetGoods_tag."^".$reurl."^".$SetTrade_type."^".$openId); $order = WxPayApi::unifiedOrder($input,15); //echo '统一下单支付单信息qwwww
'; //printf_info($order); wlog(json_encode($order)); $jsApiParameters = $tools->GetJsApiParameters($order); //print_r($jsApiParameters); //获取共享收货地址js函数参数 $editAddress = $tools->GetEditAddressParameters(); //③、在支持成功回调通知中处理成功之后的事宜,见 notify.php /** * 注意: * 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功 * 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”, * 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html) */ function wlog($result){ $dir=__DIR__.'/Log/'; if (!is_dir($dir)){ mkdir($dir); } $filename=$dir.date("Y-m-d").".log"; file_put_contents($filename, date("Y-m-d H:i:s")." ".$result.PHP_EOL,FILE_APPEND);//订单详细日志 } ?>