wesmiler 5 gadi atpakaļ
vecāks
revīzija
e451e4dfef

+ 1 - 2
app/index/controller/IndexController.php

@@ -142,7 +142,7 @@ class IndexController extends HomeBaseController
         $jmMessages = MessageService::getList(['type'=> 1], 10);
         $jmMessages = MessageService::getList(['type'=> 1], 10);
 
 
         // 友情链接
         // 友情链接
-        $links = LinkService::getList([], 24);
+        $links = LinkService::getList(['catname'=> 'index'], 50);
 
 
         // 新增
         // 新增
         $this->assign('banner',$banner);
         $this->assign('banner',$banner);
@@ -186,7 +186,6 @@ class IndexController extends HomeBaseController
         $this->assign('phb3',$phb3);
         $this->assign('phb3',$phb3);
         // end
         // end
 
 
-        $this->assign('link_cate_name','index');
         return $this->fetch();
         return $this->fetch();
     }
     }
 
 

+ 5 - 1
app/index/controller/NewsController.php

@@ -2,6 +2,7 @@
 namespace app\index\controller;
 namespace app\index\controller;
 use app\index\service\CategoryService;
 use app\index\service\CategoryService;
 use app\index\service\JiamengService;
 use app\index\service\JiamengService;
+use app\index\service\LinkService;
 use app\index\service\NewsCategoryService;
 use app\index\service\NewsCategoryService;
 use app\index\service\NewsService;
 use app\index\service\NewsService;
 use cmf\controller\HomeBaseController;
 use cmf\controller\HomeBaseController;
@@ -158,6 +159,9 @@ class NewsController extends HomeBaseController
 
 
         $newsHot = NewsService::getHotList();
         $newsHot = NewsService::getHotList();
 
 
+        // 友情链接
+        $links = LinkService::getList(['catname'=> 'news'], 50);
+
         $this->assign('news1',$lists);
         $this->assign('news1',$lists);
         $this->assign('data',$lists? $lists->toArray(): ['total'=>0]);
         $this->assign('data',$lists? $lists->toArray(): ['total'=>0]);
         $this->assign('page',$lists->render());
         $this->assign('page',$lists->render());
@@ -166,7 +170,7 @@ class NewsController extends HomeBaseController
         $this->assign('cate_list',$cate_list? array_chunk($cate_list, 6) : []);
         $this->assign('cate_list',$cate_list? array_chunk($cate_list, 6) : []);
         $this->assign('paihang',$paihang);
         $this->assign('paihang',$paihang);
         $this->assign('catinfo',$catinfo);
         $this->assign('catinfo',$catinfo);
-        $this->assign('link_cate_name','news');
+        $this->assign('links',$links);
 
 
         //seo
         //seo
         $seo_title = $catinfo['seo_title'];
         $seo_title = $catinfo['seo_title'];

+ 6 - 0
app/index/service/LinkService.php

@@ -20,6 +20,12 @@ class LinkService
     public static function getList($params, $num=6, $field=''){
     public static function getList($params, $num=6, $field=''){
         $field = $field? $field : 'id,name,catname,url,image,target';
         $field = $field? $field : 'id,name,catname,url,image,target';
         return Db::name('link')->where(['status'=> 1])
         return Db::name('link')->where(['status'=> 1])
+            ->where(function($query) use($params){
+                $catname = isset($params['catname'])? : '';
+                if($catname){
+                    $query->where('catname', $catname);
+                }
+            })
             ->field($field)
             ->field($field)
             ->order('list_order')
             ->order('list_order')
             ->limit($num)
             ->limit($num)

+ 3 - 0
public/themes/mjmls/index/block/footer.html

@@ -1,3 +1,6 @@
+<!-- 友情链接 -->
+<include file="block/link" />
+
 <!-- footer start-->
 <!-- footer start-->
 <div class="online-box mob_none">
 <div class="online-box mob_none">
     <div class="container">
     <div class="container">

+ 2 - 0
public/themes/mjmls/index/block/footer_new.html

@@ -1,3 +1,5 @@
+<!-- 友情链接 -->
+<include file="block/link" />
 
 
 <!-- footer start-->
 <!-- footer start-->
 <div class="online-box mob_none">
 <div class="online-box mob_none">

+ 3 - 0
public/themes/mjmls/index/block/footer_xm.html

@@ -1,3 +1,6 @@
+<!-- 友情链接 -->
+<include file="block/link" />
+
 <!-- footer start-->
 <!-- footer start-->
 <div class="online-box mob_none">
 <div class="online-box mob_none">
     <div class="container">
     <div class="container">

+ 3 - 1
public/themes/mjmls/index/block/link.html

@@ -1,3 +1,4 @@
+<if condition="$links">
 <div class="linkCon">
 <div class="linkCon">
     <div class="container">
     <div class="container">
         <h2>友情链接</h2>
         <h2>友情链接</h2>
@@ -7,4 +8,5 @@
             </foreach>
             </foreach>
         </ul>
         </ul>
     </div>
     </div>
-</div>
+</div>
+</if>

+ 1 - 2
public/themes/mjmls/index/index/index.html

@@ -41,8 +41,7 @@
 
 
 <!-- content over -->
 <!-- content over -->
 
 
-<!-- 友情链接 -->
-<include file="block/link" />
+
 
 
 <!-- 页脚 -->
 <!-- 页脚 -->
 <include file="block/footer" />
 <include file="block/footer" />