fixed
This commit is contained in:
parent
c8ba60a049
commit
a925881072
@ -47,10 +47,6 @@ class ContractController extends BaseApiController
|
||||
Db::startTrans();
|
||||
try {
|
||||
$res1= Contract::create($data);
|
||||
if(isset($params['cars_info']) && !empty($params['cars_info'])){
|
||||
$cars = json_decode($params['cars_info'], true);
|
||||
Vehicle::where('id','in',array_column($cars,'id'))->update(['status'=>1]);
|
||||
}
|
||||
$data['contract_logistic_id'] = $res1->id;
|
||||
Db::commit();
|
||||
return $this->success('合同发起成功,等待审核',$data);
|
||||
|
@ -14,7 +14,7 @@ use think\response\Json;
|
||||
*/
|
||||
class VehicleController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['getCarLocal','getCarHistory','addSelfCar','updateVehicleRent','cancelRent','delRentUseInfo','getFreeCars'];
|
||||
public array $notNeedLogin = ['getCarLocal','getCarHistory','addSelfCar','updateVehicleRent','cancelRent','delRentUseInfo','getFreeCars','updateVehicleStatusToBuy'];
|
||||
|
||||
//获取车辆当前位置
|
||||
public function getCarLocal():Json {
|
||||
@ -178,6 +178,18 @@ class VehicleController extends BaseApiController
|
||||
return $this->success('修改成功');
|
||||
}
|
||||
|
||||
public function updateVehicleStatusToBuy() {
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$carIds = $this->request->post('car_ids');
|
||||
if(empty($carIds)){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
Vehicle::where('id','in',$carIds)->where('status',0)->update(['status'=>1]);
|
||||
return $this->success('success');
|
||||
}
|
||||
|
||||
//获取空闲车辆
|
||||
public function getFreeCars(): Json
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user