IndexController.php
2.5 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
<?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 CommentController
{
/*
* 长度处理
* */
public function changeThisLen($text){
$change_html = strip_tags(htmlspecialchars_decode($text));
$sub_text_first = mb_substr($change_html,0,5,'utf-8');
$sub_text = $sub_text_first;
return $sub_text;
}
// 首页
public function index()
{
// 轮播图
$where_banner['status'] = array('neq',9);
$banner = Db::name('Banner')->where($where_banner)->order('score desc')->select()->toArray();
$this->assign('banner',$banner);
// 我要购买推荐商品
$where_vehicle['status'] = array('neq',9);
$where_vehicle['is_up'] = 1;
$where_vehicle['type'] = 2;
$vehicle = Db::name('Vehicle')->where($where_vehicle)->order('score desc')->field('id,name,pic')->select()->toArray();
foreach ($vehicle as $k=>$v){
$vehicle[$k]['name'] = $this->changeThisLen($v['name']);
}
$this->assign('vehicle',$vehicle);
return $this->fetch('Index/index');
}
// 租赁指南
public function lease()
{
$where_art['type'] = 1;
$where_art['status'] = array('neq',9);
$art = Db::name('Art')->where($where_art)->find();
if($art){
$art['pic'] = cmf_get_image_url($art['pic']);
$art['content'] = htmlspecialchars_decode($art['content']);
}
$this->assign('art',$art);
return $this->fetch('Index/leasehold_guide');
}
// 关于我们
public function about()
{
$where_art['type'] = 2;
$where_art['status'] = array('neq',9);
$art = Db::name('Art')->where($where_art)->find();
if($art){
$art['pic'] = cmf_get_image_url($art['pic']);
$art['content'] = htmlspecialchars_decode($art['content']);
}
$this->assign('art',$art);
return $this->fetch('Index/about_us');
}
}