Commit 848cbaad authored by hj's avatar hj

更新提交

parent f0b5e1ca
<?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\Chemicals;
use App\Services\Api\RhawnOrdersService;
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 MsdsController extends Controller
{
use Helpers;
public function __construct(RhawnOrdersService $rhawnOrdersService)
{
$this->rhawnOrdersService= $rhawnOrdersService;
$this->controllerType = 'rhawn';
}
public function getMsds(Request $request)
{
$customerCode = $request->get('customer_code');
$companyCode = $request->get('company_code');
$cusNumber = $request->get('cus_number');
if(!$companyCode){
return Response::ok('验证失败,参数缺少!');
}
if(!$customerCode){
return Response::ok('客户编号不存在!');
}
$this->checkCustomerType($customerCode,$this->controllerType);
$requestParams = $this->formatKeysfromArray($request->all(),'toUnderScore');
$requestParams = array_merge($requestParams,['customer_code' => $customerCode]);
try{
$orderList = $this->rhawnOrdersService->getCustomerRhawnOrdersList($requestParams);
if($orderList){
$orderList = $this->formatKeysfromArray($orderList,'toCamelCase');
}
return Response::success($orderList,'操作成功');
}catch(\Throwable $exception){
return $this->returnErrorExecptionResponse($exception,'获取订单列表失败');
}
}
}
......@@ -12,5 +12,10 @@ $api->version('v1', function($api) {
$api->post('/openapi/chemsite/orders/createOrders', ['permission' => 'chemsite.createOrders', 'uses'=>'OrdersController@createCustomerNewOrder']);
});
$api->group(['namespace'=>'App\Http\Controllers\V1\Chemicals','middleware' => ['maintenance','throttle:60,1','apiAuth','requestlogs'], 'providers' => 'jwt'], function($api) {
// 新建订单
$api->post('/openapi/chemicals/msds/get', ['permission' => 'chemicals.getMsds', 'uses'=>'MsdsController@getMsds']);
});
});
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