【调度系统】广东民航医疗快线调度系统源代码
wzp
2025-05-14 a023d5daed320eb4dbf6cfb8c28529d41cf5f9c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1" /> 
    <title>微信支付样例-退款</title>
</head>
<?php
ini_set('date.timezone','Asia/Shanghai');
error_reporting(E_ERROR);
require_once "../lib/WxPay.Api.php";
require_once 'log.php';
 
//初始化日志
$logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
$log = Log::Init($logHandler, 15);
 
$ord_transaction_id=empty($_REQUEST['ord_transaction_id'])!=false ? "" : addslashes($_REQUEST['ord_transaction_id']);
$ord_total_fee=empty($_REQUEST['ord_total_fee'])!=false ? "" : addslashes($_REQUEST['ord_total_fee']);
$ReturnID=empty($_REQUEST['ReturnID'])!=false ? "m" : addslashes($_REQUEST['ReturnID']);
 
function printf_info($data)
{
    foreach($data as $key=>$value){
        echo "<font color='#f00;'>$key</font> : $value <br/>";
    }
}
 
if(isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != ""){
    // echo 1;exit;
    $transaction_id = $_REQUEST["transaction_id"];
    $total_fee = $_REQUEST["total_fee"];
    $refund_fee = $_REQUEST["refund_fee"];
    $input = new WxPayRefund();
    $input->SetTransaction_id($transaction_id);
    $input->SetTotal_fee($total_fee);
    $input->SetRefund_fee($refund_fee);
    $input->SetOut_refund_no(WxPayConfig::MCHID.date("YmdHis"));
    $input->SetOp_user_id(WxPayConfig::MCHID);
    
    // var_dump($input);exit;
    
    $res = WxPayApi::refund($input);
    
    // var_dump($res);exit;
    
    printf_info(WxPayApi::refund($input));
    if ($res['result_code']=="SUCCESS"){
        echo "<br>订单退款完成";
        if ($ReturnID=="list") {
            header("Location: https://sys.966120.com.cn/admin_save.gds?admin_save=34&PaidMoneyID=".$_REQUEST["PaidMoneyID"]."&OrdType=2&PaidMoney_Check=1");exit;
        }else{
            header("Location: https://sys.966120.com.cn/admin_save.gds?admin_save=34&PaidMoneyID=".$_REQUEST["PaidMoneyID"]."&ReturnID=m&PaidMoney_Check=1");exit;
        }
    } else {
        echo "<br>".$res['err_code_des'];
        if ($ReturnID=="list") {
            header("Location: https://sys.966120.com.cn/PaidMoney_List.gds?OrdType=2&h_menu1_1=2&SystemMessageType=4&SMT=8");exit;
        }else{
            header("Location: https://sys.966120.com.cn/m_PaidMoneyRefund.gds?PaidMoneyID=".$_REQUEST["PaidMoneyID"]."&SystemMessageType=4&SMT=8");exit;
        }
    }
    //var_dump($x);
    exit();
}
 
//$_REQUEST["out_trade_no"]= "122531270220150304194108";
///$_REQUEST["total_fee"]= "1";
//$_REQUEST["refund_fee"] = "1";
if(isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != ""){
    $out_trade_no = $_REQUEST["out_trade_no"];
    $total_fee = $_REQUEST["total_fee"];
    $refund_fee = $_REQUEST["refund_fee"];
    $input = new WxPayRefund();
    $input->SetOut_trade_no($out_trade_no);
    $input->SetTotal_fee($total_fee);
    $input->SetRefund_fee($refund_fee);
    $input->SetOut_refund_no(WxPayConfig::MCHID.date("YmdHis"));
    $input->SetOp_user_id(WxPayConfig::MCHID);
    // printf_info(WxPayApi::refund($input));
    $res = WxPayApi::refund($input);
    var_dump($res);
    echo $res['result_code'];
    exit();
}
?>
<body>  
    <form action="#" method="post">
        <div style="margin-left:2%;color:#f00">微信订单号和商户订单号选少填一个,微信订单号优先:</div><br/>
        <div style="margin-left:2%;">微信订单号:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="transaction_id" value="<?php echo $ord_transaction_id;?>"/><br /><br />
        <div style="margin-left:2%;">商户订单号:</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_trade_no" /><br /><br />
        <div style="margin-left:2%;">订单总金额(分):</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="total_fee" value="<?php echo $ord_total_fee;?>"/><br /><br />
        <div style="margin-left:2%;">退款金额(分):</div><br/>
        <input type="text" style="width:96%;height:35px;margin-left:2%;" name="refund_fee" value="<?php echo $ord_total_fee;?>"/><br /><br />
        <div align="center">
            <input type="submit" value="提交退款" style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;" type="button" onclick="callpay()" />
        </div>
    </form>
</body>
</html>