Commit c06b4019 authored by shajiaiming's avatar shajiaiming

fix

parent dcad4dcc
...@@ -24,30 +24,28 @@ class RecommendCoinController extends BaseController ...@@ -24,30 +24,28 @@ class RecommendCoinController extends BaseController
goto doEnd; goto doEnd;
} }
$this->data = []; $this->data = [];
foreach ($recommend_coins as $coin) { foreach ($recommend_coins as $coin) {
//$this->data[$coin->coin[0]['chain']] = $coin->coin; $recommend_coin_info = [
$this->data = array_merge($this->data, $coin->coin); 'recommend' => $coin->recommend,
'sort' => $coin->sort,
'type' => $coin->type,
];
$this->data = array_merge($this->data, [array_merge($coin->coin[0], $recommend_coin_info)]);
} }
echo json_encode($this->data);
exit;
$chains = array_column($this->data, 'chain'); $chains = array_column($this->data, 'chain');
$symbol = array_column($this->data, 'name'); $symbol = array_column($this->data, 'name');
$name = array_keys(array_flip($chains) + array_flip($symbol)); $chains_symbols = array_keys(array_flip($chains) + array_flip($symbol));
echo json_encode($name); $coin_quotations = ExchangeBusiness::getQuatationByNames($chains_symbols);
exit;
$coin_quotations = ExchangeBusiness::getQuatationByNames($chains); foreach ($this->data as $key => &$val) {
$val['chain_quotation'] = $coin_quotations[strtoupper($val['chain'])];
$i = 0; $nickname = json_decode($val['nickname'], true);
foreach ($coin_quotations as $key => $val) { $val['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : '';
$nickname = json_decode($this->data[$i]['nickname'], true); $introduce = json_decode($val['introduce'], true);
$this->data[$i]['nickname'] = isset($nickname[$this->lang]) ? $nickname[$this->lang] : ''; $val['introduce'] = isset($introduce[$this->lang]) ? $introduce[$this->lang] : '';
$introduce = json_decode($this->data[$i]['introduce'], true); $this->data[$key] = array_merge($val, $coin_quotations[strtoupper($val['name'])]);
$this->data[$i]['introduce'] = isset($introduce[$this->lang]) ? $introduce[$this->lang] : '';
$this->data[$i]['chain_quotation'] = $val;
foreach ($val as $key => $cloumn) {
$this->data[$i][$key] = $cloumn;
}
$i++;
} }
doEnd : doEnd :
......
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