mirror of https://github.com/assimon/dujiaoka.git
fix: 汇率接口body变更跟进
This commit is contained in:
parent
59027d61f4
commit
b368cbbeae
|
@ -522,11 +522,12 @@ class StripeController extends PayController
|
|||
$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;
|
||||
|
|
Loading…
Reference in New Issue