作者 赵彬吉

update

@@ -80,6 +80,7 @@ class postInquiry extends Command @@ -80,6 +80,7 @@ class postInquiry extends Command
80 } 80 }
81 81
82 public function visit(ReInquiryDetail $detail, ReInquiryDetailLog $log){ 82 public function visit(ReInquiryDetail $detail, ReInquiryDetailLog $log){
  83 + $website = 'https://' . $detail['re_website'] . '/';
83 if($detail['is_v6']) { 84 if($detail['is_v6']) {
84 $data = [ 85 $data = [
85 'ip' => $detail['ip'], 86 'ip' => $detail['ip'],
@@ -88,30 +89,27 @@ class postInquiry extends Command @@ -88,30 +89,27 @@ class postInquiry extends Command
88 'referrer_url' => $detail['referrer'], 89 'referrer_url' => $detail['referrer'],
89 'user_agent' => $detail['user_agent'], 90 'user_agent' => $detail['user_agent'],
90 ]; 91 ];
91 - $res = Http::withoutVerifying()->post($detail['re_website'] . 'api/traffic_visit/', $data)->json(); 92 + $res = Http::withoutVerifying()->post($website . 'api/traffic_visit/', $data)->json();
92 if (empty($res['status']) || $res['status'] != 200) { 93 if (empty($res['status']) || $res['status'] != 200) {
93 $log->status = ReInquiryDetailLog::STATUS_FAIL; 94 $log->status = ReInquiryDetailLog::STATUS_FAIL;
94 $log->remark = $res['message'] ?? ''; 95 $log->remark = $res['message'] ?? '';
95 $log->save(); 96 $log->save();
96 97
97 - Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $detail['re_website'] . 'api/traffic_visit/',$data]); 98 + Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $website . 'api/traffic_visit/',$data]);
98 return false; 99 return false;
99 } 100 }
100 }else{ 101 }else{
101 //v4 v5分离项目 往测试链接推 102 //v4 v5分离项目 往测试链接推
102 - $website = $detail['re_website'];  
103 $client = new \GuzzleHttp\Client(); 103 $client = new \GuzzleHttp\Client();
104 $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [ 104 $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [
105 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 105 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
106 ])->getBody()->getContents(); 106 ])->getBody()->getContents();
107 $site_array = json_decode($site_array, true); 107 $site_array = json_decode($site_array, true);
108 $mail_urls = array_column($site_array, 'main_url'); 108 $mail_urls = array_column($site_array, 'main_url');
109 - $key = array_search('https://' . $detail['re_website'] . '/', $mail_urls); 109 + $key = array_search($website, $mail_urls);
110 if ($key !== false) { 110 if ($key !== false) {
111 // 分离项目 推送到测试链接 111 // 分离项目 推送到测试链接
112 $website = $site_array[$key]['test_url']; 112 $website = $site_array[$key]['test_url'];
113 - }else{  
114 - $website = 'https://' . $website . '/';  
115 } 113 }
116 114
117 $data = [ 115 $data = [
@@ -138,6 +136,7 @@ class postInquiry extends Command @@ -138,6 +136,7 @@ class postInquiry extends Command
138 } 136 }
139 137
140 public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ 138 public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){
  139 + $website = 'https://' . $detail['re_website'] . '/';
141 // v6 140 // v6
142 if($detail['is_v6']) { 141 if($detail['is_v6']) {
143 $data = [ 142 $data = [
@@ -150,16 +149,16 @@ class postInquiry extends Command @@ -150,16 +149,16 @@ class postInquiry extends Command
150 if($detail->email){ 149 if($detail->email){
151 $data['email'] = $detail->email; 150 $data['email'] = $detail->email;
152 }else{ 151 }else{
153 - $data['__amp_source_origin'] = trim($detail['re_website'], '/'); 152 + $data['__amp_source_origin'] = trim($website, '/');
154 } 153 }
155 154
156 - $res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($detail['re_website'] . 'api/inquiryQd/', $data)->json(); 155 + $res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($website . 'api/inquiryQd/', $data)->json();
157 if(empty($res['code']) || $res['code'] != 200){ 156 if(empty($res['code']) || $res['code'] != 200){
158 $log->status = ReInquiryDetailLog::STATUS_FAIL; 157 $log->status = ReInquiryDetailLog::STATUS_FAIL;
159 $log->remark = $res['message'] ?? ''; 158 $log->remark = $res['message'] ?? '';
160 $log->save(); 159 $log->save();
161 160
162 - Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $detail['website'] . 'api/inquiryQd/', $data]); 161 + Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $website . 'api/inquiryQd/', $data]);
163 return false; 162 return false;
164 } 163 }
165 }else{ 164 }else{