|
|
@@ -56,7 +56,11 @@ trait GzcApiRequest
|
|
56
|
56
|
*/
|
|
57
|
57
|
public static function checkAmount($user)
|
|
58
|
58
|
{
|
|
59
|
|
- $cardType = $user['card_type'] ? $user['card_type'] : 10;
|
|
|
59
|
+ Log::info('用户实名信息:' . json_encode($user));
|
|
|
60
|
+ $cardType = $user['card_type'];
|
|
|
61
|
+ if ($user['card_type'] == 2) {
|
|
|
62
|
+ $cardType = '10';
|
|
|
63
|
+ }
|
|
60
|
64
|
$cxbData = [
|
|
61
|
65
|
'platformNo' => env('GZC.PLATFORM_NO'),
|
|
62
|
66
|
'appNo' => env('GZC.APP_NO'),
|
|
|
@@ -87,8 +91,6 @@ trait GzcApiRequest
|
|
87
|
91
|
|
|
88
|
92
|
$amount = $cxbResponseData['extendData']['amount'] + $xfbResponseData['extendData']['amount'];
|
|
89
|
93
|
return $amount;
|
|
90
|
|
-
|
|
91
|
|
-
|
|
92
|
94
|
}
|
|
93
|
95
|
public function getAmountFromGzc()
|
|
94
|
96
|
{
|
|
|
@@ -107,17 +109,18 @@ trait GzcApiRequest
|
|
107
|
109
|
return app('json')->fail('查询失败(第三方异常)');
|
|
108
|
110
|
}
|
|
109
|
111
|
|
|
110
|
|
- if (!is_array($res) || ($res['code'] ?? -1) !== 0) {
|
|
111
|
|
- return app('json')->fail($res['message'] ?? '查询失败');
|
|
112
|
|
- }
|
|
113
|
|
-
|
|
114
|
|
- $amountCents = $res['extendData']['amount'] ?? $res['data']['amount'] ?? $res['amount'] ?? 0;
|
|
115
|
|
- $amount = floatval($amountCents) * 0.01;
|
|
|
112
|
+ // 提取 amount(兼容多种字段位置)
|
|
|
113
|
+ $amountCents = $res['extendData']['amount'] ?? $res['data']['amount'] ?? $res['amount'] ?? null;
|
|
|
114
|
+ $amount = $amountCents === null ? 0.0 : floatval($amountCents) * 0.01;
|
|
116
|
115
|
$formatted = sprintf('%.2f', $amount);
|
|
117
|
116
|
|
|
|
117
|
+ // 从 checkAmount 返回的 debug(若存在)
|
|
|
118
|
+ $debug = $res['debug'] ?? null;
|
|
|
119
|
+
|
|
|
120
|
+ // 返回 amount 与 debug 给调用方(前端 / 调试)
|
|
118
|
121
|
return app('json')->success([
|
|
119
|
122
|
'amount' => $formatted,
|
|
120
|
|
- 'debug' => $res['debug'] ?? null,
|
|
|
123
|
+ 'debug' => $debug
|
|
121
|
124
|
]);
|
|
122
|
125
|
}
|
|
123
|
126
|
/**
|