Update activitypub.extend.php
This commit is contained in:
parent
8b4cd90a0e
commit
09183bc705
|
@ -329,6 +329,10 @@ function openweathermap_get_data($args = array("longitude" => "", "latitude" =>
|
||||||
function koreaexim_get_exchange_data() {
|
function koreaexim_get_exchange_data() {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
$_fval = function($s) {
|
||||||
|
return floatval(preg_replace('/\.(?=.*\.)/', '', str_replace(",",".", $s)));
|
||||||
|
};
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
"authkey" => KOREAEXIM_API_KEY,
|
"authkey" => KOREAEXIM_API_KEY,
|
||||||
//"searchdate" => "20180102",
|
//"searchdate" => "20180102",
|
||||||
|
@ -347,15 +351,13 @@ function koreaexim_get_exchange_data() {
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
$items = activitypub_json_decode($response);
|
$items = activitypub_json_decode($response);
|
||||||
|
$KRW = array();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
if ($item['result'] === 1) {
|
if ($item['result'] === 1) {
|
||||||
$k = "KRW-" . $item['cur_unit'];
|
$KRW[$item['cur_unit']] = round(($_fval($item['ttb']) + $_fval($item['tts'])) / 2.0, 2);
|
||||||
$data[$k] = array(
|
|
||||||
"ttb" => $item['ttb'],
|
|
||||||
"tts" => $item['tts']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$data['KRW'] = $KRW;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user