Skip to content

Commit 72d0065

Browse files
committed
fix: 公交临时维护数据处理
1 parent b76a0eb commit 72d0065

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

laravel/app/Http/Repository/BusRepository.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use App\Models\Cron;
1515
use App\Models\CronTask;
1616
use Carbon\Carbon;
17+
use Curl\Http;
1718
use Illuminate\Support\Facades\Cache;
1819
use Illuminate\Support\Facades\Cookie;
1920
use Illuminate\Support\Facades\Log;
@@ -271,6 +272,33 @@ public function getLine($path, $get)
271272
return ['to' => $to, 'line' => $arrayData];
272273
}
273274

275+
public function getLineData2($path, $get)
276+
{
277+
if (empty($path) || empty($get['cid']) || empty($get['LineGuid']) || empty($get['LineInfo']))
278+
return false;
279+
280+
$url = 'http://www.szjt.gov.cn/BusQu/APTSLine.aspx/GetData2';
281+
$param = '{"guid":"'. $get['LineGuid']. '"}';
282+
$header = [
283+
'content-type: Application/json',
284+
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
285+
'Accept: application/json',
286+
'Host: www.szjt.gov.cn',
287+
'Origin: http://www.szjt.gov.cn',
288+
];
289+
$data = Http::getInstent()->post($url, $param, 4, $header);
290+
291+
if ($data['content']) {
292+
$res = json_decode($data['content'], true);
293+
if (isset($res['d'])) {
294+
$arr = json_decode($res['d'], true);
295+
return $arr['Document'] ?? [];
296+
}
297+
}
298+
return [];
299+
300+
}
301+
274302
/**
275303
* 定时任务:artisan 执行入库操作
276304
*/

0 commit comments

Comments
 (0)