Green.php
1.7 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
<?php
namespace app\index\controller;
use app\admin\controller\WhchList;
use app\admin\model\GreenList;
use app\common\controller\Frontend;
use think\Request;
class Green extends Frontend
{
protected $noNeedLogin = '*';
protected $noNeedRight = '*';
protected $layout = '';
public function index()
{
//查出最新的
$param=Request::instance()->param();
$list=self::$model::green($param['pid'],$param,1);
if($list && $param['pid']==13){
if (empty($list[0])){
$this->error('相关内容还在补充,敬请关注');
}
$res=$list[0];
$list2=GreenList::where("green_id",$res['id'])->select();
$advice=self::$model::advice(0,2,2);
}else{
$res=$list[0];
$list2=\app\admin\model\WhchList::where("green_id",$res['id'])->select();
$advice=self::$model::advice(0,2,3);
}
$this->assign("list",$list2);
$list1=self::$model::green($param['pid'],[],10);
$this->assign("list1",$list1);
$this->assign("pid",$param['pid']);
$this->assign("advice",$advice);
return view("green/green");
}
//查出更多
public function getList()
{
$param=Request::instance()->param();
$list=self::$model::green($param['pid'],$param,12);
$this->assign("list",$list);
$this->assign("pid",$param['pid']);
return view("green/list");
}
//详情
public function detail()
{
$param=Request::instance()->param();
$news=self::$model::greenDetail($param['id'],$param['pid']);
$this->assign("news",$news);
$this->assign("pid",$param['pid']);
return $this->view->fetch();
}
}