public function Queryorder($transaction_id) { $input = new WxPayOrderQuery(); $input->SetTransaction_id($transaction_id); $result = WxPayApi::orderQuery($input); // Log::DEBUG("query:" . json_encode($result)); if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") { return $result; } return false; }
/** * 订单查询 * @throws WxPayException */ public function actionOrderQuery() { $order = null; // 微信订单号 优先级别高 if (isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != "") { $transaction_id = $_REQUEST["transaction_id"]; $input = new WxPayOrderQuery(); $input->SetTransaction_id($transaction_id); $order = WxPayApi::orderQuery($input); } // 商户订单 优先级别低于微信订单 if (isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != "") { $out_trade_no = $_REQUEST["out_trade_no"]; $input = new WxPayOrderQuery(); $input->SetOut_trade_no($out_trade_no); $order = WxPayApi::orderQuery($input); } // echo json_encode($order); return json_encode($order); }