Commit 31d47421 authored by hangjun83's avatar hangjun83

发票相关接口

parent 74527682
...@@ -92,13 +92,13 @@ class InvoiceController extends Controller ...@@ -92,13 +92,13 @@ class InvoiceController extends Controller
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore'); $requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
$requestParams = array_merge($requestParams,['customer_code' => $customerCode]); $requestParams = array_merge($requestParams,['customer_code' => $customerCode]);
try{ try{
$orderList = $this->rhawnInvoicesService->getInoviceItems($requestParams); $orderItems = $this->rhawnInvoicesService->getInoviceItems($requestParams);
if($orderList){ if($orderItems){
$orderList = $this->formatKeysfromArray($orderList,'toCamelCase'); $orderItems = $this->formatKeysfromArray($orderItems,'toCamelCase');
} }
return Response::success($orderList,'操作成功'); return Response::success($orderItems,'操作成功');
}catch(\Throwable $exception){ }catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取订单列表失败'); return $this->returnErrorExecptionResponse($exception,'获取失败');
} }
} }
} }
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace App\Repositories\Transformers\Rhawn;
use League\Fractal\TransformerAbstract;
class InvoiceSorderItemsTransformer extends TransformerAbstract
{
public function transform($invoice)
{
$invoiceTransReturn = [];
if($invoice){
foreach($invoice as $invo){
$temp = [];
$temp['so_no'] = $invo['so_no'];
$temp['dpd_num'] = $invo['dpd_num'];
$temp['amount'] = $invo['soid_amount'];
array_push($invoiceTransReturn,$temp);
}
}
return $invoiceTransReturn;
}
}
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
namespace App\Services\Api; namespace App\Services\Api;
use App\Finance\Services\InvoiceService; use App\Finance\Services\InvoiceService;
use App\Repositories\Transformers\Rhawn\InvoiceSorderItemsTransformer;
use App\Rhawn\Repositories\Eloquent\RhawnInvoiceRepositoryEloquent; use App\Rhawn\Repositories\Eloquent\RhawnInvoiceRepositoryEloquent;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -47,9 +48,12 @@ class RhawnInvoicesService ...@@ -47,9 +48,12 @@ class RhawnInvoicesService
$invoiceItemsId[] = $item['soid_id']; $invoiceItemsId[] = $item['soid_id'];
} }
$sorderItems = $this->invoiceService->rhawnInvoiceItemsRepository->getInvoiceSorderItemsBySoItemsId($invoiceItemsId); $sorderItems = $this->invoiceService->rhawnInvoiceItemsRepository->getInvoiceSorderItemsBySoItemsId($invoiceItemsId);
var_dump($sorderItems); if(!$sorderItems){
exit; throw new \Exception('查询对应订单错误',502);
}
$sorderItems = app(InvoiceSorderItemsTransformer::class)->transform($sorderItems);
return $sorderItems;
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment