From 8080091c6397726851e86050ddf37e5d69a6b763 Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Sat, 26 Aug 2023 14:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E6=9C=89=E8=BD=A6?= =?UTF-8?q?=E8=BE=86=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/VehicleController.php | 18 ++++++++++++++++++ app/common/logic/vehicle/VehicleLogic.php | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/app/api/controller/VehicleController.php b/app/api/controller/VehicleController.php index 440568017..0c25e75ff 100644 --- a/app/api/controller/VehicleController.php +++ b/app/api/controller/VehicleController.php @@ -78,4 +78,22 @@ class VehicleController extends BaseApiController return $this->fail($result['msg']); } } + + public function addCar():Json { + //获取参数 + $params = $this->request->post(['license']); + //验证参数 + if(empty($params['license'])){ + return $this->fail('缺啥破必要参数'); + } + //获取公司id + $params['company_id'] = $this->userInfo['company_id']; + $result = VehicleLogic::addCar($params); + //返回数据 + if($result['code'] == 1){ + return $this->success($result['msg']); + }else{ + return $this->fail($result['msg']); + } + } } \ No newline at end of file diff --git a/app/common/logic/vehicle/VehicleLogic.php b/app/common/logic/vehicle/VehicleLogic.php index abbb076e1..add090f79 100644 --- a/app/common/logic/vehicle/VehicleLogic.php +++ b/app/common/logic/vehicle/VehicleLogic.php @@ -82,4 +82,18 @@ class VehicleLogic extends BaseLogic return ['code'=>0,'msg'=>'请求失败']; } } + + public static function addCar($params):array { + $company = Company::field('company_type')->where('id',$params['company_id'])->find(); + if($company['company_type'] != 18){ + return ['code'=>0,'msg'=>'非小组服务公司不能添加车辆']; + } + //http://logistics.lihaink.cn + $result = curl_post('http://www.lst.local/api/addVehicle',[],$params); + if($result['code'] == 1){ + return ['code'=>1,'msg'=>$result['msg']]; + }else{ + return ['code'=>0,'msg'=>$result['msg']]; + } + } } \ No newline at end of file