fix yd tracking api json line break bug

This commit is contained in:
omair saleh
2022-02-06 11:30:56 +08:00
parent 1538994cc5
commit 46699784da
2 changed files with 3 additions and 0 deletions
@@ -31,6 +31,7 @@ class FetchesDataFromYDPortal
public function getResponseBody(ResponseInterface $request){
$content = $request->getBody()->getContents();
$content = str_replace("\r",'', $content);
$content = str_replace("\n",'', $content);
return json_decode($content);
}
}
@@ -137,6 +137,7 @@ class FetchOrderListsFromYdPortalProcessor
{
try {
$start = $start ? $start : Carbon::now()->subMonths(2);
$startLimit = Carbon::parse('01-12-2021');
@@ -165,6 +166,7 @@ class FetchOrderListsFromYdPortalProcessor
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $row->expressno
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
foreach ($rows->data as $trackingRow) {