Files
mier-php/application/common/pay/GetData.php
2025-08-11 10:22:05 +08:00

53 lines
2.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\common\pay;
use app\common\traits\ReturnTrait;
use app\common\yun\Base;
use app\common\yun\Router;
use app\common\yun\service\BaseService;
use think\facade\Log;
class GetData
{
use ReturnTrait;
static function getOrderInfo($order_id, $channel, $scene = 'info')
{
//单笔订单查询
$base = new Base(Router::QUERY_REALTIME_ORDER, "get"); # 单笔订单查询GET请求
$base->addParam("order_id", $order_id); # 商户订单号,由商户保持唯⼀性(必填)
$base->addParam("channel", $channel); # 银⾏卡,⽀付宝,微信(选填不填默认为银⾏卡订单查询注意填写的value是中文)
// $base->addParam("data_type", "encryption");
// # 如果为encryption则对返回的data进行加密(选填)
$config = Conf::config();
$GoQuery = new BaseService($config, $base);
$orderQuery = $GoQuery->request();
$code = $orderQuery['code'];
if ($code == '0000')
# TODO : code=0000,订单查询成功根据订单状态status判断订单状态做业务订单的处理
if ($scene == 'info') {
return self::rep_success('获取数据成功', $orderQuery['data']);
} else if ($scene == 'submit') {
return self::rep_fail('订单已存在');
} else {
return self::rep_success('获取数据成功', $orderQuery['data']);
}
else
if ($code == '2018')
if ($scene == 'submit') {
return self::rep_success('获取数据成功');
} else {
return self::rep_fail('订单不存在');
}
else
# TODO : 其他code应当做异常情况订单状态当"未知"处理可稍后重试直至获取到code=0000或2018或者是联系云账户进行人工查询
#echo "订单查询异常,请稍后重试";
return self::rep_fail('订单查询异常,请稍后重试');
}
}