Commit afe18a74 authored by shajiaiming's avatar shajiaiming

fix

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