Commit 3b7f078a authored by ZhuChunYang's avatar ZhuChunYang

update

parent 6e3810bd
...@@ -87,18 +87,11 @@ class ServiceController extends BaseController ...@@ -87,18 +87,11 @@ class ServiceController extends BaseController
public function actionCoinIndex() public function actionCoinIndex()
{ {
$request = Yii::$app->request; //$request = Yii::$app->request;
$coinItems = $request->post('names',[]); //$coinItems = $request->post('names',[]);
$coin_recommendItems = $this->coinRecommendList(); $coin_recommendItems = $this->coinRecommendList();
$coinItems = array_merge($coinItems,$coin_recommendItems);
if(!$coinItems){
return ['code' => 1,'data' => [],'msg' => '币种不能为空'];
}
if(!is_array($coinItems)){
$coinItems = [$coinItems];
}
$fields =['id', 'sid', 'icon', 'name', 'nickname','chain']; $fields =['id', 'sid', 'icon', 'name', 'nickname','chain'];
$rows = Coin::getSelectList(1, 999, $fields,[['in','name',$coinItems]]); $rows = Coin::getSelectList(1, 999, $fields,[['in','id',$coin_recommendItems]]);
return ['code' => 0,'data' => $rows,'msg' => '币种列表获取成功']; return ['code' => 0,'data' => $rows,'msg' => '币种列表获取成功'];
} }
...@@ -107,8 +100,7 @@ class ServiceController extends BaseController ...@@ -107,8 +100,7 @@ class ServiceController extends BaseController
$recommend_list = CoinRecommend::find()->select('cid')->where(['platform_id' => 6 ])->all(); $recommend_list = CoinRecommend::find()->select('cid')->where(['platform_id' => 6 ])->all();
if($recommend_list){ if($recommend_list){
$coin_ids = array_column($recommend_list,'cid'); $coin_ids = array_column($recommend_list,'cid');
$coin_items = Coin::find()->select('name')->where(['in','id',$coin_ids])->all(); return $coin_ids;
return array_column($coin_items,'name');
} }
return []; return [];
} }
......
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