Commit 3f294329 authored by hangjun83's avatar hangjun83

百化产品接口更新

parent 85c1c560
......@@ -39,25 +39,4 @@ class ProductsController extends Controller
return $this->returnErrorExecptionResponse($exception,'获取品牌列表失败');
}
}
public function getProductsByBrand(Request $request)
{
$brandId = $request->get('brandId');
if(!$brandId){
return Response::ok('品牌id不存在!');
}
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
try{
$productsList = $this->bhuaProdcutService->getProductsByBrandId($requestParams);
if($productsList){
$productsList = $this->formatKeysfromArray($productsList,'toCamelCase');
}
return Response::success($productsList,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取品牌产品列表失败');
}
}
}
......@@ -95,4 +95,24 @@ class ProductsController extends Controller
}
}
public function getProductsByBrand(Request $request)
{
$brandId = $request->get('brandId');
if(!$brandId){
return Response::ok('品牌id不存在!');
}
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
try{
$productsList = $this->bhuaProdcutService->getProductsByBrandId($requestParams);
if($productsList){
$productsList = $this->formatKeysfromArray($productsList,'toCamelCase');
}
return Response::success($productsList,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取品牌产品列表失败');
}
}
}
......@@ -45,11 +45,11 @@ $api->version('v1', function($api) {
$api->group(['namespace'=>'App\Http\Controllers\V1\Bhua','middleware' => ['throttle:60,1','apiAuth'], 'providers' => 'jwt'], function($api) {
$api->post('/openapi/bhua/products/getAllBrands', ['permission' => 'orders.getAllBrands', 'uses'=>'ProductsController@getAllBrands']);
$api->post('/openapi/bhua/products/getProductsByBrandId', ['permission' => 'orders.getProductsByBrandId', 'uses'=>'ProductsController@getProductsByBrand']);
});
$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->post('/openapi/internal/bhua/getProductsByBrandId', ['permission' => 'orders.getProductsByBrandId', 'uses'=>'ProductsController@getProductsByBrand']);
});
});
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