wesmiler 5 år sedan
förälder
incheckning
d76f9f2c2e

+ 43 - 0
app/index/controller/IndexController.php

@@ -8,6 +8,7 @@ use app\index\service\LinkService;
 use app\index\service\MessageService;
 use app\index\service\NewsCategoryService;
 use app\index\service\NewsService;
+use app\index\service\RedisService;
 use cmf\controller\HomeBaseController;
 use think\Db;
 
@@ -140,6 +141,9 @@ class IndexController extends HomeBaseController
         $links = LinkService::getList([], 24);
 
 
+        // 获取热门分类
+        $hotCateList = CategoryService::getHotCates(10);
+
         // 新增
         $this->assign('banner',$banner);
         $this->assign('banner1',$banner1);
@@ -164,6 +168,7 @@ class IndexController extends HomeBaseController
         $this->assign('jmMessages',$jmMessages);
         $this->assign('courseList',$courseList);
         $this->assign('recCates',$recCates);
+        $this->assign('hotCateList',$hotCateList);
         $this->assign('links',$links);
 
         // 品牌
@@ -224,5 +229,43 @@ class IndexController extends HomeBaseController
             $this->error('投诉提交失败');
         }
     }
+
+    /**
+     * 网站地图
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function sitemap(){
+        $result = [];
+        $page = input('p', 1);
+        $cacheKey = 'sitemap:list_';
+        $datas = RedisService::get($cacheKey.$page);
+        if(empty($datas) || 1){
+            $dataList = CategoryService::getCates(500, -1, "enname as id, catname as title, '1' as 'type'");
+            $dataList = $dataList? $dataList->toArray() : [];
+            $brands = JiamengService::getList([], "j.id,j.title, '2' as 'type'", 1000);
+            $brands = $brands? $brands->toArray() : [];
+            $news = NewsService::getList([], 1000,"id,title, '3' as 'type'");
+            $news= $news? $news->toArray() : [];
+            $dataList = isset($brands['data']) && $brands['data']? array_merge($dataList, $brands['data']) : $dataList;
+            $dataList = isset($news['data']) && $news['data']? array_merge($dataList, $news['data']) : $dataList;
+            $result = $dataList? array_chunk($dataList, 500) : [];
+            if($result){
+                foreach ($result as $k => $list){
+                    RedisService::set($cacheKey.($k+1), $dataList, 7*3600);
+                }
+                $datas = isset($result[$page-1])? $result[$page-1] : [];
+            }
+        }
+
+        $nextPage = $page+1;
+        $this->assign('datas', $datas);
+        $this->assign('lastPage', $page-1>0? ($page-1) : 1);
+        $this->assign('nextPage', RedisService::get($cacheKey.$nextPage)? $nextPage : 0);
+        return $this->fetch('../sitemap');
+
+    }
 }
 ?>

+ 4 - 0
app/index/controller/JiamengController.php

@@ -27,6 +27,10 @@ class JiamengController extends HomeBaseController
         return $this->fetch();
     }
 
+    public function category(){
+        return $this->fetch();
+    }
+
     /**
      * 列表
      * @return mixed

+ 36 - 3
app/index/service/CategoryService.php

@@ -80,10 +80,15 @@ class CategoryService
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function getCates($num=30, $pid=0){
+    public static function getCates($num=30, $pid=0, $field=''){
+        $field = $field? $field : 'id,catname,enname';
         return Db::name('category')
-            ->where('parent_id',$pid)
-            ->field('id,catname,enname')
+            ->where(function($query) use ($pid){
+                if($pid>=0){
+                    $query->where('parent_id', $pid);
+                }
+            })
+            ->field($field)
             ->order('list_order')
             ->limit($num)
             ->select();
@@ -114,4 +119,32 @@ class CategoryService
                 return $item;
             });
     }
+
+    /**
+     * 获取推荐分类列表以及子类列表
+     * @param int $num 主分类
+     * @return $this
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function getHotCates($num=6){
+        $catIds = Db::name('jiameng')
+            ->where('status',1)
+            ->order(db()->raw("sum('hits')"))
+            ->limit($num)
+            ->group('catid')
+            ->column('catid');
+
+        if(empty($catIds)){
+            return false;
+        }
+        return Db::name('category')
+            ->whereIn('id',$catIds)
+            ->field('id,catname,enname')
+            ->order('list_order')
+            ->limit($num)
+            ->select();
+
+    }
 }

+ 1 - 1
app/index/service/JiamengService.php

@@ -119,7 +119,7 @@ class JiamengService
             })
             ->order('j.list_order')
             ->paginate($pageSize, false, ['query' => $pageParams]);
-        //echo Db::name('jiameng')->getLastSql();
+        // echo Db::name('jiameng')->getLastSql();
         return $dataList;
     }
 

+ 1 - 0
data/route/route.php

@@ -23,6 +23,7 @@
         '/news/level-:id.shtml' => 'index/news/lists',
         '/know/detail/:id' => 'index/know/show',
         'top10/:catname' => 'index/top10/cate',
+        '/sitemap.shtml' => 'index/index/sitemap',
     );
 
 ?>

+ 0 - 107
public/sitemap.html

@@ -1,107 +0,0 @@
-<html>
-<head>
-    <title>网站地图</title>
-    <meta charset="UTF-8">
-    <link href="/static/css/sitemap.css" rel="stylesheet">
-</head>
-<body><a href="http://www.kxdw.com/sitemap/sitemap_1.html">1</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_2.html">2</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_3.html">3</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_4.html">4</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_5.html">5</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_6.html">6</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_7.html">7</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_8.html">8</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_9.html">9</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_10.html">10</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_11.html">11</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_12.html">12</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_13.html">13</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_14.html">14</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_15.html">15</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_16.html">16</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_17.html">17</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_18.html">18</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_19.html">19</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_20.html">20</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_21.html">21</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_22.html">22</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_23.html">23</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_24.html">24</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_25.html">25</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_26.html">26</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_27.html">27</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_28.html">28</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_29.html">29</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_30.html">30</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_31.html">31</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_32.html">32</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_33.html">33</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_34.html">34</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_35.html">35</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_36.html">36</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_37.html">37</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_38.html">38</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_39.html">39</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_40.html">40</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_41.html">41</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_42.html">42</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_43.html">43</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_44.html">44</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_45.html">45</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_46.html">46</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_47.html">47</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_48.html">48</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_49.html">49</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_50.html">50</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_51.html">51</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_52.html">52</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_53.html">53</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_54.html">54</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_55.html">55</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_56.html">56</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_57.html">57</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_58.html">58</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_59.html">59</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_60.html">60</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_61.html">61</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_62.html">62</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_63.html">63</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_64.html">64</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_65.html">65</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_66.html">66</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_67.html">67</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_68.html">68</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_69.html">69</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_70.html">70</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_71.html">71</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_72.html">72</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_73.html">73</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_74.html">74</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_75.html">75</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_76.html">76</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_77.html">77</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_78.html">78</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_79.html">79</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_80.html">80</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_81.html">81</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_82.html">82</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_83.html">83</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_84.html">84</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_85.html">85</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_86.html">86</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_87.html">87</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_88.html">88</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_89.html">89</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_90.html">90</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_91.html">91</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_92.html">92</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_93.html">93</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_94.html">94</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_95.html">95</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_96.html">96</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_97.html">97</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_98.html">98</a>
-<a href="http://www.kxdw.com/sitemap/sitemap_99.html">99</a>
-</body>
-</html>

+ 1 - 1
public/static/css/sitemap.css

@@ -1,2 +1,2 @@
 a {   text-decoration: none;   cursor: pointer;   color: #333;}
-a {    float: left;    width: 93px;   height: 32px;   line-height: 32px;   background: #fff;   border: 1px solid #ddd;   text-align: center;   color: #565656;   font-size: 14px;   margin: 12px 13px 0 0;   cursor: pointer;}
+a {    float: left;    width: 93px;   height: 32px;   line-height: 32px;   background: #fff;   border: 1px solid #ddd;   text-align: center;   color: #565656;   font-size: 14px;   margin: 12px 13px 0 0;   cursor: pointer;    overflow: hidden;}

+ 1 - 1
public/themes/mjmls/index/block/footer.html

@@ -12,7 +12,7 @@
             <li><a href="/about/zhaopin.html" target="_blank">招商服务</a></li>
             <li><a href="/about/tousu.html" target="_blank">投诉删除</a></li>
             <li><a href="/about/statement.html" target="_blank">免责声明</a></li>
-            <li><a href="/sitemap.html" target="_blank">网站地图</a></li>
+            <li><a href="/sitemap.shtml" target="_blank">网站地图</a></li>
 
         </ul>
         <div class="ftlx-box">

+ 52 - 9
public/themes/mjmls/index/block/nav.html

@@ -1,13 +1,56 @@
 <!-- mobile-nav -->
 <nav class="mob-navigation pc_show">
-    <i class="fa fa-remove"></i>
-    <ul>
-        <li><a href="/">网站首页</a></li>
-        <li><a href="/top10/">品牌大全</a></li>
-        <li><a href="/news/">创业资讯</a></li>
-        <li><a href="/listhyzx/">行业资讯</a></li>
-        <li><a href="/listxinwen/">品牌动态</a></li>
-        <li><a href="/xmk/">项目资讯</a></li>
-    </ul>
+    <header class="w-header">
+        <div class="w-header-left">
+            <a class="home"></a>
+        </div>
+        <div class="w-header-logo">
+            加盟行业导航
+        </div>
+        <div class="w-header-right">
+            <a class="home"></a>
+        </div>
+    </header>
+    <div class="trade-nav">
+        <div class="trade-nav-l">
+            <ul>
+                <li class="on">热门行业</li>
+                <foreach name="catearr" id="v">
+                    <li class="cate_{$v.id}">{$v.catname}</li>
+                </foreach>
+            </ul>
+        </div>
+        <div class="trade-nav-r">
+            <div class="trade-list-box on">
+                <div class="swiper-img-list">
+                    <div class="trade-box">
+                        <p class="trade-title">热门行业</p>
+                        <div class="trade-list">
+                            <foreach name="hotCateList" id="v">
+                                <a href="/xm{$v.enname}/">{$v.catname}</a>
+                            </foreach>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <foreach name="catearr" id="v">
+                <div class="trade-list-box">
+                    <div class="swiper-img-list">
+                        <div class="trade-box">
+                            <p class="trade-title"><a href="/xm{$v.enname}/">所有{$v.catname}项目></a></p>
+                            <if condition="v.sonData">
+                                <div class="trade-list">
+                                    <foreach name="v.sonData" id="v1">
+                                    <a href="/xm{$v1.enname}/">{$v1.catname}</a>
+                                    </foreach>
+                                </div>
+                            </if>
+                        </div>
+                    </div>
+                </div>
+            </foreach>
+        </div>
+    </div>
+
 </nav>
 <!-- ./ mobile nav end -->

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 198 - 0
public/themes/mjmls/index/jiameng/category.html


+ 43 - 0
public/themes/mjmls/sitemap.html

@@ -0,0 +1,43 @@
+<html>
+<head>
+    <title>网站地图</title>
+    <meta charset="UTF-8">
+    <link href="/static/css/sitemap.css" rel="stylesheet">
+    <style>
+        #map {
+            width: 100%;
+            overflow: hidden;
+        }
+        .page {
+            width: 240px;
+            margin: 0 auto;
+            display: block;
+            margin-bottom: 30px;
+            text-align: center;
+            overflow: hidden;
+        }
+    </style>
+</head>
+<body>
+<div id="map">
+    <foreach name="datas" id="v">
+        <if condition="$v.id">
+            <if condition="$v.type eq 1">
+                <a href="/xm{$v.id}/" title="{$v.title}">{$v.title}</a>
+                <elseif condition="$v.type eq 2"/>
+                <a href="/b{$v.id}" title="{$v.title}">{$v.title}</a>
+                <else/>
+                <a href="/news{$v.id}" title="{$v.title}">{$v.title}</a>
+            </if>
+        </if>
+    </foreach>
+</div>
+
+<div class="page">
+    <a href="/sitemap.shtml?p={$lastPage}">上一页</a>
+    <if condition="$nextPage">
+    <a href="/sitemap.shtml?p={$nextPage}">下一页</a>
+    </if>
+</div>
+</body>
+</html>

+ 132 - 2
public/themes/mjmls/static/css/master.css

@@ -900,6 +900,136 @@ footer p a {
 		color: #777;
 		-webkit-text-stroke: 1px #fff;
 	}
+
+	.w-header {
+		width: 100%;
+		height: 3.429rem;
+		background: #fff;
+		display: flex;
+		border-bottom: 1px solid #D1D4E7;
+		position: fixed;
+		top: 0;
+		left: 0;
+		z-index: 100;
+	}
+	.w-header-left {
+		width: 3.435rem;
+		height: 3.429rem;
+		float: left;
+	}
+
+	.w-header-left a{
+		width: 3.435rem;
+		height:3.429rem;
+		display:block;
+		background:url(../images/fanhui.png) no-repeat center center;
+		background-size: 2rem;
+	}
+	.w-header-logo{
+		flex:1;
+		text-align:center;
+		line-height: 3.429rem;
+		font-size: 1.485rem;
+		color: #ee0f15;
+		font-weight:bold;
+		overflow:hidden;
+		white-space:nowrap;
+		text-overflow:ellipsis;
+	}
+	.w-header-logo img{
+		width:4.33rem;
+		height:0.4rem;
+		margin:.24rem auto;
+		display:block;
+	}
+	.w-header-right{
+		width: 3.435rem;
+		height:3.429rem;
+		float:right;
+
+	}
+	.w-header-right a{
+		width: 3.435rem;
+		height:3.429rem;
+		display:block;
+		background:url(../images/home.png) no-repeat center center;
+		background-size: 2rem;
+	}
+	.trade-nav {
+		width: 100%;
+		height: 736px;
+		margin-top: 3.429rem;
+	}
+	.trade-nav-l {
+		width: 23%;
+		height: 100%;
+		padding-bottom: 15%;
+		box-sizing: border-box;
+		background: #F4F5FA;
+		float: left;
+		overflow-y: scroll;
+	}
+	.trade-nav-l ul li.on {
+		background: #fff;
+	}
+	.trade-nav-l ul li {
+		height: 3.475rem;
+		line-height: 3.475rem;
+		font-size: 1.25rem;
+		color: #333;
+		text-align: center;
+		position: relative;
+	}
+	.trade-nav-l ul li.on:after {
+		border-left: 0.165rem solid #ee0f15;
+	}
+	.trade-nav-l ul li:after {
+		content: '';
+		height: 3.475rem;
+		width: 0.165rem;
+		background: #F4F5FA;
+		position: absolute;
+		left: 0;
+		top: 0;
+	}
+	.trade-nav-r {
+		width: 75%;
+		height: 100%;
+		float: right;
+		margin: 2% 0 2% 0%;
+		overflow-y: scroll;
+		padding-bottom: 20%;
+	}
+	.trade-nav-r .trade-list-box {
+		display: none;
+	}
+	.trade-nav-r .trade-list-box.on {
+		display: block;
+	}
+	.trade-list-box {
+		width: 100%;
+		height: 100%;
+		display: none;
+	}
+
+	.trade-list-box .trade-title {
+		font-size: 1.25rem;
+		color: #333;
+		padding: 4% 0 2% 0;
+		text-align: left;
+	}
+	.trade-list a {
+		width: 31%;
+		height: 2.985rem;
+		color: #333;
+		text-align: center;
+		line-height: 2.985rem;
+		border: 0.01rem solid #D4D7E9;
+		float: left;
+		margin-right: 2%;
+		margin-top: 2.5%;
+		overflow: hidden;
+	}
 	.mob-navigation {
 		z-index: 9999;
 		position: fixed;
@@ -907,8 +1037,8 @@ footer p a {
 		left: 0;
 		right: 0;
 		bottom: 0;
-		padding: 0 50px;
-		padding-top: 90px;
+	/*	padding: 0 50px;
+		padding-top: 90px;*/
 		background: #fff;
 		opacity: 0;
 		transform: scale(0);

BIN
public/themes/mjmls/static/images/fanhui.png


BIN
public/themes/mjmls/static/images/home.png


+ 8 - 1
public/themes/mjmls/static/js/base.js

@@ -4,7 +4,7 @@ $(function () {
     $(".m-header i").click(function () {
         $(".mob-navigation").addClass("on");
     });
-    $(".mob-navigation i").click(function () {
+    $(".mob-navigation .home").click(function () {
         $(".mob-navigation").removeClass("on");
     });
 
@@ -18,6 +18,13 @@ $(function () {
         $('.fixed-foot').removeClass('fixed-foot-on');
     })
 
+    $(".trade-nav-l ul li").click(function(){
+        var index = $(this).index();
+        console.log(index)
+        $(this).addClass('on').siblings().removeClass('on');
+        $(".trade-nav-r .trade-list-box").eq(index).addClass('on').siblings().removeClass('on');
+    })
+
     // 回顶部
     $('.go-top').click(function () {
         $('body,html').animate({ scrollTop: 0 });