Bladeren bron

单位招聘热门关键字,后台可修改

linwu 1 jaar geleden
bovenliggende
commit
0f03359ec1

+ 8 - 4
app/Admin/Controllers/System/HotwordController.php

@@ -89,8 +89,10 @@ class HotwordController extends Controller
                 return '企业搜索';
             } elseif ($this->type == '3') {
                 return '个人简历搜索';
-            } else {
+            } elseif ($this->type == '1') {
                 return '职位搜索';
+            } else {
+                return '资讯搜索';
             }
         });
         $grid->w_hot('搜索次数')->width(200);
@@ -139,8 +141,10 @@ class HotwordController extends Controller
                 return '企业搜索';
             } elseif ($type == 3) {
                 return '个人简历搜索';
-            } else {
+            } elseif ($type == 1) {
                 return '职位搜索';
+            } else {
+                return '资讯搜索';
             }
         });
         $show->w_hot('搜索次数');
@@ -177,7 +181,7 @@ class HotwordController extends Controller
             'required',
         ])->setWidth(3)->setMustMark();
         //搜索类型
-        $type_arr = ['1'=>'职位搜索','2'=>'企业搜索','3'=>'个人简历搜索'];
+        $type_arr = ['1'=>'职位搜索','2'=>'企业搜索','3'=>'个人简历搜索','4'=>'资讯搜索'];
         $form->select('type', '搜索类型')
             ->options($type_arr)
             ->rules('required', array('required'=>'请选择搜索类型。'))
@@ -195,7 +199,7 @@ class HotwordController extends Controller
             'required',
         ])->setWidth(3)->setMustMark();
         //搜索类型
-        $type_arr = ['1'=>'职位搜索','2'=>'企业搜索','3'=>'个人简历搜索'];
+        $type_arr = ['1'=>'职位搜索','2'=>'企业搜索','3'=>'个人简历搜索','4'=>'资讯搜索'];
         $form->select('type', '搜索类型')
              ->options($type_arr)
              ->default(key($type_arr))

+ 8 - 1
app/Http/Controllers/Web/Content/ArticleController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers\Web\Content;
 
 use App\Http\Controllers\Web\WebBaseController;
+use App\Services\Common\HotWordService;
 use App\Services\Content\ArticleService;
 use App\Services\Content\ArticleCategoryService;
 use App\Services\Content\AdService;
@@ -18,18 +19,20 @@ class ArticleController extends WebBaseController
     protected $articleCategoryService;
     protected $adService;
     protected $navigationService;
+    protected $hotWordService;
 
     /**
      * ArticleController constructor.
      * @param $articleService
      * @param $articleCategoryService
      */
-    public function __construct(ArticleService $articleService, ArticleCategoryService $articleCategoryService, AdService $adService, NavigationService $navigationService)
+    public function __construct(ArticleService $articleService, ArticleCategoryService $articleCategoryService, AdService $adService, NavigationService $navigationService, HotWordService $hotWordService)
     {
         $this->articleService         = $articleService;
         $this->articleCategoryService = $articleCategoryService;
         $this->adService              = $adService;
         $this->navigationService      = $navigationService;
+        $this->hotWordService         = $hotWordService;
     }
 
     public function index(Request $request, $id = '57', $num = '8', $focus = '3', $recommend = '4', $other_num = '5')
@@ -110,6 +113,9 @@ class ArticleController extends WebBaseController
         }
         $this->putSeoData('article_cate', $article_cate);
 
+        //热词
+        $hotWords = $this->hotWordService->getHotWords(['type' => 4], 'list_order desc,w_hot desc', 10);    //热门关键词
+
         $return_data = [
             'articles'           => $lists,
             'categorys'          => $categorys,
@@ -121,6 +127,7 @@ class ArticleController extends WebBaseController
             'now_cate'           => $now_cate,
             'categorys_child'    => $categorys_child,
             'bread'              => $bread,
+            'hotwords'           => $hotWords,
         ];
 
         return view('app.content.article.list', $return_data);

+ 2 - 0
public/themes/default/assets/app/css/article/article.css

@@ -161,6 +161,8 @@
 .new-se-group .new-se-main .ip-group{margin:0 auto;background:#FFF;height:45px;width:770px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;*zoom:1;}
 .new-se-group .new-se-main .ip-box{float:left;padding-top:7px;width:626px;padding-left:17px;*zoom:1;}
 .new-se-main .ip-box input{width:616px;height:28px;line-height:36px;border:0px;}
+.new-se-main .hotword{margin: 15px auto 0 auto;color: #ffffff;overflow: hidden;width: 770px;}
+.new-se-main .hotword a{color:#ffffff;padding-right: 15px;}
 .new-se-group .new-se-main .ip-btn{float:left;width:127px;height:45px;}
 .new-se-main .ip-btn input{background-color:#1d7ad9;font-size:18px;text-align:center;width:127px;height:45px;line-height:45px;border:0px;color:#FFFFFF;cursor:pointer;border-radius:0px 3px 3px 0px;}
 .new-se-main .ip-btn input.hover{background:#1d7ad9;}

+ 9 - 0
public/themes/default/views/app/content/article/list.blade.php

@@ -24,6 +24,15 @@
                     <div class="clear"></div>
                 </div>
             </form>
+
+            @if($hotwords)
+                <div class="hotword link_gray9 font_gray9 nowrap" id="job_hotword">
+                    热门关键字:
+                    @foreach($hotwords as $k => $v)
+                        <a href='{{route('news.list',['id'=>$type_id])}}?key={{$v["w_word"]}}'>{{$v['w_word']}}</a>
+                    @endforeach
+                </div>
+            @endif
         </div>
     </div>