增加公司租赁车辆列表接口
This commit is contained in:
parent
36c0fcd19e
commit
84a328e1f7
@ -142,7 +142,7 @@ class IndexController extends BaseApiController
|
||||
$pro_data[$k]['create_time']=time();
|
||||
}
|
||||
Db::name('company_property')->insertAll($pro_data);
|
||||
Db::name('vehicle_rent')->update(['status'=>2,'id'=>$vehicleRent['id']]);
|
||||
Db::name('vehicle_rent')->update(['status'=>2,'update_time'=>time(),'id'=>$vehicleRent['id']]);
|
||||
}
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
|
@ -57,4 +57,17 @@ class VehicleController extends BaseApiController
|
||||
return $this->fail($result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
public function carList():Json {
|
||||
//获取公司id
|
||||
$company_id = $this->userInfo['company_id'];
|
||||
//获取车辆
|
||||
$result = VehicleLogic::carList($company_id);
|
||||
//返回数据
|
||||
if($result['code'] == 1){
|
||||
return $this->success($result['msg'],$result['data']);
|
||||
}else{
|
||||
return $this->fail($result['msg']);
|
||||
}
|
||||
}
|
||||
}
|
@ -64,4 +64,18 @@ class VehicleLogic extends BaseLogic
|
||||
return ['code'=>0,'msg'=>$e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
public static function carList($company_id) {
|
||||
$rent = Db::name('vehicle_rent')->where('party_b',$company_id)->where('status',2)->select();
|
||||
if($rent->count() <= 0){
|
||||
return ['code'=>0,'msg'=>'未查找到车辆'];
|
||||
}
|
||||
foreach ($rent as $v) {
|
||||
$carArr = explode(',',$v['car_ids']);
|
||||
foreach ($carArr as $cid) {
|
||||
//请求物流系统获取车辆详情
|
||||
//todo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user