|
@@ -7,6 +7,8 @@ use App\Models\InquiryIP; |
|
@@ -7,6 +7,8 @@ use App\Models\InquiryIP; |
|
7
|
use App\Models\Projects\InquiryInfo;
|
7
|
use App\Models\Projects\InquiryInfo;
|
|
8
|
use App\Models\Projects\InquiryUser;
|
8
|
use App\Models\Projects\InquiryUser;
|
|
9
|
use Illuminate\Support\Facades\DB;
|
9
|
use Illuminate\Support\Facades\DB;
|
|
|
|
10
|
+use Illuminate\Support\Facades\Artisan;
|
|
|
|
11
|
+use Illuminate\Console\Scheduling\Schedule;
|
|
10
|
|
12
|
|
|
11
|
/**
|
13
|
/**
|
|
12
|
* @remark :询盘中心
|
14
|
* @remark :询盘中心
|
|
@@ -36,44 +38,11 @@ class InquiryInfoLogic extends BaseLogic |
|
@@ -36,44 +38,11 @@ class InquiryInfoLogic extends BaseLogic |
|
36
|
* @method :post
|
38
|
* @method :post
|
|
37
|
* @time :2023/7/11 15:25
|
39
|
* @time :2023/7/11 15:25
|
|
38
|
*/
|
40
|
*/
|
|
39
|
- public function getInquiryLists($map,$page,$row,$order = 'id'){
|
|
|
|
40
|
- $query = $this->model->leftJoin('gl_inquiry_user', 'gl_inquiry_info.id', '=', 'gl_inquiry_user.xp_id')
|
|
|
|
41
|
- ->orderBy('gl_inquiry_info.'.$order,'desc');
|
|
|
|
42
|
- //搜索条件处理
|
|
|
|
43
|
- if(isset($map['domain'])){
|
|
|
|
44
|
- $query = $query->where('gl_inquiry_info.domain','like','%'.$map['domain'].'%');
|
|
|
|
45
|
- }
|
|
|
|
46
|
- if(isset($map['type'])){
|
|
|
|
47
|
- $query = $query->where('gl_inquiry_info.type',$map['type']);
|
|
|
|
48
|
- }
|
|
|
|
49
|
- if(isset($map['url'])){
|
|
|
|
50
|
- $query = $query->where('gl_inquiry_info.url',$map['url']);
|
|
|
|
51
|
- }
|
|
|
|
52
|
- $lists = $query->paginate($row, $this->selectParam(), 'page', $page);
|
41
|
+ public function getInquiryLists($map,$page,$row,$order = 'id',$filed = ['*']){
|
|
|
|
42
|
+ $lists = $this->model->lists($map,$page,$row,$order,$filed);
|
|
53
|
return $this->success($lists);
|
43
|
return $this->success($lists);
|
|
54
|
}
|
44
|
}
|
|
55
|
|
45
|
|
|
56
|
- /**
|
|
|
|
57
|
- * @remark :查询字段
|
|
|
|
58
|
- * @name :selectParam
|
|
|
|
59
|
- * @author :lyh
|
|
|
|
60
|
- * @method :post
|
|
|
|
61
|
- * @time :2023/7/11 16:57
|
|
|
|
62
|
- */
|
|
|
|
63
|
- public function selectParam(){
|
|
|
|
64
|
- $select = [
|
|
|
|
65
|
- 'gl_inquiry_info.*',
|
|
|
|
66
|
- 'gl_inquiry_user.user_id',
|
|
|
|
67
|
- 'gl_inquiry_user.user_name',
|
|
|
|
68
|
- 'gl_inquiry_user.message',
|
|
|
|
69
|
- 'gl_inquiry_user.ip',
|
|
|
|
70
|
- 'gl_inquiry_user.forward_url',
|
|
|
|
71
|
- 'gl_inquiry_user.status AS user_status',
|
|
|
|
72
|
- 'gl_inquiry_user.delay',
|
|
|
|
73
|
- 'gl_inquiry_user.send_time'
|
|
|
|
74
|
- ];
|
|
|
|
75
|
- return $select;
|
|
|
|
76
|
- }
|
|
|
|
77
|
|
46
|
|
|
78
|
/**
|
47
|
/**
|
|
79
|
* @remark :自定义添加特殊询盘信息
|
48
|
* @remark :自定义添加特殊询盘信息
|
|
@@ -84,8 +53,7 @@ class InquiryInfoLogic extends BaseLogic |
|
@@ -84,8 +53,7 @@ class InquiryInfoLogic extends BaseLogic |
|
84
|
*/
|
53
|
*/
|
|
85
|
public function inquirySave(){
|
54
|
public function inquirySave(){
|
|
86
|
try {
|
55
|
try {
|
|
87
|
- $xp_id = $this->inquiryInfoSave();
|
|
|
|
88
|
- $this->inquiryUserSave($xp_id);
|
56
|
+ $this->inquiryInfoSave();
|
|
89
|
}catch (\Exception $e){
|
57
|
}catch (\Exception $e){
|
|
90
|
$this->fail('error');
|
58
|
$this->fail('error');
|
|
91
|
}
|
59
|
}
|
|
@@ -109,36 +77,16 @@ class InquiryInfoLogic extends BaseLogic |
|
@@ -109,36 +77,16 @@ class InquiryInfoLogic extends BaseLogic |
|
109
|
'ip_area'=>$this->param['ip_area'],
|
77
|
'ip_area'=>$this->param['ip_area'],
|
|
110
|
'message'=>$this->param['message'],
|
78
|
'message'=>$this->param['message'],
|
|
111
|
'type'=>$this->param['type'],
|
79
|
'type'=>$this->param['type'],
|
|
112
|
- 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
113
|
- 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
|
114
|
- ];
|
|
|
|
115
|
- return $this->model->insertGetId($param);
|
|
|
|
116
|
- }
|
|
|
|
117
|
-
|
|
|
|
118
|
- /**
|
|
|
|
119
|
- * @remark :保存询盘用户转发记录
|
|
|
|
120
|
- * @name :inquiryInfoSave
|
|
|
|
121
|
- * @author :lyh
|
|
|
|
122
|
- * @method :post
|
|
|
|
123
|
- * @time :2023/7/12 11:12
|
|
|
|
124
|
- */
|
|
|
|
125
|
- public function inquiryUserSave($xp_id){
|
|
|
|
126
|
- //组装数据
|
|
|
|
127
|
- $param = [
|
|
|
|
128
|
'user_id'=>$this->manager['id'],
|
80
|
'user_id'=>$this->manager['id'],
|
|
129
|
'user_name'=>$this->manager['name'],
|
81
|
'user_name'=>$this->manager['name'],
|
|
130
|
- 'xp_id'=>$xp_id,
|
|
|
|
131
|
'forward_url'=>$this->param['forward_url'],
|
82
|
'forward_url'=>$this->param['forward_url'],
|
|
132
|
'delay'=>$this->param['delay'],
|
83
|
'delay'=>$this->param['delay'],
|
|
133
|
- 'ip'=>$this->param['ip'],
|
|
|
|
134
|
- 'phone'=>$this->param['phone'],
|
|
|
|
135
|
- 'message'=>$this->param['message'],
|
|
|
|
136
|
- 'send_time'=>date('Y-m-d H:i:s', time()+ $this->param['delay'] * 60 * 60)
|
|
|
|
137
|
];
|
84
|
];
|
|
138
|
- $inquiryUserModel = new InquiryUser();
|
|
|
|
139
|
- return $inquiryUserModel->add($param);
|
85
|
+ return $this->model->add($param);
|
|
140
|
}
|
86
|
}
|
|
141
|
|
87
|
|
|
|
|
88
|
+
|
|
|
|
89
|
+
|
|
142
|
/**
|
90
|
/**
|
|
143
|
* @remark :逻辑删除
|
91
|
* @remark :逻辑删除
|
|
144
|
* @name :inquiryInfoDel
|
92
|
* @name :inquiryInfoDel
|
|
@@ -211,4 +159,61 @@ class InquiryInfoLogic extends BaseLogic |
|
@@ -211,4 +159,61 @@ class InquiryInfoLogic extends BaseLogic |
|
211
|
$info = $inquiryIpModel->where($this->param)->inRandomOrder()->first();
|
159
|
$info = $inquiryIpModel->where($this->param)->inRandomOrder()->first();
|
|
212
|
return $this->success($info);
|
160
|
return $this->success($info);
|
|
213
|
}
|
161
|
}
|
|
|
|
162
|
+
|
|
|
|
163
|
+ /**
|
|
|
|
164
|
+ * @remark :根据时间转发
|
|
|
|
165
|
+ * @name :forwardTime
|
|
|
|
166
|
+ * @author :lyh
|
|
|
|
167
|
+ * @method :post
|
|
|
|
168
|
+ * @time :2023/7/13 17:39
|
|
|
|
169
|
+ */
|
|
|
|
170
|
+ public function forwardTime($param){
|
|
|
|
171
|
+ if($param['delay'] == 0){
|
|
|
|
172
|
+ $arr_url = explode(',',$param['forward_url']);
|
|
|
|
173
|
+ foreach ($arr_url as $v){
|
|
|
|
174
|
+ $param['url'] = $v;
|
|
|
|
175
|
+ $this->inquiryForward($param);
|
|
|
|
176
|
+ }
|
|
|
|
177
|
+ }else{
|
|
|
|
178
|
+ // 获取执行时间
|
|
|
|
179
|
+ $scheduledTime = date('Y-m-d H:i:s',time() + $this->param['delay'] * 60 * 60);
|
|
|
|
180
|
+ $schedule = new Schedule;
|
|
|
|
181
|
+ // 定义定时任务
|
|
|
|
182
|
+ $schedule->call(function () use ($param) {
|
|
|
|
183
|
+ // 任务执行的代码
|
|
|
|
184
|
+ $arr_url = explode(',',$param['forward_url']);
|
|
|
|
185
|
+ foreach ($arr_url as $v){
|
|
|
|
186
|
+ $param['url'] = $v;
|
|
|
|
187
|
+ $this->inquiryForward($param);
|
|
|
|
188
|
+ }
|
|
|
|
189
|
+ })->cron($scheduledTime);
|
|
|
|
190
|
+ // 获取任务调度的命令行参数
|
|
|
|
191
|
+ $parameters = $schedule->dueEvents($schedule->events());
|
|
|
|
192
|
+ // 执行命令行任务
|
|
|
|
193
|
+ Artisan::call($parameters);
|
|
|
|
194
|
+ }
|
|
|
|
195
|
+ return true;
|
|
|
|
196
|
+ }
|
|
|
|
197
|
+
|
|
|
|
198
|
+ /**
|
|
|
|
199
|
+ * @remark :询盘转发
|
|
|
|
200
|
+ * @name :inquiryForward
|
|
|
|
201
|
+ * @author :lyh
|
|
|
|
202
|
+ * @method :post
|
|
|
|
203
|
+ * @time :2023/7/13 14:39
|
|
|
|
204
|
+ */
|
|
|
|
205
|
+ public function inquiryForward($post_data){
|
|
|
|
206
|
+ $url = 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f';
|
|
|
|
207
|
+ $post_data_new = [];
|
|
|
|
208
|
+ $post_data_new['refer'] = $post_data['url'];
|
|
|
|
209
|
+ $post_data_new['name'] = $post_data['name'];
|
|
|
|
210
|
+ $post_data_new['email'] = $post_data['email'];
|
|
|
|
211
|
+ $post_data_new['phone'] = $post_data['phone'];
|
|
|
|
212
|
+ $post_data_new['ip'] = $post_data['ip'];
|
|
|
|
213
|
+ $post_data_new['message'] = $post_data['message'];
|
|
|
|
214
|
+ $post_data_new['submit_time'] = date('Y-m-d H:i:s',time()+20);
|
|
|
|
215
|
+ $token = md5($post_data_new['refer'].$post_data_new['name'].$post_data_new['ip'].date("Y-m-d",time()));
|
|
|
|
216
|
+ $post_data_new['token'] = $token;
|
|
|
|
217
|
+ return http_post($url,$post_data_new);
|
|
|
|
218
|
+ }
|
|
214
|
} |
219
|
} |