Commit 894eb0ac authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

多语言介绍 See merge request !116
parents f5224f88 e1039d5c
...@@ -131,7 +131,7 @@ class CoinController extends BaseController ...@@ -131,7 +131,7 @@ class CoinController extends BaseController
if ($recommend) { if ($recommend) {
$condition['recommend'] = $recommend; $condition['recommend'] = $recommend;
} }
$select = ['id', 'sid', 'icon', 'name', 'optional_name', 'nickname', 'platform', 'chain', 'treaty']; $select = ['id', 'sid', 'icon', 'name', 'introduce', 'optional_name', 'nickname', 'platform', 'chain', 'treaty'];
$order_by = ['sort' => SORT_ASC]; $order_by = ['sort' => SORT_ASC];
$datas = CoinRecommend::getList($page, $limit, $condition, $order_by, $select); $datas = CoinRecommend::getList($page, $limit, $condition, $order_by, $select);
//获取详细信息 //获取详细信息
...@@ -143,6 +143,8 @@ class CoinController extends BaseController ...@@ -143,6 +143,8 @@ class CoinController extends BaseController
foreach ($coin_infos as $key => &$val) { foreach ($coin_infos as $key => &$val) {
$nickname = json_decode($val['nickname'], true); $nickname = json_decode($val['nickname'], true);
$val['nickname'] = $nickname[$this->lang]; $val['nickname'] = $nickname[$this->lang];
$introduce = json_decode($val['introduce'], true);
$val['introduce'] = $introduce[$this->lang];
} }
//获取行情信息 //获取行情信息
$coin_names = array_column($coin_infos, 'name'); $coin_names = array_column($coin_infos, 'name');
...@@ -243,7 +245,9 @@ class CoinController extends BaseController ...@@ -243,7 +245,9 @@ class CoinController extends BaseController
} }
foreach ($result['data'] as $key => &$value) { foreach ($result['data'] as $key => &$value) {
$nickname = json_decode($value['nickname'], true); $nickname = json_decode($value['nickname'], true);
$introduce = json_decode($value['introduce'], true);
$value['nickname'] = $nickname[$this->lang]; $value['nickname'] = $nickname[$this->lang];
$value['introduce'] = $introduce[$this->lang];
$value['chain_quotation'] = $chain_quotation[$value['chain']] ?: null; $value['chain_quotation'] = $chain_quotation[$value['chain']] ?: null;
$value['chain_rmb'] = isset($value['chain_quotation']['rmb']) ? $value['chain_quotation']['rmb'] : 0; $value['chain_rmb'] = isset($value['chain_quotation']['rmb']) ? $value['chain_quotation']['rmb'] : 0;
$value['chain_usd'] = isset($value['chain_quotation']['usd']) ? $value['chain_quotation']['usd'] : 0; $value['chain_usd'] = isset($value['chain_quotation']['usd']) ? $value['chain_quotation']['usd'] : 0;
......
...@@ -92,7 +92,7 @@ class CoinController extends BaseController ...@@ -92,7 +92,7 @@ class CoinController extends BaseController
if (isset($data['optional_name'])) { if (isset($data['optional_name'])) {
$data['optional_name'] = strtoupper($data['optional_name']); $data['optional_name'] = strtoupper($data['optional_name']);
} }
$data['name'] = strtoupper($data['name']); $data['name'] = strtoupper(trim($data['name']));
$data['platform'] = strtolower($data['platform']); $data['platform'] = strtolower($data['platform']);
$data['chain'] = strtoupper($data['chain']); $data['chain'] = strtoupper($data['chain']);
$lang = [ $lang = [
...@@ -105,7 +105,7 @@ class CoinController extends BaseController ...@@ -105,7 +105,7 @@ class CoinController extends BaseController
$nickname = []; $nickname = [];
$introduce = []; $introduce = [];
foreach ($nickname_arr as $key => $val) { foreach ($nickname_arr as $key => $val) {
$nickname[$lang[$key]] = $val; $nickname[$lang[$key]] = trim($val);
} }
foreach ($introduce_arr as $key => $val) { foreach ($introduce_arr as $key => $val) {
$introduce[$lang[$key]] = $val; $introduce[$lang[$key]] = $val;
......
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