Commit 893ad29f authored by rlgy's avatar rlgy

BTY行情

parent d4d4a32f
......@@ -53,6 +53,9 @@ class CoinBusiness
$datas = $rows['data'];
foreach ($datas as $key => $value) {
//获取行情信息
if (strtoupper($value['name']) == 'BTY') {
$rows['data'][$key]['exchange'] = CoinService::quotationBTY();
}
$rows['data'][$key]['quotation'] = CoinService::quotation($value['sid']);
}
}
......
......@@ -134,4 +134,40 @@ class CoinService
}
return $result;
}
/**
* 快速修复方法,之后再改
*/
public static function quotationBTY()
{
$result = [
'price' => '',//价格
'dollar' => '',//价格美元
'btc' => '',//价格btc
'high' => '',//最高价
'low' => '',//最低价
'change' => '',//涨幅(跌幅)
'rank' => '',//流通市值排名
'circulate_value_rmb' => '',//流通市值人民币
'circulate_value_usd' => '',//流通市值美元
'circulate_value_btc' => '',//流通市值btc
'publish_count' => '',//发行总量
'circulate_count' => '',//流通总量
];
$ch = curl_init('https://api2.mytoken.org/currency/currencydetail?com_id=bty_CNY&market_id=1303&market_name=cmc&symbol=BTY&anchor=CNY&timestamp=1528772807124&code=5384ef255744748f1a469b6514dad6ed&v=1.4.0&platform=m&language=zh_CN&');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$content = curl_exec($ch);
$content = json_decode($content, true);
if ($content['code'] == 0) {
$content = $content['data'];
$result['rank'] = '第' . $content['rank'] . '名';
$result['price'] = $content['price_display'];
$result['dollar'] = sprintf("$%0.2f", $content['price_usd']);
$result['change'] = sprintf("%0.2f%%", $content['percent_change_display']);
}
return $result;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment