Commit 76f57275 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into develop

parents 58c9eac6 1124f57f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace api\controllers; namespace api\controllers;
use common\business\ExchangeBusiness; use common\business\ExchangeBusiness;
use common\models\psources\CoinSupportedChain;
use Yii; use Yii;
use api\base\BaseController; use api\base\BaseController;
use common\models\psources\WalletRecommendCoin; use common\models\psources\WalletRecommendCoin;
...@@ -39,7 +40,6 @@ class RecommendCoinController extends BaseController ...@@ -39,7 +40,6 @@ class RecommendCoinController extends BaseController
$temp['platform'] = $coin->coin['platform']; $temp['platform'] = $coin->coin['platform'];
$temp['chain'] = $coin->coin['chain']; $temp['chain'] = $coin->coin['chain'];
$temp['treaty'] = $coin->coin['treaty']; $temp['treaty'] = $coin->coin['treaty'];
$temp['exchange_id'] = $coin->coin['exchange_id'];
$nickname = json_decode($coin->coin['nickname'], true); $nickname = json_decode($coin->coin['nickname'], true);
$temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : ''; $temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$introduce = json_decode($coin->coin['introduce'], true); $introduce = json_decode($coin->coin['introduce'], true);
...@@ -92,6 +92,7 @@ class RecommendCoinController extends BaseController ...@@ -92,6 +92,7 @@ class RecommendCoinController extends BaseController
$category['name'] = isset($name[$this->lang]) ? $name[$this->lang] : ''; $category['name'] = isset($name[$this->lang]) ? $name[$this->lang] : '';
$recommend_coin = WalletRecommendCoin::find()->where(['category_id' => $category['id']])->all(); $recommend_coin = WalletRecommendCoin::find()->where(['category_id' => $category['id']])->all();
unset($category['id']);
$items = []; $items = [];
foreach ($recommend_coin as $coin) { foreach ($recommend_coin as $coin) {
$temp['icon'] = $coin->coin['icon']; $temp['icon'] = $coin->coin['icon'];
...@@ -99,7 +100,6 @@ class RecommendCoinController extends BaseController ...@@ -99,7 +100,6 @@ class RecommendCoinController extends BaseController
$temp['platform'] = $coin->coin['platform']; $temp['platform'] = $coin->coin['platform'];
$temp['chain'] = $coin->coin['chain']; $temp['chain'] = $coin->coin['chain'];
$temp['treaty'] = $coin->coin['treaty']; $temp['treaty'] = $coin->coin['treaty'];
$temp['exchange_id'] = $coin->coin['exchange_id'];
$nickname = json_decode($coin->coin['nickname'], true); $nickname = json_decode($coin->coin['nickname'], true);
$temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : ''; $temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$introduce = json_decode($coin->coin['introduce'], true); $introduce = json_decode($coin->coin['introduce'], true);
...@@ -108,8 +108,26 @@ class RecommendCoinController extends BaseController ...@@ -108,8 +108,26 @@ class RecommendCoinController extends BaseController
} }
$category['items'] = $items; $category['items'] = $items;
} }
$this->data = $recommend_category; $this->data = $recommend_category;
$supported_chain_model = CoinSupportedChain::find()->where(['platform_id' => $platform_id])->all();
$data = [];
if (false != $supported_chain_model) {
foreach ($supported_chain_model as $key => &$val) {
$data[$key]['icon'] = isset($val->coin->icon) ? $val->coin->icon : '';
$data[$key]['name'] = isset($val->coin->name) ? $val->coin->name : '';
$data[$key]['platform'] = isset($val->coin->platform) ? $val->coin->platform : '';
$data[$key]['chain'] = isset($val->coin->chain) ? $val->coin->chain : '';
$data[$key]['treaty'] = isset($val->coin->treaty) ? $val->coin->treaty : '';
$data[$key]['nickname'] = isset($val->coin->nickname[$this->lang]) ? $val->coin->nickname[$this->lang] : '';
$data[$key]['introduce'] = isset($val->coin->introduce[$this->lang]) ? $val->coin->introduce[$this->lang] : '';
}
$supported_chain = [
'name' => '主链',
'items' => $data
];
array_unshift($this->data, $supported_chain);
}
doEnd : doEnd :
return ['code' => $this->code, 'data' => $this->data, 'msg' => $this->msg]; return ['code' => $this->code, 'data' => $this->data, 'msg' => $this->msg];
} }
......
...@@ -33,15 +33,10 @@ class SupportedChainController extends BaseController ...@@ -33,15 +33,10 @@ class SupportedChainController extends BaseController
$data[$key]['name'] = isset($val->coin->name) ? $val->coin->name : ''; $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]['nickname'] = isset($val->coin->nickname[$this->lang]) ? $val->coin->nickname[$this->lang] : '';
$data[$key]['chain'] = isset($val->coin->chain) ? $val->coin->chain : ''; $data[$key]['chain'] = isset($val->coin->chain) ? $val->coin->chain : '';
$data[$key]['platform'] = isset($val->coin->platform) ? $val->coin->platform : ''; $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]['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]['rmb'] = 0;
$data[$key]['usd'] = 0; $data[$key]['usd'] = 0;
......
...@@ -46,7 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord ...@@ -46,7 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord
public function getCoin() public function getCoin()
{ {
return $this->hasOne(Coin::className(), ['id' => 'coin_id']) return $this->hasOne(WalletCoin::className(), ['id' => 'coin_id'])
->select('id, sid, icon, name, introduce, optional_name, nickname, platform, chain, treaty'); ->select('id, icon, name, introduce, nickname, platform, chain, treaty');
} }
} }
...@@ -19,6 +19,6 @@ class WalletRecommendCoin extends BaseActiveRecord ...@@ -19,6 +19,6 @@ class WalletRecommendCoin extends BaseActiveRecord
public function getCoin() public function getCoin()
{ {
return $this->hasOne(WalletCoin::className(), ['id' => 'cid'])->select(['id', 'icon', 'name', 'introduce', 'nickname', 'platform', 'chain', 'treaty', 'exchange_id'])->asArray(); return $this->hasOne(WalletCoin::className(), ['id' => 'cid'])->select(['id', 'icon', 'name', 'introduce', 'nickname', 'platform', 'chain', 'treaty'])->asArray();
} }
} }
\ 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