update index

This commit is contained in:
unknown 2023-08-29 19:21:15 +08:00
parent d5f1a2efd7
commit 3e1e114ad3
3 changed files with 28 additions and 0 deletions

View File

@ -19,6 +19,7 @@ use app\api\logic\IndexLogic;
use app\common\model\Company;
use app\common\model\company\CompanyProperty;
use app\common\model\contract\VehicleContract;
use app\common\model\vehicle\VehicleRent;
use think\facade\Db;
use think\facade\Log;
use think\response\Json;
@ -133,6 +134,15 @@ class IndexController extends BaseApiController
return $this->fail('数据不存在');
}
$result = $model->save($param);
if($result && isset($param['status']) && $param['status'] == 4){
$cars = json_decode($model['cars_info'],true);
foreach($cars as $k=>$v) {
$cars[$k]['status'] = 0;
$cars[$k]['company_id'] = $model['company_b_id'];
$cars[$k]['rent_time'] = $model['create_time'];
}
VehicleRent::saveAll($cars);
}
//返回
return $result ? $this->success('更新成功') : $this->fail('更新失败');
}

View File

@ -28,5 +28,13 @@ class VehicleController extends BaseApiController
}
}
// public function vehicleList() {
// //获取参数
// $params = $this->request->get(['is_rent','license']);
// if(empty($params['is_rent'])){
// return $this->fail('缺少必要参数');
// }
// }
}

View File

@ -0,0 +1,10 @@
<?php
namespace app\common\model\vehicle;
use app\common\model\BaseModel;
class VehicleRent extends BaseModel
{
protected $name = 'vehicle_rent';
}