Commit c06b4019 authored by shajiaiming's avatar shajiaiming

fix

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