Commit 94d69be5 authored by ZhuChunYang's avatar ZhuChunYang

update

parent fabc54f0
......@@ -70,7 +70,9 @@ class ServiceController extends BaseController
public function actionCoinIndex()
{
$request = Yii::$app->request;
$coinItems = $request->post('names');
$coinItems = $request->post('names',[]);
$coin_recommendItems = $this->coinRecommendList();
$coinItems = array_merge($coinItems,$coin_recommendItems);
if(!$coinItems){
return ['code' => 1,'data' => [],'msg' => '币种不能为空'];
}
......@@ -82,15 +84,14 @@ class ServiceController extends BaseController
return ['code' => 0,'data' => $rows,'msg' => '币种列表获取成功'];
}
public function actionCoinRecommendList()
private function coinRecommendList()
{
$recommend_list = CoinRecommend::find()->select('cid')->where(['platform_id' => 6 ])->all();
if($recommend_list){
$coin_ids = array_column($recommend_list,'cid');
$coin_items = Coin::find()->select('name')->where(['in','id',$coin_ids])->all();
$coin_names = array_column($coin_items,'name');
return ['code' => 0, 'data' => $coin_names, 'msg' => '推荐币种获取成功'];
return array_column($coin_items,'name');
}
return ['code' => 0, 'data' => [], 'msg' => '推荐币种获取成功'];
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