作者 刘锟

update

@@ -154,11 +154,17 @@ public function uploadVerifyFile(Request $request) @@ -154,11 +154,17 @@ public function uploadVerifyFile(Request $request)
154 { 154 {
155 $domain = $request->getHost(); 155 $domain = $request->getHost();
156 $files = $request->allFiles(); 156 $files = $request->allFiles();
  157 + $file_name = '';
157 foreach ($files as $file) { 158 foreach ($files as $file) {
158 $destinationPath = public_path($domain); 159 $destinationPath = public_path($domain);
159 $file->move($destinationPath, $file->getClientOriginalName()); 160 $file->move($destinationPath, $file->getClientOriginalName());
160 $filePath = $destinationPath . '/' . $file->getClientOriginalName(); 161 $filePath = $destinationPath . '/' . $file->getClientOriginalName();
161 @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND); 162 @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND);
  163 + $file_name = $file->getClientOriginalName();
  164 + }
  165 + if ($file_name) {
  166 + $transmitUrl = env("TRANSMIT_URL");
  167 + $this->httpPost($transmitUrl . "api/selfSiteVerify/", json_encode(['file_name' => $file_name, 'type' => 1]));
162 } 168 }
163 return $this->success(); 169 return $this->success();
164 } 170 }
@@ -183,11 +189,17 @@ public function uploadAmpVerifyFile(Request $request) @@ -183,11 +189,17 @@ public function uploadAmpVerifyFile(Request $request)
183 $amp_domain = implode('.', $host_array); 189 $amp_domain = implode('.', $host_array);
184 190
185 $files = $request->allFiles(); 191 $files = $request->allFiles();
  192 + $file_name = '';
186 foreach ($files as $file) { 193 foreach ($files as $file) {
187 $destinationPath = public_path($amp_domain); 194 $destinationPath = public_path($amp_domain);
188 $file->move($destinationPath, $file->getClientOriginalName()); 195 $file->move($destinationPath, $file->getClientOriginalName());
189 $filePath = $destinationPath . '/' . $file->getClientOriginalName(); 196 $filePath = $destinationPath . '/' . $file->getClientOriginalName();
190 @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND); 197 @file_put_contents(storage_path('logs/upload_file.log'), date('Y-m-d H:i:s') . " " . $filePath . PHP_EOL, FILE_APPEND);
  198 + $file_name = $file->getClientOriginalName();
  199 + }
  200 + if ($file_name) {
  201 + $transmitUrl = env("TRANSMIT_URL");
  202 + $this->httpPost($transmitUrl . "api/selfSiteVerify/", json_encode(['file_name' => $file_name, 'type' => 2]));
191 } 203 }
192 return $this->success(); 204 return $this->success();
193 } 205 }
@@ -354,7 +366,7 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA @@ -354,7 +366,7 @@ public function transmit($request, $type = self::TYPEVISIT, $traffic = self::TRA
354 $data["device_port"] = $this->userAgentHandle($request->userAgent(), $data["device_port"] ?? self::DEVICE_PORT_ONE); 366 $data["device_port"] = $this->userAgentHandle($request->userAgent(), $data["device_port"] ?? self::DEVICE_PORT_ONE);
355 $req["data"] = $data; 367 $req["data"] = $data;
356 $referrer_url = $data["referrer_url"] ?? $request->header('Referer'); 368 $referrer_url = $data["referrer_url"] ?? $request->header('Referer');
357 - if($type == self::TYPEVISIT){ 369 + if ($type == self::TYPEVISIT) {
358 $referrer_url = $this->visitInfoHandle($referrer_url); 370 $referrer_url = $this->visitInfoHandle($referrer_url);
359 } 371 }
360 $req["referer"] = $referrer_url; 372 $req["referer"] = $referrer_url;