Commit c843cbbd authored by shajiaiming's avatar shajiaiming

fix

parent 26b68b3f
......@@ -15,6 +15,26 @@ class BaseController extends Controller
public $start;
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
* @return bool
......
......@@ -71,6 +71,12 @@ class CoinController extends BaseController
}
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce'];
$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) {
$response_->build(ResponseBuild::STATUS_SUCCEED, '', $result['data']);
} 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