update index
This commit is contained in:
parent
d5f1a2efd7
commit
3e1e114ad3
@ -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('更新失败');
|
||||
}
|
||||
|
@ -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('缺少必要参数');
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
10
app/common/model/vehicle/VehicleRent.php
Normal file
10
app/common/model/vehicle/VehicleRent.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\vehicle;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class VehicleRent extends BaseModel
|
||||
{
|
||||
protected $name = 'vehicle_rent';
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user