Commit bad3a2dd authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !456
parents eb4b001b afe18a74
......@@ -31,9 +31,8 @@ class TickerController extends BaseController
$exchange_arr = ['huobi', 'binance', 'zhaobi', 'bitnasdaq', 'jingwang'];
if (!in_array($exchange, $exchange_arr)) {
$msg = '不存在的交易平台';
$code = -1;
$data = [];
$this->msg = '不存在的交易平台';
$this->code = -1;
goto doEnd;
}
$condition = [];
......@@ -48,28 +47,28 @@ class TickerController extends BaseController
}
$builder = ExchangeBuilderFactory::create($exchange);
$result = $builder->getTickerFromCache($page, $condition);
$code = $result['code'];
$data = $result['data'];
$this->code = $result['code'];
$this->data = $result['data'];
if (false != $device_code) {
if (false != $platform_id) {
if (!$platform_id) {
$coin_optional = CoinOptional::find()->select('symbol')->where(['platform' => $exchange, 'device_code' => $device_code])->asArray()->all();
} else {
$coin_optional = CoinOptional::find()->select('symbol')->where(['platform' => $exchange, 'device_code' => $device_code, 'platform_id' => $platform_id])->asArray()->all();
}
$coin_optional = ArrayHelper::getColumn($coin_optional, 'symbol');
foreach ($data['ticker'] as &$val) {
foreach ($this->data['ticker'] as &$val) {
if (in_array($val['symbol'], $coin_optional)) {
$val['optional'] = true;
}
}
}
$msg = 'success';
$this->msg = 'success';
doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data];
return ['code' => $this->code, 'msg' => $this->msg, 'data' => $this->data];
}
public function actionOptional()
......
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