Experts.php
1.6 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
<?php
namespace app\index\controller;
use app\common\controller\Frontend;
use think\Request;
class experts extends Frontend
{
protected $noNeedLogin = '*';
protected $noNeedRight = '*';
protected $layout = '';
public function index()
{
$param=Request::instance()->param();
$menu=self::$model::menu(11);
$this->assign("left",$menu);
$this->assign("pid",$param['pid']);
if($param['pid']==31 || $param['pid']==11){
$list=self::$model::experts(31,10);
$this->assign("list",$list);
$this->assign("pid",31);
return $this->view->fetch();
}else{
$list=self::$model::experts(32,10);
$this->assign("list",$list);
$this->assign("pid",32);
return view("experts/op");
}
}
public function detail()
{
$param=Request::instance()->param();
$news=\app\admin\model\Experts::where($param)->find();
$this->assign("news",$news);
if($news['style']==31){
return $this->view->fetch();
}else{
return view("experts/op_detail");
}
}
public function save()
{
$user=session("user");
if($user==null){
return self::$model::js("请先登录",200);
}
$param=Request::instance()->param();
$param['user_id']=$user['id'];
$news=\app\admin\model\ExpertsMessage::create($param);
if($news){
return self::$model::js("提交成功",200);
}else{
return self::$model::js("提交失败",500);
}
}
}