Skip to content

Commit

Permalink
fix: 汇率接口body变更跟进
Browse files Browse the repository at this point in the history
  • Loading branch information
snail2lzq committed Jan 16, 2024
1 parent 59027d6 commit b368cbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/Pay/StripeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,12 @@ public function getUsdCurrency($cny)
$client = new Client();
$res = $client->get('https://m.cmbchina.com/api/rate/fx-rate');
$fxrate = json_decode($res->getBody(), true);
if (!isset($fxrate['data'])) {
$data = $fxrate['body']['data'];
if (!isset($data)) {
throw new \Exception('汇率接口异常');
}
$dfFxrate = 0.13;
foreach ($fxrate['data'] as $item) {
foreach ($data as $item) {
if ($item['ccyNbr'] == "美元") {
$dfFxrate = bcdiv(100, $item['rtcOfr'], 2);
break;
Expand Down

0 comments on commit b368cbb

Please sign in to comment.