fixed
This commit is contained in:
parent
6d40b063c6
commit
c8ba60a049
@ -46,15 +46,14 @@ class ContractController extends BaseApiController
|
|||||||
];
|
];
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$res1 = Contract::create($data);
|
$res1= Contract::create($data);
|
||||||
if($res1->id){
|
if(isset($params['cars_info']) && !empty($params['cars_info'])){
|
||||||
$data['contract_logistic_id'] = $res1->id;
|
$cars = json_decode($params['cars_info'], true);
|
||||||
Db::commit();
|
Vehicle::where('id','in',array_column($cars,'id'))->update(['status'=>1]);
|
||||||
return $this->success('合同发起成功,等待审核',$data);
|
|
||||||
}else{
|
|
||||||
Db::rollback();
|
|
||||||
return $this->fail('合同发起失败,请稍后重试');
|
|
||||||
}
|
}
|
||||||
|
$data['contract_logistic_id'] = $res1->id;
|
||||||
|
Db::commit();
|
||||||
|
return $this->success('合同发起成功,等待审核',$data);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user