新增车辆列表接口
This commit is contained in:
parent
926daa4e05
commit
9b1597dadc
@ -59,10 +59,18 @@ class VehicleController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function carList():Json {
|
public function carList():Json {
|
||||||
|
//获取参数
|
||||||
|
$params = $this->request->get(['is_rent','license','company_name','page_no','page_size']);
|
||||||
|
if(empty($params['is_rent'])){
|
||||||
|
return $this->fail('缺少必要参数');
|
||||||
|
}
|
||||||
|
if(!in_array($params['is_rent'],[1,2])){
|
||||||
|
return $this->fail('参数错误');
|
||||||
|
}
|
||||||
//获取公司id
|
//获取公司id
|
||||||
$company_id = $this->userInfo['company_id'];
|
$params['company_id'] = $this->userInfo['company_id'];
|
||||||
//获取车辆
|
//获取车辆
|
||||||
$result = VehicleLogic::carList($company_id);
|
$result = VehicleLogic::carList($params);
|
||||||
//返回数据
|
//返回数据
|
||||||
if($result['code'] == 1){
|
if($result['code'] == 1){
|
||||||
return $this->success($result['msg'],$result['data']);
|
return $this->success($result['msg'],$result['data']);
|
||||||
|
@ -65,17 +65,21 @@ class VehicleLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function carList($company_id) {
|
public static function carList($params):array {
|
||||||
$rent = Db::name('vehicle_rent')->where('party_b',$company_id)->where('status',2)->select();
|
//请求物流系统获取车辆详情
|
||||||
if($rent->count() <= 0){
|
$result = curl_post('http://www.lst.local/api/companyCarList',[],$params);
|
||||||
return ['code'=>0,'msg'=>'未查找到车辆'];
|
if($result['code'] == 1){
|
||||||
}
|
foreach ($result['data'] as $k=>$v){
|
||||||
foreach ($rent as $v) {
|
if($v['lessee_two_flag'] == 1){
|
||||||
$carArr = explode(',',$v['car_ids']);
|
$lessee_two_company = Company::where('id','lessee_two_company_id')->find();
|
||||||
foreach ($carArr as $cid) {
|
$result['data'][$k]['lessee_two_company_address'] = $lessee_two_company['address'];
|
||||||
//请求物流系统获取车辆详情
|
}else{
|
||||||
//todo
|
$result['data'][$k]['lessee_two_company_address'] = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return ['code'=>1,'msg'=>'请求成功','data'=>$result['data']];
|
||||||
|
}else{
|
||||||
|
return ['code'=>0,'msg'=>'请求失败'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user