Commit 79e4e7de authored by shajiaiming's avatar shajiaiming

fix

parent 5a0d1767
...@@ -51,17 +51,17 @@ class ExchangeBusiness ...@@ -51,17 +51,17 @@ class ExchangeBusiness
public static function getquatation($tag = 'btc') public static function getquatation($tag = 'btc')
{ {
$coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items']; $coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items'];
if(strtoupper($tag) == 'CCNY'){ if (strtoupper($tag) == 'CCNY') {
$exchange = ExchangeFactory::createExchange("Bty"); $exchange = ExchangeFactory::createExchange("Bty");
$rate = $exchange->getTicker("BTY", "USDT"); $rate = $exchange->getTicker("BTY", "USDT");
$rate = (float)$rate['rmb'] / $rate['last']; $rate = (float)$rate['rmb'] / $rate['last'];
$quotation['rmb'] = 1.00; $quotation['rmb'] = 1.00;
$quotation['low'] = 1.00; $quotation['low'] = 1.00;
$quotation['high'] = 1.00; $quotation['high'] = 1.00;
$quotation['last'] = (float)sprintf("%0.4f", $quotation['rmb']/$rate); $quotation['last'] = (float)sprintf("%0.4f", $quotation['rmb'] / $rate);
goto doEnd; goto doEnd;
} }
if(strtoupper($tag) == 'BOSS'){ if (strtoupper($tag) == 'BOSS') {
$quotation = [ $quotation = [
'low' => 2000, 'low' => 2000,
'high' => 2000, 'high' => 2000,
...@@ -71,7 +71,7 @@ class ExchangeBusiness ...@@ -71,7 +71,7 @@ class ExchangeBusiness
goto doEnd; goto doEnd;
} }
if(strtoupper($tag) == 'CPF'){ if (strtoupper($tag) == 'CPF') {
$quotation = [ $quotation = [
'low' => 3.4, 'low' => 3.4,
'high' => 3.4, 'high' => 3.4,
...@@ -81,62 +81,72 @@ class ExchangeBusiness ...@@ -81,62 +81,72 @@ class ExchangeBusiness
goto doEnd; goto doEnd;
} }
if(in_array($tag,$coin_quotation_disable_items)){ if (strtoupper($tag) == 'WL' || strtoupper($tag) == 'ETS' || strtoupper($tag) == 'LIMS' || strtoupper($tag) == 'AT' || strtoupper($tag) == 'BTJ') {
$quotation = [
'low' => 0,
'high' => 0,
'last' => 0,
'rmb' => 0,
];
goto doEnd;
}
if (in_array($tag, $coin_quotation_disable_items)) {
return false; return false;
} }
$f = false; $f = false;
$quotation = []; $quotation = [];
if(in_array(strtoupper($tag),['GM', 'BSTC'])){ if (in_array(strtoupper($tag), ['GM', 'BSTC'])) {
$exchange = ExchangeFactory::createExchange("Token7"); $exchange = ExchangeFactory::createExchange("Token7");
$quotation = $exchange->getTicker($tag, 'HA'); $quotation = $exchange->getTicker($tag, 'HA');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['BECC'])){ if (in_array(strtoupper($tag), ['BECC'])) {
$exchange = ExchangeFactory::createExchange("S"); $exchange = ExchangeFactory::createExchange("S");
$quotation = $exchange->getTicker($tag, 'ST'); $quotation = $exchange->getTicker($tag, 'ST');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['GHP'])){ if (in_array(strtoupper($tag), ['GHP'])) {
$exchange = ExchangeFactory::createExchange("Zg"); $exchange = ExchangeFactory::createExchange("Zg");
$quotation = $exchange->getTicker($tag, 'CNZ'); $quotation = $exchange->getTicker($tag, 'CNZ');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['SFT'])){ if (in_array(strtoupper($tag), ['SFT'])) {
$exchange = ExchangeFactory::createExchange("Zhaobi"); $exchange = ExchangeFactory::createExchange("Zhaobi");
$quotation = $exchange->getTicker($tag, 'CNY'); $quotation = $exchange->getTicker($tag, 'CNY');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['CTG'])){ if (in_array(strtoupper($tag), ['CTG'])) {
$exchange = ExchangeFactory::createExchange("Gdpro"); $exchange = ExchangeFactory::createExchange("Gdpro");
$quotation = $exchange->getTicker($tag, 'CNY'); $quotation = $exchange->getTicker($tag, 'CNY');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['USDT'])){ if (in_array(strtoupper($tag), ['USDT'])) {
$exchange = ExchangeFactory::createExchange("Go"); $exchange = ExchangeFactory::createExchange("Go");
$quotation = $exchange->getTicker('CNY', 'USD'); $quotation = $exchange->getTicker('CNY', 'USD');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd; goto doEnd;
} }
if(in_array(strtoupper($tag),['SJPY'])){ if (in_array(strtoupper($tag), ['SJPY'])) {
$exchange = ExchangeFactory::createExchange("Boc"); $exchange = ExchangeFactory::createExchange("Boc");
$quotation = $exchange->getTicker('CNY', 'JPY'); $quotation = $exchange->getTicker('CNY', 'JPY');
$quotation = [ $quotation = [
'low' => (float)sprintf("%0.4f", $quotation['low']/100), 'low' => (float)sprintf("%0.4f", $quotation['low'] / 100),
'high' => (float)sprintf("%0.4f", $quotation['high']/100), 'high' => (float)sprintf("%0.4f", $quotation['high'] / 100),
'last' => (float)sprintf("%0.4f", $quotation['last']/100), 'last' => (float)sprintf("%0.4f", $quotation['last'] / 100),
'rmb' => (float)sprintf("%0.4f", $quotation['last']/100), 'rmb' => (float)sprintf("%0.4f", $quotation['last'] / 100),
]; ];
goto doEnd; goto doEnd;
} }
...@@ -187,7 +197,7 @@ class ExchangeBusiness ...@@ -187,7 +197,7 @@ class ExchangeBusiness
$exchange = ExchangeFactory::createExchange("Go"); $exchange = ExchangeFactory::createExchange("Go");
$rate = $exchange->getTicker("CNY", "USD"); $rate = $exchange->getTicker("CNY", "USD");
$rate = $rate['last'] ?? ''; $rate = $rate['last'] ?? '';
if(empty($rate)) { if (empty($rate)) {
$exchange = ExchangeFactory::createExchange("Bty"); $exchange = ExchangeFactory::createExchange("Bty");
$rate = $exchange->getTicker("BTY", "USDT"); $rate = $exchange->getTicker("BTY", "USDT");
$rate = (float)$rate['rmb'] / $rate['last']; $rate = (float)$rate['rmb'] / $rate['last'];
...@@ -240,12 +250,12 @@ class ExchangeBusiness ...@@ -240,12 +250,12 @@ class ExchangeBusiness
* @param array $condition 需要的币种sid列表 * @param array $condition 需要的币种sid列表
* @return array * @return array
*/ */
public static function getApiListForIndex($page = 1, $limit = 999, $condition = [], $fields=[]) public static function getApiListForIndex($page = 1, $limit = 999, $condition = [], $fields = [])
{ {
if(!$fields) { if (!$fields) {
$fields =['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain','address as contract_address', 'treaty']; $fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'];
} }
$rows = Coin::getSelectList($page, $limit, $fields,$condition); $rows = Coin::getSelectList($page, $limit, $fields, $condition);
$count = 0; $count = 0;
if (!empty($rows) && is_array($rows) && array_key_exists('count', $rows)) { if (!empty($rows) && is_array($rows) && array_key_exists('count', $rows)) {
$count = $rows['count']; $count = $rows['count'];
...@@ -257,7 +267,7 @@ class ExchangeBusiness ...@@ -257,7 +267,7 @@ class ExchangeBusiness
$quotation = self::getquatation($row['name']); $quotation = self::getquatation($row['name']);
if (!$quotation) { if (!$quotation) {
$quotation = []; $quotation = [];
if(in_array($row['name'], ['BTY', 'YCC'])){ if (in_array($row['name'], ['BTY', 'YCC'])) {
$coinServer = CoinFactory::createCoin($row['name'], $row['id'], $row['sid']); $coinServer = CoinFactory::createCoin($row['name'], $row['id'], $row['sid']);
$rows[$key]['sid'] = ucfirst($rows[$key]['sid']); $rows[$key]['sid'] = ucfirst($rows[$key]['sid']);
$rows[$key]['rmb'] = $coinServer->getPrice(); $rows[$key]['rmb'] = $coinServer->getPrice();
...@@ -297,7 +307,7 @@ class ExchangeBusiness ...@@ -297,7 +307,7 @@ class ExchangeBusiness
*/ */
public static function SearchByName($page = 1, $limit = 10, $condition = []) public static function SearchByName($page = 1, $limit = 10, $condition = [])
{ {
$rows = Coin::getSelectList($page, $limit, ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain','address as contract_address', 'treaty'], $rows = Coin::getSelectList($page, $limit, ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'],
$condition); $condition);
if ($rows['count'] > 0) { if ($rows['count'] > 0) {
$total = $rows['count']; $total = $rows['count'];
...@@ -305,7 +315,7 @@ class ExchangeBusiness ...@@ -305,7 +315,7 @@ class ExchangeBusiness
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
$rows[$key]['sid'] = ucfirst($rows[$key]['sid']); $rows[$key]['sid'] = ucfirst($rows[$key]['sid']);
$platform = strtoupper($rows[$key]['platform']); $platform = strtoupper($rows[$key]['platform']);
$platform_icon = Yii::$app->redis->hget('platform_image_info',$platform); $platform_icon = Yii::$app->redis->hget('platform_image_info', $platform);
$rows[$key]['platform_icon'] = $platform_icon ?? ''; $rows[$key]['platform_icon'] = $platform_icon ?? '';
} }
......
...@@ -10,7 +10,7 @@ class CoinAirDropTrade extends BaseActiveRecord ...@@ -10,7 +10,7 @@ class CoinAirDropTrade extends BaseActiveRecord
{ {
const TYPE_GAME = 1; const TYPE_GAME = 1;
const AMOUNT_GAME = 0.5; const AMOUNT_GAME = 0.0001;
public static function getDb() public static function getDb()
{ {
......
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