修复上个问题
This commit is contained in:
parent
60e316e089
commit
ef841944b1
|
@ -111,9 +111,19 @@ class PaymentNew
|
||||||
echo $responseBody;
|
echo $responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $responseBody;
|
return json_decode($responseBody);
|
||||||
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
||||||
Log::warning("请求支付api失未知失败:" . $e->getMessage());
|
Log::warning("请求支付api失未知失败:" . $e->getMessage());
|
||||||
|
// 如果是 400 错误,可能有额外的请求错误信息
|
||||||
|
if ($e->hasResponse()) {
|
||||||
|
$response = $e->getResponse();
|
||||||
|
$httpCode = $response->getStatusCode();
|
||||||
|
if ($httpCode == 400) {
|
||||||
|
$responseBody = $response->getBody()->getContents();
|
||||||
|
Log::warning("请求支付api失败,状态码 400,响应体:" . $responseBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return json_decode($responseBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -152,16 +162,6 @@ class PaymentNew
|
||||||
}
|
}
|
||||||
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
||||||
Log::warning("请求支付api失未知失败:" . $e->getMessage());
|
Log::warning("请求支付api失未知失败:" . $e->getMessage());
|
||||||
// 如果是 400 错误,可能有额外的请求错误信息
|
|
||||||
if ($e->hasResponse()) {
|
|
||||||
$response = $e->getResponse();
|
|
||||||
$httpCode = $response->getStatusCode();
|
|
||||||
if ($httpCode == 400) {
|
|
||||||
$responseBody = $response->getBody()->getContents();
|
|
||||||
Log::warning("请求支付api失败,状态码 400,响应体:" . $responseBody);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,16 +133,20 @@ class WithdrawController
|
||||||
//获取刚刚存入数据库的id(订单号)
|
//获取刚刚存入数据库的id(订单号)
|
||||||
$orderId = $withdraw->id;
|
$orderId = $withdraw->id;
|
||||||
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);
|
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);
|
||||||
|
|
||||||
// //逻辑错误需要修改
|
// //逻辑错误需要修改
|
||||||
if ($res['Success']) {
|
if ($res->Success) {
|
||||||
$withdraw->update([
|
$withdraw->update([
|
||||||
'status' => 4, //
|
'status' => 4, //
|
||||||
'status_text' => '等待银行打款',
|
'status_text' => '等待银行打款',
|
||||||
'order_number' => $res['TrackingNumber'] ?? null,
|
'order_number' => $res->TrackingNumber ?? null,
|
||||||
]);
|
]);
|
||||||
return ApiResponseApp::success(null, '转账成功');
|
return ApiResponseApp::success(null, '转账成功');
|
||||||
} else {
|
} else {
|
||||||
return ApiResponseApp::error(null, '转账失败');
|
if ($res->ErrorMessage == "PayeeAccountNumberFormatError") {
|
||||||
|
return ApiResponseApp::error(null, '收款人帐号格式错误');
|
||||||
|
}
|
||||||
|
return ApiResponseApp::error(null, '未知错误请联系客服');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue