First commit
This commit is contained in:
72
weixinpay/example/native_notify.php
Executable file
72
weixinpay/example/native_notify.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
ini_set('date.timezone','Asia/Shanghai');
|
||||
|
||||
error_reporting(E_ERROR);
|
||||
|
||||
|
||||
|
||||
require_once "../lib/WxPay.Api.php";
|
||||
|
||||
require_once '../lib/WxPay.Notify.php';
|
||||
|
||||
require_once 'log.php';
|
||||
|
||||
|
||||
|
||||
//初始化日志
|
||||
|
||||
$logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
|
||||
|
||||
$log = Log::Init($logHandler, 15);
|
||||
|
||||
|
||||
|
||||
class NativeNotifyCallBack extends WxPayNotify
|
||||
|
||||
{
|
||||
|
||||
public function unifiedorder($openId, $product_id)
|
||||
|
||||
{
|
||||
|
||||
//统一下单
|
||||
|
||||
$input = new WxPayUnifiedOrder();
|
||||
|
||||
$input->SetBody("test");
|
||||
|
||||
$input->SetAttach("test");
|
||||
|
||||
$input->SetOut_trade_no(WX_MCHID.date("YmdHis"));
|
||||
|
||||
$input->SetTotal_fee("1");
|
||||
|
||||
$input->SetTime_start(date("YmdHis"));
|
||||
|
||||
$input->SetTime_expire(date("YmdHis", time() + 600));
|
||||
|
||||
$input->SetGoods_tag("test");
|
||||
|
||||
$input->SetNotify_url("http://paysdk.weixin.qq.com/example/notify.php");
|
||||
|
||||
$input->SetTrade_type("NATIVE");
|
||||
|
||||
$input->SetOpenid($openId);
|
||||
|
||||
$input->SetProduct_id($product_id);
|
||||
|
||||
$result = WxPayApi::unifiedOrder($input);
|
||||
|
||||
Log::DEBUG("unifiedorder:" . json_encode($result));
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function NotifyProcess($data, &$msg)
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user