Update activitypub.extend.php

This commit is contained in:
Namhyeon Go 2022-07-06 19:38:08 +09:00 committed by GitHub
parent 8b4cd90a0e
commit 09183bc705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,6 +329,10 @@ function openweathermap_get_data($args = array("longitude" => "", "latitude" =>
function koreaexim_get_exchange_data() {
$data = array();
$_fval = function($s) {
return floatval(preg_replace('/\.(?=.*\.)/', '', str_replace(",",".", $s)));
};
$params = array(
"authkey" => KOREAEXIM_API_KEY,
//"searchdate" => "20180102",
@ -347,15 +351,13 @@ function koreaexim_get_exchange_data() {
curl_close($ch);
$items = activitypub_json_decode($response);
$KRW = array();
foreach($items as $item) {
if ($item['result'] === 1) {
$k = "KRW-" . $item['cur_unit'];
$data[$k] = array(
"ttb" => $item['ttb'],
"tts" => $item['tts']
);
$KRW[$item['cur_unit']] = round(($_fval($item['ttb']) + $_fval($item['tts'])) / 2.0, 2);
}
}
$data['KRW'] = $KRW;
return $data;
}