Commit 059683b0 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/issue_coin' into 'master'

Feature/issue coin See merge request !305
parents 441d81f2 c5f256e6
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace api\controllers; namespace api\controllers;
use common\business\ExchangeBusiness;
use Yii; use Yii;
use api\base\BaseController; use api\base\BaseController;
use common\models\psources\CoinSupportedChain; use common\models\psources\CoinSupportedChain;
...@@ -28,9 +29,29 @@ class SupportedChainController extends BaseController ...@@ -28,9 +29,29 @@ class SupportedChainController extends BaseController
} }
$data = []; $data = [];
foreach ($supported_chain_model as $key => &$val) { foreach ($supported_chain_model as $key => &$val) {
$data[$key]['chain'] = isset($val->coin->chain) ? $val->coin->chain : ''; $data[$key]['id'] = isset($val->coin->id) ? $val->coin->id : '';
$data[$key]['name'] = isset($val->coin->name) ? $val->coin->name : '';
$data[$key]['icon'] = isset($val->coin->icon) ? $val->coin->icon : ''; $data[$key]['icon'] = isset($val->coin->icon) ? $val->coin->icon : '';
$data[$key]['name'] = isset($val->coin->name) ? $val->coin->name : ''; $data[$key]['name'] = isset($val->coin->name) ? $val->coin->name : '';
$data[$key]['sid'] = isset($val->coin->sid) ? $val->coin->sid : '';
$data[$key]['nickname'] = isset($val->coin->nickname[$this->lang]) ? $val->coin->nickname[$this->lang] : '';
$data[$key]['chain'] = isset($val->coin->chain) ? $val->coin->chain : '';
$data[$key]['platform'] = isset($val->coin->platform) ? $val->coin->platform : '';
$data[$key]['sort'] = isset($val->coin->sort) ? $val->coin->sort : 0;
$data[$key]['treaty'] = isset($val->coin->treaty) ? $val->coin->treaty : '';
$data[$key]['optional_name'] = isset($val->coin->optional_name) ? $val->coin->optional_name : '';
$data[$key]['rmb'] = 0;
$data[$key]['usd'] = 0;
$ticker = ExchangeBusiness::getquatation($val->coin->name);
if (false != $ticker) {
$data[$key]['rmb'] = $ticker['rmb'];
$data[$key]['usd'] = $ticker['usd'];
}
} }
$msg = 'success'; $msg = 'success';
$code = 0; $code = 0;
......
...@@ -46,6 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord ...@@ -46,6 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord
public function getCoin() public function getCoin()
{ {
return $this->hasOne(Coin::className(), ['id' => 'coin_id'])->select('name, chain, icon'); return $this->hasOne(Coin::className(), ['id' => 'coin_id'])
->select('id, sid, icon, name, introduce, optional_name, nickname, platform, chain, treaty');
} }
} }
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