Commit bd1d8dce authored by hangjun83's avatar hangjun83

发票相关接口

parent 37068b3e
<?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\Http\Controllers\V1\Bhua;
use App\Services\Api\InvoicesService;
use Illuminate\Http\Request;
use Jiannei\Response\Laravel\Support\Facades\Response;
use App\Http\Controllers\V1\Controller;
use App\Support\Traits\Helpers;
use OpenApi\Annotations\Post;
use OpenApi\Annotations\RequestBody;
use OpenApi\Annotations\MediaType;
use OpenApi\Annotations\Schema;
use OpenApi\Annotations\Property;
use OpenApi\Annotations\Response as AnnotationResponse;
use OpenApi\Annotations as OA;
class InvoiceController extends Controller
{
use Helpers;
public function __construct(InvoicesService $invoicesService)
{
$this->invoicesService= $invoicesService;
$this->controllerType = 'rhawn';
}
/**
* @Post(
* path="/openapi/bhua/invoice/getInvoiceSorderItems",
* tags={"百化 - 发票相关接口"},
* summary="发票订单列表数据",
* description="发票订单列表",
* @RequestBody(
* @MediaType(
* mediaType="application/json",
* @Schema(
* required={"invoiceNumber"},
* @Property(property="invoiceNumber", @Schema(type="string"),description="返回数据集数量"),
* example={"invoiceNumber" : 0999899011}
* ),
* )
* ),
* @OA\Parameter(
* description="用户获取的token值",
* in="header",
* name="authorization",
* required=true,
* @OA\Schema(type="string"),
* @OA\Examples(example="authorization", value="bearerNWJiNDhkNzlmNjg0N2FlMmZiYjliZWM3NGVkNzIyMjNleUpsZUhCcGNtVWlPakUyTmpRMk1EazJORGNzSW1oaGMyZ2lPaUl5ZEhsc1JIQlhkWFpNUVdaWGJVRllJbjA9",summary=""),
* ),
* @AnnotationResponse(
* response="200",
* description="正常操作响应",
* @MediaType(
* mediaType="application/json",
* @Schema(
* allOf={
* @Schema(ref="#/components/schemas/ApiResponse"),
* @Schema(
* type="object",
* @Property(property="data", ref="#/components/schemas/InvoiceOrderItemsList")
* )
* }
* )
* )
* ),
* security={
* {"bearer_token":{}}
* }
* )
*/
public function getInvoiceSorderItems(Request $request)
{
$customerCode = $request->get('customer_code');
if(!$customerCode){
return Response::ok('客户编号不存在!');
}
$this->checkCustomerType($customerCode,$this->controllerType);
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
$requestParams = array_merge($requestParams,['customer_code' => $customerCode]);
try{
$orderItems = $this->invoicesService->getInoviceItems($requestParams);
if($orderItems){
$orderItems = $this->formatKeysfromArray($orderItems,'toCamelCase');
}
return Response::success($orderItems,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取失败');
}
}
}
......@@ -55,5 +55,9 @@ $api->version('v1', function($api) {
$api->group(['namespace'=>'App\Http\Controllers\Internal\V1\Bhua','middleware' => ['throttle:60,1','apiAuth'], 'providers' => 'jwt'], function($api) {
$api->post('/openapi/internal/bhua/getAllBrands', ['permission' => 'orders.getAllBrands', 'uses'=>'ProductsController@getAllBrands']);
});
$api->group(['namespace'=>'App\Http\Controllers\V1\Bhua','middleware' => ['throttle:60,1','apiAuth'], 'providers' => 'jwt'], function($api) {
$api->post('/openapi/bhua/invoice/getInvoiceSorderItems', ['permission' => 'orders.getInvoiceSorderItems', 'uses'=>'InvoiceController@getInvoiceSorderItems']);
});
});
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