Commit f74553c1 authored by ZhuChunYang's avatar ZhuChunYang

添加热门搜索接口

parent f7fd62cb
......@@ -167,4 +167,21 @@ class ApplicationController extends BaseController
return ['code' => 0,'data' => []];
}
/**
* @return array
* 获取热门搜索
*/
public function actionGetHotSearch()
{
$redis = Yii::$app->redis_app;
$data = $redis->zrange('application_hot_search',0,-1);
$search_data = [];
foreach($data as $value){
$item['name'] = $value;
$item['sort'] = $redis->zscore('application_hot_search',$value);
$search_data[] = $item;
}
return [ 'code' => 0,'data' => $search_data];
}
}
\ No newline at end of file
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