Commit a373bf13 authored by shajiaiming's avatar shajiaiming

fix

parent e09fb5b6
......@@ -34,37 +34,25 @@ class RecommendCoinController extends BaseController
$recommend_coin = WalletRecommendCoin::find()->where(['category_id' => $category['id']])->all();
$items = [];
foreach ($recommend_coin as $coin) {
$temp['id'] = $coin->coin['id'];
$temp['icon'] = $coin->coin['icon'];
$temp['name'] = $coin->coin['name'];
$temp['platform'] = $coin->coin['platform'];
$temp['chain'] = $coin->coin['chain'];
$temp['treaty'] = $coin->coin['treaty'];
$nickname = json_decode($coin->coin['nickname'], true);
$temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$introduce = json_decode($coin->coin['introduce'], true);
$temp['introduce'] = isset($introduce[$this->lang]) ? $introduce[$this->lang] : '';
array_push($items, $temp);
if (!empty($recommend_coin)) {
foreach ($recommend_coin as $coin) {
$temp['id'] = $coin->coin['id'];
$temp['icon'] = $coin->coin['icon'];
$temp['name'] = $coin->coin['name'];
$temp['platform'] = $coin->coin['platform'];
$temp['chain'] = $coin->coin['chain'];
$temp['treaty'] = $coin->coin['treaty'];
$nickname = json_decode($coin->coin['nickname'], true);
$temp['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$introduce = json_decode($coin->coin['introduce'], true);
$temp['introduce'] = isset($introduce[$this->lang]) ? $introduce[$this->lang] : '';
array_push($items, $temp);
}
}
$category['items'] = $items;
}
$this->data = $recommend_category[0]['items'];
// //获取行情信息
// $coin_names = array_column($result, 'name');
// $coin_names = array_merge($coin_names, array_column($result, 'chain'));
// $coin_quotations = ExchangeBusiness::getQuatationByNames($coin_names);
//
// $ticker = ['low' => 0, 'high' => 0, 'last' => 0, 'open' => 0, 'vol' => 0, 'rmb' => 0, 'usd' => 0];
// foreach ($result as $key => &$val) {
// $val['chain_quotation'] = isset($coin_quotations[strtoupper($val['chain'])]) ? $coin_quotations[strtoupper($val['chain'])] : [];
// $result[$key] = array_merge($val, isset($coin_quotations[strtoupper($val['name'])]) ? $coin_quotations[strtoupper($val['name'])] : $ticker);
// $val['chain_rmb'] = isset($val['chain_quotation']['rmb']) ? $val['chain_quotation']['rmb'] : 0;
// $val['chain_usd'] = isset($val['chain_quotation']['usd']) ? $val['chain_quotation']['usd'] : 0;
// }
//
// $this->data = $result;
doEnd :
return ['code' => $this->code, 'data' => $this->data, 'msg' => $this->msg];
......
......@@ -15,7 +15,7 @@ class WalletCoin extends BaseActiveRecord
public static function tableName()
{
return '{{wallet_coin}}';
return '{{coin}}';
}
public function attributes()
......
......@@ -19,6 +19,6 @@ class WalletRecommendCoin extends BaseActiveRecord
public function getCoin()
{
return $this->hasOne(WalletCoin::className(), ['id' => 'cid'])->select(['id', 'icon', 'name', 'introduce', 'nickname', 'platform', 'chain', 'treaty'])->asArray();
return $this->hasOne(Coin::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