Commit da14a141 authored by shajiaming's avatar shajiaming

Merge branch 'feature/issue_coin' into develop

parents 87d9f33f 7afe6dbf
......@@ -152,7 +152,7 @@ class WalletChainController extends BaseController
}
$model = WalletChain::find()->select('platform, token, address, private_key, fee, host, port, hash, status')->where(['id' => (int)$id])->asArray()->one();
$model = WalletChain::find()->select('platform, token, address, private_key, fee, host, port, hash, status, create_time')->where(['id' => (int)$id])->asArray()->one();
if (empty($model)) {
goto doEnd;
}
......
......@@ -230,8 +230,7 @@ class ExchangeBusiness
if (in_array(strtoupper($tag), ['TSC'])) {
$exchange = ExchangeFactory::createExchange("Tsc");
$quotation = $exchange->getTicker('TSC', 'CNDT');
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation = $exchange->getTicker('TSC', 'USDT');
goto doEnd;
}
......@@ -267,7 +266,7 @@ class ExchangeBusiness
'low' => (float)sprintf("%0.4f", $quotation['low'] / 100),
'high' => (float)sprintf("%0.4f", $quotation['high'] / 100),
'last' => (float)sprintf("%0.4f", $quotation['last'] / 100),
'rmb' => (float)sprintf("%0.2f", $quotation['last'] / 100),
'rmb' => (float)sprintf("%0.4f", $quotation['last'] / 100),
];
goto doEnd;
}
......@@ -329,7 +328,7 @@ class ExchangeBusiness
$exchange = ExchangeFactory::createExchange("Go");
$rate = $exchange->getTicker("CNY", "USD");
$cny_usd_rate = 1 / $rate['last'];
if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'KPC8', 'BVA', 'DAG', 'BNC', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT'])) {
if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'KPC8', 'BVA', 'DAG', 'BNC', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT', 'TSC'])) {
$quotation['usd'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate);
} else if (in_array(strtoupper($tag), ['SUSD'])) {
......
......@@ -16,7 +16,7 @@ class Tsc extends Exchange implements ExchangeInterface
protected $quotation_prefix = 'quotation_tsc_';
protected $base_url = 'https://api.tsc100.vip/openapi/quote/v1/ticker/24hr';
public function symbolExists($tag = 'TSC', $aim = "CNDT")
public function symbolExists($tag = 'TSC', $aim = "USDT")
{
$supported = $this->redis->smembers($this->supported_symbol);
if (is_array($supported) && in_array($this->formatSymbol($tag, $aim), $supported)) {
......@@ -31,9 +31,9 @@ class Tsc extends Exchange implements ExchangeInterface
* @param string $aim
* @return mixed
*/
public function formatSymbol($tag = 'TSC', $aim = 'CNDT')
public function formatSymbol($tag = 'TSC', $aim = 'USDT')
{
return strtoupper($tag .'_'. $aim);
return strtoupper($tag . $aim);
}
/**
......@@ -43,7 +43,7 @@ class Tsc extends Exchange implements ExchangeInterface
*/
public function setSupportedSymbol()
{
$this->redis->sadd($this->supported_symbol, 'TSC_CNDT');
}
/**
......@@ -57,11 +57,10 @@ class Tsc extends Exchange implements ExchangeInterface
$content = $curl->get($this->base_url, false);
if (is_array($content)) {
foreach ($content as $item) {
if (in_array($item['symbol'], ['TSCCNDT'])) {
$data = $item;
$key = $this->quotation_prefix .'TSC_CNDT';
$this->redis->hmset($key, 'low', $data['lowPrice'], 'high', $data['highPrice'], 'last', $data['lastPrice']);
$this->redis->sadd($this->supported_symbol, $item['symbol']);
$key = $this->quotation_prefix . strtoupper($item['symbol']);
$this->redis->hmset($key, 'low', $item['lowPrice'], 'high', $item['highPrice'], 'last', $item['lastPrice']);
if (!$this->redis->sismember($this->supported_symbol, strtoupper($item['symbol']))){
$this->redis->sadd($this->supported_symbol, strtoupper($item['symbol']));
}
}
}
......
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