Commit 2b8fd3a5 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !308
parents 22a47a6e e954209e
......@@ -41,17 +41,11 @@ class WalletCoinController extends BaseController
}
$this->data = [];
$relation_model = WalletCoinRelation::find()->select('coin_id')->where(['platform_id' => (int)$platform_id])->asArray()->all();
if (empty($relation_model)) {
goto doEnd;
}
$relation_ids = array_column($relation_model, 'coin_id');
foreach ($condition as $val) {
if (is_array($val)) {
$model = WalletCoin::find()->select('id,icon,name,nickname,introduce,platform,chain,address as contract_address,treaty')
->where(['name' => $val[0], 'platform' => $val[1]])
->andWhere(['in', 'id', $relation_ids])
->andWhere(['>', "find_in_set($platform_id, platform_id)", 0])
->asArray()
->one();
}
......@@ -59,7 +53,7 @@ class WalletCoinController extends BaseController
if (is_string($val)) {
$model = WalletCoin::find()->select('id,icon,name,nickname,introduce,platform,chain,address as contract_address,treaty')
->where(['name' => $val])
->andWhere(['in', 'id', $relation_ids])
->andWhere(['>', "find_in_set($platform_id, platform_id)", 0])
->asArray()
->one();
}
......@@ -129,15 +123,9 @@ class WalletCoinController extends BaseController
$page = empty($params['page']) ? 1 : $params['page'];
$limit = empty($params['limit']) ? 10 : $params['limit'];
$relation_model = WalletCoinRelation::find()->select('coin_id')->where(['platform_id' => (int)$platform_id])->asArray()->all();
if (empty($relation_model)) {
goto doEnd;
}
$relation_ids = array_column($relation_model, 'coin_id');
$query = WalletCoin::find()
->select('id, icon, name, nickname, platform, chain, address as contract_address, treaty')
->where(['in', 'id', $relation_ids])
->where(['>', "find_in_set($platform_id, platform_id)", 0])
->orderBy('id');
if (false != $chain) {
......@@ -187,12 +175,14 @@ class WalletCoinController extends BaseController
$this->msg = '参数错误';
goto doEnd;
}
$relation = WalletCoinRelation::find()->where(['coin_id' => $id, 'platform_id' => (int)$platform_id])->one();
if (empty($relation)) {
$this->data = WalletCoin::find()
->where(['id' => $id])
->andWhere(['>', "find_in_set($platform_id, platform_id)", 0])
->one();
if (empty($this->data)) {
goto doEnd;
}
$this->data = $relation->coin;
$quotation = ExchangeBusiness::getquatation($this->data->name);
$tikerdata = [
'publish_count' => $this->data->publish_count,
......
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