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