update
This commit is contained in:
parent
e57a1d4d60
commit
ceae1ec969
@ -4,6 +4,7 @@ namespace app\adminapi\logic\vehicle;
|
||||
use app\common\logic\GpsLogic;
|
||||
use app\common\model\vehicle\Vehicle;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -77,6 +78,12 @@ class VehicleLogic extends BaseLogic
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = Vehicle::findOrEmpty($params['id']);
|
||||
$data['mileage'] = 0;
|
||||
if($data['status'] == 2){
|
||||
//获取租赁信息
|
||||
$data['rent_info'] = VehicleRent::where('car_id',$data['id'])->find();
|
||||
|
||||
}
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -128,6 +128,7 @@ class IndexController extends BaseApiController
|
||||
foreach($vehicle as $v){
|
||||
$data[] = [
|
||||
'car_id' => $v['id'],
|
||||
'contract_id' => $contract['id'],
|
||||
'company_id' => $contract['company_b_id'],
|
||||
'company_name' => $contract['company_b_name'],
|
||||
'company_user' => $contract['company_b_user'],
|
||||
|
@ -78,6 +78,7 @@ class VehicleController extends BaseApiController
|
||||
]);
|
||||
$vehicleRent = VehicleRent::create([
|
||||
'car_id'=> $vehicle->id,
|
||||
'contract_id' => 0,
|
||||
'company_id' => $params['company_id'],
|
||||
'company_name' => $params['company_name'],
|
||||
'company_user' => $params['company_user'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user