Commit d9bbaf77 authored by hangjun83's avatar hangjun83

财务开票模块更新

parent d3fef596
...@@ -569,7 +569,7 @@ class InvoiceService ...@@ -569,7 +569,7 @@ class InvoiceService
} }
} }
return 'http://openapi.chem-site.com/storage/app/'.$path.$filename; return [ 'path' => $path.$filename, 'filename' => $filename];
} }
public function getInvoicePdfDownloadUrl() public function getInvoicePdfDownloadUrl()
......
...@@ -64,8 +64,32 @@ class InvoiceController extends Controller ...@@ -64,8 +64,32 @@ class InvoiceController extends Controller
public function baiwangInvoiceDownload(Request $request) public function baiwangInvoiceDownload(Request $request)
{ {
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore'); $requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
var_dump($requestParams); if(!isset($requestParams['token']) || empty($requestParams['token'])){
exit; return Response::fail('参数错误!',500);
}
$decode = base64_decode($requestParams['token']);
list($token,$hm) = explode('&',$decode);
list($hmKey,$hmValue) = explode('=',$hm);
if($hmKey != 'hm' || empty($hmValue)){
return Response::fail('参数错误!',500);
}
list($tokenKey,$tokenValue) = explode('=',$token);
if($tokenKey != 'token' || empty($tokenValue)){
return Response::fail('参数错误!',500);
}
try{
$result = $this->invoiceService->downLoadInvoice(['token' => $tokenValue,'hm' => $hmValue]);
if($result){
$headers = [
'Content-Type: application/pdf',
];
//下载电子发票
return response()->download($result['path'],$result['filename'],$headers);
}
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,$exception->getMessage());
}
} }
} }
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