IndexController.php
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\HomeBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
class IndexController extends HomeBaseController
{
public function index()
{
//首页头部图片
$image = Db::name('slide_item') -> where('slide_id',2) -> find();
$this -> assign('image',$image);
//首页关于我们
$about_data = Db::name('portal_post') -> where('id',1) -> find();
$about_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($about_data['post_content']));
$this -> assign('about_data',$about_data);
//首页中心设备
$shebei_data = Db::name('portal_post') -> where('id',2) -> find();
$shebei_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
$this -> assign('shebei_data',$shebei_data);
$sheshi_data = Db::name('portal_post') -> where('id',47) -> find();
$sheshi_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
$this -> assign('sheshi_data',$sheshi_data);
$fuwu_data = Db::name('portal_post') -> where('id',48) -> find();
$fuwu_data['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shebei_data['post_content']));
$this -> assign('fuwu_data',$fuwu_data);
//首页澳德咨询
$new_data = Db::name('portal_category_post') -> alias('a') -> join('portal_post b','a.post_id=b.id','LEFT') -> where('category_id',22) -> order('b.id desc') -> limit(5) -> select();
$this -> assign('new_data',$new_data[0]);
foreach ($new_data as $key => $val){
if($key != 0){
$newdata[] = $val;
}
}
$this -> assign('newdata',$newdata);
return $this->fetch(':index');
}
}