InquiryForwardController.php
6.8 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
<?php
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\InquiryForwardLogic;
class InquiryForwardController extends BaseController
{
/**
* 获取询盘列表
* @param InquiryForwardLogic $inquiryForwardLogic
* @author Akun
* @date 2025/02/21 10:55
*/
public function lists(InquiryForwardLogic $inquiryForwardLogic)
{
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['url_title'])) {
$this->map['url_title'] = ['like', '%' . $this->map['url_title'] . '%'];
}
if (isset($this->param['url_keyword'])) {
$this->map['url_keyword'] = ['like', '%' . $this->map['url_keyword'] . '%'];
}
if (isset($this->param['message'])) {
$this->map['message'] = ['like', '%' . $this->map['message'] . '%'];
}
if (isset($this->param['start_time'])) {
$this->map['inquiry_date'] = ['>=', $this->map['start_time']];
unset($this->map['start_time']);
}
if (isset($this->param['end_time'])) {
$this->map['inquiry_date'] = ['<=', $this->map['end_time']];
unset($this->map['end_time']);
}
$lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order);
$this->response('success', Code::SUCCESS, $lists);
}
/**
* 获取询盘详情
* @param InquiryForwardLogic $inquiryForwardLogic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/03/01 11:21
*/
public function getInquiryInfo(InquiryForwardLogic $inquiryForwardLogic)
{
$this->request->validate([
'id' => 'required',
], [
'id.required' => 'ID不能为空',
]);
$info = $inquiryForwardLogic->infoInquiry();
$this->response('success', Code::SUCCESS, $info);
}
/**
* 获取询盘类型
* @param InquiryForwardLogic $inquiryForwardLogic
* @author Akun
* @date 2025/02/21 11:20
*/
public function getInquiryType(InquiryForwardLogic $inquiryForwardLogic)
{
$lists = $inquiryForwardLogic->getType();
$this->response('success', Code::SUCCESS, $lists);
}
/**
* 手动转发询盘
* @param InquiryForwardLogic $inquiryForwardLogic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/02/21 14:54
*/
public function forwardInquiry(InquiryForwardLogic $inquiryForwardLogic)
{
$this->validationParam();
$inquiryForwardLogic->inquiryForward();
$this->response('success');
}
/**
* 手动转发询盘:参数验证
* @author Akun
* @date 2025/02/21 14:19
*/
public function validationParam()
{
$this->request->validate([
'id' => 'required',//ID
'name' => 'required',//名称
'email' => 'required',//邮箱
'ip' => 'required',//ip
'forward_url' => 'required',//转发网址
'message' => 'required',//发送内容
], [
'id.required' => 'ID不能为空',
'name.required' => '名称不能为空',
'email.required' => '邮箱不能为空',
'ip.required' => 'ip不能为空',
'forward_url.required' => '转发网址不能为空',
'message.required' => '内容不能为空',
]);
}
/**
* 根据国家获取随机ip
* @param InquiryForwardLogic $inquiryForwardLogic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/02/26 15:50
*/
public function getInquiryIp(InquiryForwardLogic $inquiryForwardLogic)
{
$this->request->validate([
'country' => 'required',
], [
'country.required' => '国家不能为空',
]);
$data = $inquiryForwardLogic->getIp();
$this->response('success', Code::SUCCESS, $data);
}
/**
* 关键词查询项目着陆页
* @param InquiryForwardLogic $inquiryForwardLogic
* @author Akun
* @date 2025/02/26 17:12
*/
public function searchInquiryKeywords(InquiryForwardLogic $inquiryForwardLogic)
{
$this->request->validate([
'keywords' => 'required',
'type' => 'required',
], [
'keywords.required' => '关键词不能为空',
'type.required' => '搜索类型不能为空',
]);
$lists = $inquiryForwardLogic->searchKeywords();
$this->response('success', Code::SUCCESS, $lists);
}
/**
* AI重写询盘文案
* @param InquiryForwardLogic $inquiryForwardLogic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/02/27 10:40
*/
public function aiRewriteInquiry(InquiryForwardLogic $inquiryForwardLogic)
{
$this->request->validate([
'message' => 'required',
], [
'message.required' => '需要重写的文案不能为空',
]);
$data = $inquiryForwardLogic->aiRewrite();
$this->response('success', Code::SUCCESS, $data);
}
/**
* 设置询盘无效
* @param InquiryForwardLogic $inquiryForwardLogic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/02/27 15:36
*/
public function setInquiryExpired(InquiryForwardLogic $inquiryForwardLogic)
{
$this->request->validate([
'id' => 'required',
], [
'id.required' => 'ID不能为空',
]);
$inquiryForwardLogic->expiredInquiry();
$this->response('success');
}
/**
* 获取询盘详情列表
* @param InquiryForwardLogic $inquiryForwardLogic
* @author Akun
* @date 2025/03/01 9:22
*/
public function getInquiryDetailList(InquiryForwardLogic $inquiryForwardLogic)
{
if (isset($this->param['country'])) {
$this->map['country'] = ['like', '%' . $this->map['country'] . '%'];
}
if (isset($this->param['website'])) {
$this->map['website'] = ['like', '%' . $this->map['website'] . '%'];
}
$lists = $inquiryForwardLogic->getInquiryDetailLists($this->map, $this->page, $this->row, $this->order);
$this->response('success', Code::SUCCESS, $lists);
}
}