|
|
@@ -87,6 +87,8 @@ trait GzcApiRequest
|
|
87
|
87
|
|
|
88
|
88
|
$amount = $cxbResponseData['extendData']['amount'] + $xfbResponseData['extendData']['amount'];
|
|
89
|
89
|
return $amount;
|
|
|
90
|
+
|
|
|
91
|
+
|
|
90
|
92
|
}
|
|
91
|
93
|
public function getAmountFromGzc()
|
|
92
|
94
|
{
|
|
|
@@ -105,18 +107,17 @@ trait GzcApiRequest
|
|
105
|
107
|
return app('json')->fail('查询失败(第三方异常)');
|
|
106
|
108
|
}
|
|
107
|
109
|
|
|
108
|
|
- // 提取 amount(兼容多种字段位置)
|
|
109
|
|
- $amountCents = $res['extendData']['amount'] ?? $res['data']['amount'] ?? $res['amount'] ?? null;
|
|
110
|
|
- $amount = $amountCents === null ? 0.0 : floatval($amountCents) * 0.01;
|
|
111
|
|
- $formatted = sprintf('%.2f', $amount);
|
|
|
110
|
+ if (!is_array($res) || ($res['code'] ?? -1) !== 0) {
|
|
|
111
|
+ return app('json')->fail($res['message'] ?? '查询失败');
|
|
|
112
|
+ }
|
|
112
|
113
|
|
|
113
|
|
- // 从 checkAmount 返回的 debug(若存在)
|
|
114
|
|
- $debug = $res['debug'] ?? null;
|
|
|
114
|
+ $amountCents = $res['extendData']['amount'] ?? $res['data']['amount'] ?? $res['amount'] ?? 0;
|
|
|
115
|
+ $amount = floatval($amountCents) * 0.01;
|
|
|
116
|
+ $formatted = sprintf('%.2f', $amount);
|
|
115
|
117
|
|
|
116
|
|
- // 返回 amount 与 debug 给调用方(前端 / 调试)
|
|
117
|
118
|
return app('json')->success([
|
|
118
|
119
|
'amount' => $formatted,
|
|
119
|
|
- 'debug' => $debug
|
|
|
120
|
+ 'debug' => $res['debug'] ?? null,
|
|
120
|
121
|
]);
|
|
121
|
122
|
}
|
|
122
|
123
|
/**
|