|
|
|
1
|
+<?php
|
|
|
|
2
|
+
|
|
|
|
3
|
+namespace App\Console\Commands\DayCount;
|
|
|
|
4
|
+
|
|
|
|
5
|
+use App\Models\Inquiry\InquiryInfo;
|
|
|
|
6
|
+use Illuminate\Console\Command;
|
|
|
|
7
|
+
|
|
|
|
8
|
+/**
|
|
|
|
9
|
+ * @remark :
|
|
|
|
10
|
+ * @class :InquiryDelay.php
|
|
|
|
11
|
+ * @author :lyh
|
|
|
|
12
|
+ * @time :2023/7/14 10:16
|
|
|
|
13
|
+ */
|
|
|
|
14
|
+class InquiryDelay extends Command
|
|
|
|
15
|
+{
|
|
|
|
16
|
+ /**
|
|
|
|
17
|
+ * The name and signature of the console command.
|
|
|
|
18
|
+ *
|
|
|
|
19
|
+ * @var string
|
|
|
|
20
|
+ */
|
|
|
|
21
|
+ protected $signature = 'inquiry_delay';
|
|
|
|
22
|
+
|
|
|
|
23
|
+ /**
|
|
|
|
24
|
+ * The console command description.
|
|
|
|
25
|
+ *
|
|
|
|
26
|
+ * @var string
|
|
|
|
27
|
+ */
|
|
|
|
28
|
+ protected $description = '延时询盘转发(暂时弃用)';
|
|
|
|
29
|
+
|
|
|
|
30
|
+ /**
|
|
|
|
31
|
+ * @remark :延时询盘转发
|
|
|
|
32
|
+ * @name :handle
|
|
|
|
33
|
+ * @author :lyh
|
|
|
|
34
|
+ * @method :post
|
|
|
|
35
|
+ * @time :2023/7/14 10:17
|
|
|
|
36
|
+ */
|
|
|
|
37
|
+ public function handle()
|
|
|
|
38
|
+ {
|
|
|
|
39
|
+ $inquiryInfoModel = new InquiryInfo();
|
|
|
|
40
|
+ $param = $inquiryInfoModel->formatQuery(['status'=>$inquiryInfoModel::STATUS_FOUR])->orderBy('send_time','asc')->first();
|
|
|
|
41
|
+ if(!empty($param)){
|
|
|
|
42
|
+ $time = date('Y-m-d H:i:s');
|
|
|
|
43
|
+ if($time >= $param['send_time']){
|
|
|
|
44
|
+ $data = [];
|
|
|
|
45
|
+ //TODO::处理转发的url
|
|
|
|
46
|
+ $arr_url = explode(',',$param['forward_url']);
|
|
|
|
47
|
+ foreach ($arr_url as $v){
|
|
|
|
48
|
+ $data['url'] = $v;
|
|
|
|
49
|
+ $this->inquiryForward($data);
|
|
|
|
50
|
+ }
|
|
|
|
51
|
+ $inquiryInfoModel->edit(['status'=>$inquiryInfoModel::STATUS_THREE],['id'=>$param['id']]);
|
|
|
|
52
|
+ }
|
|
|
|
53
|
+ }
|
|
|
|
54
|
+ return true;
|
|
|
|
55
|
+ }
|
|
|
|
56
|
+
|
|
|
|
57
|
+ /**
|
|
|
|
58
|
+ * @remark :询盘转发
|
|
|
|
59
|
+ * @name :inquiryForward
|
|
|
|
60
|
+ * @author :lyh
|
|
|
|
61
|
+ * @method :post
|
|
|
|
62
|
+ * @time :2023/7/13 14:39
|
|
|
|
63
|
+ */
|
|
|
|
64
|
+ public function inquiryForward($post_data){
|
|
|
|
65
|
+ $url = 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f';
|
|
|
|
66
|
+ $post_data_new = [];
|
|
|
|
67
|
+ $post_data_new['refer'] = $post_data['url'];
|
|
|
|
68
|
+ $post_data_new['name'] = $post_data['name'];
|
|
|
|
69
|
+ $post_data_new['email'] = $post_data['email'];
|
|
|
|
70
|
+ $post_data_new['phone'] = $post_data['phone'];
|
|
|
|
71
|
+ $post_data_new['ip'] = $post_data['ip'];
|
|
|
|
72
|
+ $post_data_new['message'] = $post_data['message'];
|
|
|
|
73
|
+ $post_data_new['submit_time'] = date('Y-m-d H:i:s',time()+20);
|
|
|
|
74
|
+ $token = md5($post_data_new['refer'].$post_data_new['name'].$post_data_new['ip'].date("Y-m-d",time()));
|
|
|
|
75
|
+ $post_data_new['token'] = $token;
|
|
|
|
76
|
+ $header = array(
|
|
|
|
77
|
+ 'CLIENT-IP: '.$post_data['ip'],
|
|
|
|
78
|
+ 'X-FORWARDED-FOR: '.$post_data['ip']
|
|
|
|
79
|
+ );
|
|
|
|
80
|
+ return http_post($url,$post_data_new,$header);
|
|
|
|
81
|
+ }
|
|
|
|
82
|
+
|
|
|
|
83
|
+} |