chengkun
2025-04-30 6ab292fb7415be124651e312ec4f21c594568f17
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
<?php
ini_set('date.timezone','Asia/Shanghai');
error_reporting(E_ERROR);
 
require_once "lib/WxPay.Api.php";
require_once(dirname(dirname(dirname(__FILE__)))."/global.php");
require_once(APP_PATH.'app/public/common.php');
require_once(LIB_PATH.'ApiPay.class.php');
 
$tradeId = $_POST["orderid"];
 
if(!preg_match('/^[0-9]+$/',$tradeId)){
    
    echo 0;
    exit();
}
 
 
$wxPay = new apipay($phpyun,$db,$db_config['def'],'index');
 
$order = $wxPay->getOrder($tradeId);
 
if($order['order_state']=='2'){
 
    echo 1;
    exit();
  
}elseif(isset($order['order_id']) && $order['order_id'] != "")
{
    /*
    $input = new WxPayOrderQuery();
    $input->SetOut_trade_no($order['order_id']);
    $result = WxPayApi::orderQuery($input);
 
    if(array_key_exists("return_code", $result)
        && array_key_exists("result_code", $result)
        && $result["return_code"] == "SUCCESS"
        && $result["result_code"] == "SUCCESS" && $result["trade_state"]=="SUCCESS")
    {
            
            
            $order_state = $wxPay->payAll($order['order_id'],$total_fee,'wxpay');
            
            if($order_state=='2'){
                    
                echo 1;
                exit();
            }
    }
    */
}
echo 0;
exit();