| xqd
@@ -22,13 +22,21 @@ class DynamicService
|
|
|
{
|
|
|
//话题列表
|
|
|
public function tag_list($keyword,$type=0){
|
|
|
- $data = DB::table("dynamic_tag")
|
|
|
- ->where("title","like","%{$keyword}%")
|
|
|
- ->where("type",$type)
|
|
|
+ $query = DB::table("dynamic_tag");
|
|
|
+ if(!empty($keyword)){
|
|
|
+ $query = $query->where("title","like","%{$keyword}%");
|
|
|
+ }
|
|
|
+ $query = $query->where("type",$type)
|
|
|
->orderBy("hot","desc")
|
|
|
->limit(20)
|
|
|
->get();
|
|
|
- return $data;
|
|
|
+// $data = DB::table("dynamic_tag")
|
|
|
+// ->where("title","like","%{$keyword}%")
|
|
|
+// ->where("type",$type)
|
|
|
+// ->orderBy("hot","desc")
|
|
|
+// ->limit(20)
|
|
|
+// ->get();
|
|
|
+ return $query;
|
|
|
}
|
|
|
|
|
|
/**
|