Commit 5ac9b77f authored by hangjun83's avatar hangjun83

优化

parent f05f1c23
<?php
namespace App\Http\Controllers\Internal\V1\Bhua;
use App\Services\Api\BhuaProductsService;
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 ProductsController extends Controller
{
use Helpers;
public function __construct(BhuaProductsService $bhuaProductService)
{
$this->bhuaProdcutService = $bhuaProductService;
}
public function getAllBrands(Request $request)
{
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
try{
$brandsList = $this->bhuaProdcutService->getAllBrands($requestParams);
if($brandsList){
$brandsList = $this->formatKeysfromArray($brandsList,'toCamelCase');
}
return Response::success($brandsList,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取品牌列表失败');
}
}
}
......@@ -47,5 +47,8 @@ $api->version('v1', function($api) {
$api->post('/openapi/bhua/products/getAllBrands', ['permission' => 'orders.getAllBrands', 'uses'=>'ProductsController@getAllBrands']);
});
$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']);
});
});
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