diff --git a/app/Classes/Modules/Orders/Services/FetchesDataFromYDPortal.php b/app/Classes/Modules/Orders/Services/FetchesDataFromYDPortal.php new file mode 100644 index 00000000..37b1c295 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/FetchesDataFromYDPortal.php @@ -0,0 +1,32 @@ +requestAsync($method, $url, ['query' => $body]); + + return $request->wait(); + } + + public function getResponseBody(ResponseInterface $request){ + $content = $request->getBody()->getContents(); + $content = str_replace("\r",'', $content); + return json_decode($content); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php new file mode 100644 index 00000000..c65b8ee9 --- /dev/null +++ b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php @@ -0,0 +1,40 @@ +fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal; + } + + /** + * @param Carbon|null $start + * @param Carbon|null $end + * @return array + * @throws GuzzleException + */ + public function execute(?Carbon $start = null, ?Carbon $end = null) { + + + $orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [ + 'apicode' => '393b1cb4b8b37d09', + 'begintime' => '1633968000', + 'endtime' => '1639308222', + ]); + + $order = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest); + + dd($order); + } +} diff --git a/app/Console/Commands/CurlYdOrderListCommand.php b/app/Console/Commands/CurlYdOrderListCommand.php new file mode 100644 index 00000000..b68f6cd1 --- /dev/null +++ b/app/Console/Commands/CurlYdOrderListCommand.php @@ -0,0 +1,48 @@ +make(FetchOrderListsFromYdPortalProcessor::class))->execute(); + } +}