AudienceController.php
6.2 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
/**
* 观众中心
* Author : xiaojie
* DateTime: 2018/12/06 11:35
*/
namespace app\portal\controller;
use app\portal\model\ExhibitorsModel;
use app\portal\model\PageModel;
use app\portal\model\PortalCategoryModel;
use app\portal\model\ShowModel;
use cmf\controller\HomeBaseController;
use think\Session;
class AudienceController extends HomeBaseController
{
/**
* 观众预登记
* portal/audience/stand
*/
public function stand()
{
return $this->fetch();
}
/**
* 展位图
* portal/audience/floorplan
*/
public function floorplan()
{
$cate_id = 30;
$pageModel = new PageModel();
$info = $pageModel->where('cate_id',$cate_id)->find();
$this->setPageNum($info['id']);
//所在位置
$location = [
[
'location' => '观众中心',
'url' => 'javascript:;'
],
[
'location' => '展位图',
'url' => url('portal/audience/floorplan')
]
];
$this->assign('info',$info);
$this->assign('location',$location);
return $this->fetch(':page');
}
/**
* 往届观众
* portal/audience/past
*/
public function past()
{
$cate_id = 31;
$cateModel = new PortalCategoryModel();
$showModel = new ShowModel();
$list = $showModel->where('id',$cate_id)->paginate(57);
//分类信息
$info = $cateModel->where('id',$cate_id)->find();
//增加阅读量
$this->setCateNum($cate_id);
//所在位置
$location = [
[
'location' => '观众中心',
'url' => 'javascript:;'
],
[
'location' => '往届观众',
'url' => url('portal/audience/past')
]
];
$this->assign('list',$list);
$this->assign('location',$location);
$this->assign('info',$info);
return $this->fetch();
}
/**
* 买家集群
* portal/audience/buyer
*/
public function buyer()
{
// $cate_id = 32;
// $cateModel = new PortalCategoryModel();
// $showModel = new ShowModel();
// $list = $showModel->getList($cate_id);
// //分类信息
// $info = $cateModel->where('id',$cate_id)->find();
// //增加阅读量
// $this->setCateNum($cate_id);
// //所在位置
// $location = [
// [
// 'location' => '观众中心',
// 'url' => 'javascript:;'
// ],
// [
// 'location' => '买家集群',
// 'url' => url('portal/audience/buyer')
// ]
// ];
// $this->assign('list',$list);
// $this->assign('location',$location);
// $this->assign('info',$info);
// return $this->fetch();
$keyword = $this->request->param('keyword','');
$showModel = new ShowModel();
$list = $showModel->getList(32,$keyword,16);
$page = $this->getPageStyle($list);
//所在位置
$location = [
[
'location' => '观众中心',
'url' => 'javascript:;'
],
[
'location' => '买家集群',
'url' => 'javascript:;'
]
];
$this->assign('list',$list);
$this->assign('location',$location);
$this->assign('page',$page);
$this->assign('keyword',empty($keyword)?'':$keyword);
return $this->fetch();
}
/**
* 观众预登记提交
* portal/audience/ajax_stand_add
*/
public function ajax_stand_add()
{
$user_mobile = Session::get('user_mobile');
if(empty($user_mobile)){
$this->apiResponse(0,'请登录后在操作');
}
$param = $this->request->param();
if(empty($param['name']) or !isset($param['name'])){
$this->apiResponse(0,'姓名不能为空');
}
if(empty($param['mobile']) or !isset($param['mobile'])){
$this->apiResponse(0,'手机号不能为空');
}
if(empty($param['post']) or !isset($param['post'])){
$this->apiResponse(0,'职务不能为空');
}
if(empty($param['company_name']) or !isset($param['company_name'])){
$this->apiResponse(0,'公司名称不能为空');
}
if(empty($param['phone']) or !isset($param['phone'])){
$this->apiResponse(0,'办公电话不能为空');
}
// if(empty($param['address']) or !isset($param['address'])){
// $this->apiResponse(0,'公司地址不能为空');
// }
if(empty($param['qq']) or !isset($param['qq'])){
$this->apiResponse(0,'联系QQ不能为空');
}
if(empty($param['address_detail']) or !isset($param['address_detail'])){
$this->apiResponse(0,'详细地址不能为空');
}
if(empty($param['category']) or !isset($param['category'])){
$this->apiResponse(0,'参观调查不能为空');
}
if(empty($param['objective']) or !isset($param['objective'])){
$this->apiResponse(0,'此行的目的不能为空');
}
if(empty($param['interest']) or !isset($param['interest'])){
$this->apiResponse(0,'您感兴趣的展品不能为空');
}
if(empty($param['understand']) or !isset($param['understand'])){
$this->apiResponse(0,'您如何得知我们的展会不能为空');
}
if(!in_array(7,$param['objective'])){
$param['objective_data'] = '';
}else{
if(empty($param['objective_data'])){
$this->error('请填写此行目的');
}
}
if(!in_array(10,$param['understand'])){
$param['understand_data'] = '';
}else{
if(empty($param['understand_data'])){
$this->error('请填写得知方式');
}
}
$exhibitorsModel = new ExhibitorsModel();
$res = $exhibitorsModel->save($param);
if($res){
$this->apiResponse(1,'提交成功');
}
$this->apiResponse(0,'请稍后重试');
}
}