Commit 1b737475 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/ticker' into 'master'

fix See merge request !253
parents 26b68b3f c843cbbd
...@@ -15,6 +15,26 @@ class BaseController extends Controller ...@@ -15,6 +15,26 @@ class BaseController extends Controller
public $start; public $start;
public $end; public $end;
public $header_list = [];
public $lang;
private static $default_header_list = [];
public function init()
{
if ('cli' !== php_sapi_name()) {
$this->header_list = self::$default_header_list;
$this->fzmCrossHeader();
}
}
public function fzmCrossHeader()
{
$this->lang = \Yii::$app->request->headers->get('lang') ?? 'zh-CN';
if ('en' == strtolower($this->lang)) {
$this->lang = 'en-US';
}
}
/** /**
* @param $action * @param $action
* @return bool * @return bool
......
...@@ -71,6 +71,12 @@ class CoinController extends BaseController ...@@ -71,6 +71,12 @@ class CoinController extends BaseController
} }
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce']; $fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce'];
$result = ExchangeBusiness::getApiListForIndex(1, 999, $condition, $fields); $result = ExchangeBusiness::getApiListForIndex(1, 999, $condition, $fields);
foreach ($result['data'] as $key => &$val) {
$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] : '';
}
if ($result) { if ($result) {
$response_->build(ResponseBuild::STATUS_SUCCEED, '', $result['data']); $response_->build(ResponseBuild::STATUS_SUCCEED, '', $result['data']);
} else { } else {
......
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