53 lines
2.1 KiB
PHP
53 lines
2.1 KiB
PHP
<?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('订单查询异常,请稍后重试');
|
||
|
||
|
||
}
|
||
} |