This commit is contained in:
unknown 2023-08-30 13:36:12 +08:00
parent a3a392555e
commit 692a0c9cf2
4 changed files with 22 additions and 11 deletions

View File

@ -21,8 +21,8 @@ class ContractController extends BaseAdminController
if(!$contract || $contract->isEmpty()){ if(!$contract || $contract->isEmpty()){
return $this->fail('数据不存在'); return $this->fail('数据不存在');
} }
if($contract['status'] == 3 || $contract['status'] == 4){ if($contract['status'] != 1){
return $this->fail('合同已发送'); return $this->fail('合同状态错误');
} }
//获取平台公司 //获取平台公司
$platform = Platform::find(1); $platform = Platform::find(1);
@ -39,15 +39,15 @@ class ContractController extends BaseAdminController
$contract->save([ $contract->save([
'id' => $contract['id'], 'id' => $contract['id'],
'contract_no' => $signRes->data, 'contract_no' => $signRes->data,
'status' => 3 'status' => 2
]); ]);
$this->sendSms($params['id']); $this->sendSms($params['id']);
$newData = Contract::where('id', $params['id'])->find(); $newData = Contract::where('id', $params['id'])->find();
curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[ curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[
'id' => $contract['id'], 'contract_logistic_id' => $contract['id'],
'contract_no' => $signRes->data, 'contract_no' => $signRes->data,
'url' => $newData['url'], 'url' => $newData['url'],
'status' => 3 'status' => 2
]); ]);
return $this->success('合同发送成功'); return $this->success('合同发送成功');
} else { } else {

View File

@ -47,7 +47,7 @@ class ContractController extends BaseApiController
'company_b_email' => $params['company_email'], 'company_b_email' => $params['company_email'],
'num' => $params['num'], 'num' => $params['num'],
'cars_info' => $cars->toJson(), 'cars_info' => $cars->toJson(),
'status' => 1, 'status' => 0,
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
]; ];
@ -57,7 +57,8 @@ class ContractController extends BaseApiController
$carStatus = Vehicle::where('id','in',array_column($cars->toArray(),'id'))->update(['status'=>2,'update_time'=>time()]); $carStatus = Vehicle::where('id','in',array_column($cars->toArray(),'id'))->update(['status'=>2,'update_time'=>time()]);
//返回 //返回
if($result->id && $carStatus) { if($result->id && $carStatus) {
$data['id'] = $result->id; $data['contract_logistic_id'] = $result->id;
$data['type'] = 0;
return $this->success('合同发起成功,等待审核',$data); return $this->success('合同发起成功,等待审核',$data);
}else{ }else{
return $this->fail('请求失败'); return $this->fail('请求失败');

View File

@ -107,16 +107,16 @@ class IndexController extends BaseApiController
if ($contract['signing_timer'] == 0) { if ($contract['signing_timer'] == 0) {
Contract::where('id',$params['id'])->update(['signing_timer'=>1]); Contract::where('id',$params['id'])->update(['signing_timer'=>1]);
curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[ curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[
'id' => $contract['id'], 'contract_logistic_id' => $contract['id'],
'signing_timer' => 1, 'signing_timer' => 1,
]); ]);
}else if($contract['signing_timer'] == 1) { }else if($contract['signing_timer'] == 1) {
Contract::where('id',$params['id'])->update(['signing_timer'=>2,'status'=>4]); Contract::where('id',$params['id'])->update(['signing_timer'=>2,'status'=>3]);
Vehicle::where('id','in',$carIds)->update(['status'=>3]); Vehicle::where('id','in',$carIds)->update(['status'=>3]);
curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[ curl_post('https://worker-task.lihaink.cn/api/index/notifyVehicleContractUpdate',[],[
'id' => $contract['id'], 'contract_logistic_id' => $contract['id'],
'signing_timer' => 2, 'signing_timer' => 2,
'status' => 4 'status' => 3
]); ]);
curl_post('https://worker-task.lihaink.cn/v1/notify_property',[],[ curl_post('https://worker-task.lihaink.cn/v1/notify_property',[],[
'company_id' => $contract['company_b_id'], 'company_id' => $contract['company_b_id'],

View File

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