InquiryInfoController.php
7.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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<?php
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\InquiryInfoLogic;
use App\Models\Inquiry\AreaTimezone;
use Carbon\Carbon;
use PhpOffice\PhpSpreadsheet\IOFactory;
/**
* @remark :询盘中心
* @class :InquiryInfoController.php
* @author :lyh
* @time :2023/7/11 14:33
*/
class InquiryInfoController extends BaseController
{
/**
* @remark :获取询盘中心列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/7/11 15:23
*/
public function lists(InquiryInfoLogic $inquiryInfoLogic){
if(isset($this->param['url'])){
$this->map['url'] = ['like','%'.$this->map['url'].'%'];
}
if(isset($this->param['email'])){
$this->map['email'] = ['like','%'.$this->map['email'].'%'];
}
if(isset($this->param['title'])){
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
$lists = $inquiryInfoLogic->getInquiryLists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :参数验证
* @name :validationParam
* @author :lyh
* @method :post
* @time :2023/7/11 15:34
*/
public function validationParam(){
$this->request->validate([
'name'=>'required',//名称
'email'=>'required',//邮箱
'phone'=>'required',//电话号码
'ip'=>'required',//ip
'forward_url'=>'required',//转发网址
'message'=>'required',//发送内容
'type'=>'required',//询盘1类型
],[
'name.required' => '名称不能为空',
'email.required' => '邮箱不能为空',
'phone.required' => '电话号码不能为空',
'ip.required' => 'ip不能为空',
'forward_url.required' => '转发网址不能为空',
'message.required' => '发送内容不能为空',
'type.required' => '类型不能为空',
]);
}
/**
* @remark :保存询盘信息
* @name :save
* @author :lyh
* @method :post
* @time :2023/7/11 15:33
*/
public function save(InquiryInfoLogic $inquiryInfoLogic){
//参数验证
$this->validationParam();
$inquiryInfoLogic->inquirySave();
$this->response('success');
}
/**
* @remark :转发详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/7/12 17:19
*/
public function info(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'id'=>'required',//
],[
'id.required' => 'ID不能为空',
]);
$info = $inquiryInfoLogic->inquiryForwardInfo();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @param InquiryInfoLogic $inquiryInfoLogic
* @remark :删除
* @name :del
* @author :lyh
* @method :post
* @time :2023/7/12 14:10
*/
public function del(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'id'=>'required',//
],[
'id.required' => '名称不能为空',
]);
$inquiryInfoLogic->inquiryInfoDel();
$this->response('success');
}
/**
* @remark :导入询盘记录
* @name :ImportInquirySave
* @author :lyh
* @method :post
* @time :2023/7/13 10:39
*/
public function importInquirySave(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'file'=>'required',
],[
'file.required' => 'w文件不能为空',
]);
if ($this->request->hasFile('file')) {
$path = $this->request->file('file')->getRealPath();
$spreadsheet = IOFactory::load($path);
$worksheet = $spreadsheet->getActiveSheet();
$rows = $worksheet->toArray();
foreach ($rows as $k =>$row) {
if($k == 0){
continue;
}
// 创建模型实例并设置属性
$inquiryInfoLogic->ImportInquiryInfoSave($row);
}
}
$this->response('success');
}
/**
* @remark :根据国家获取随机ip
* @name :getSearchIpInfo
* @author :lyh
* @method :post
* @time :2023/7/13 13:45
*/
public function getSearchIpInfo(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'ip_area'=>'required',//
],[
'ip_area.required' => '国家不能为空',
]);
$info = $inquiryInfoLogic->getSearchIp();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :手动询盘转发
* @name :forwardInquiry
* @author :lyh
* @method :post
* @time :2023/7/14 10:43
*/
public function forwardInquiry(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'id'=>'required',//
],[
'id.required' => 'id不能为空',
]);
$inquiryInfoLogic->forwardTime($this->param['id']);
$this->response('success');
}
/**
* @remark :修改状态
* @name :status
* @author :lyh
* @method :post
* @time :2023/7/14 15:20
*/
public function status(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'id'=>'required',
'status'=>'required',
],[
'id.required' => 'id不能为空',
'status.required' => '状态不能为空',
]);
$inquiryInfoLogic->inquiryEdit();
$this->response('success');
}
/**
* @remark :获取最新90天数据
* @name :getNewThirtyCount
* @author :lyh
* @method :post
* @time :2023/7/14 15:55
*/
public function getCount(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'type'=>'required',
],[
'type.required' => '类型不能为空',
]);
$lists = $inquiryInfoLogic->getNewCount();
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :根据关键字获取域名
* @name :getKeywordUrl
* @author :lyh
* @method :post
* @time :2023/7/17 10:12
*/
public function getKeywordUrl(InquiryInfoLogic $inquiryInfoLogic){
$this->request->validate([
'keyword'=>'required',
],[
'keyword.required' => '关键字不能为空',
]);
$list = $inquiryInfoLogic->getKeywordUrl($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :获取询盘类型
* @name :getInquiryType
* @author :lyh
* @method :post
* @time :2023/8/1 9:12
*/
public function getInquiryType(InquiryInfoLogic $inquiryInfoLogic){
$list = $inquiryInfoLogic->getType();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :获取时区
* @name :getTimeZone
* @author :lyh
* @method :post
* @time :2023/8/18 9:02
*/
public function getTimeZone(AreaTimezone $areaTimezone){
$list = $areaTimezone->list($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :根据名称获取内部统计
* @name :internalCount
* @author :lyh
* @method :post
* @time :2023/8/18 9:18
*/
public function getInternalCount(InquiryInfoLogic $inquiryInfoLogic){
$list = $inquiryInfoLogic->getManagerCount();
$this->response('success',Code::SUCCESS,$list);
}
}