增加自有车辆的逻辑判断
This commit is contained in:
parent
b71a8a2c09
commit
8b2a2e7b23
@ -10,6 +10,7 @@ use think\facade\Db;
|
|||||||
|
|
||||||
class VehicleLogic extends BaseLogic
|
class VehicleLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
|
public static string $url = 'http://logistics.lihaink.cn';
|
||||||
public static function initiate_contract($data):array {
|
public static function initiate_contract($data):array {
|
||||||
$party_b = Company::field('company_type')->where('id',$data['party_b'])->find();
|
$party_b = Company::field('company_type')->where('id',$data['party_b'])->find();
|
||||||
if($data['rent_type'] == 1){
|
if($data['rent_type'] == 1){
|
||||||
@ -22,6 +23,11 @@ class VehicleLogic extends BaseLogic
|
|||||||
if($party_b['company_type'] != 18){
|
if($party_b['company_type'] != 18){
|
||||||
return ['code'=>0,'msg'=>'非小组服务公司不能签约'];
|
return ['code'=>0,'msg'=>'非小组服务公司不能签约'];
|
||||||
}
|
}
|
||||||
|
//判断小组服务公司是否添加了自有车辆
|
||||||
|
$selfCar = curl_post(self::$url.'/api/getSelfCar',[],['company_id'=>$data['party_b']]);
|
||||||
|
if($selfCar && $selfCar['data']['has_car']){
|
||||||
|
return ['code'=>0,'msg'=>'已上传自有车辆不能签约'];
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
return ['code'=>0,'msg'=>'参数错误'];
|
return ['code'=>0,'msg'=>'参数错误'];
|
||||||
}
|
}
|
||||||
@ -67,7 +73,7 @@ class VehicleLogic extends BaseLogic
|
|||||||
|
|
||||||
public static function carList($params):array {
|
public static function carList($params):array {
|
||||||
//请求物流系统获取车辆详情
|
//请求物流系统获取车辆详情
|
||||||
$result = curl_post('http://logistics.lihaink.cn/api/companyCarList',[],$params);
|
$result = curl_post(self::$url.'/api/companyCarList',[],$params);
|
||||||
if($result['code'] == 1){
|
if($result['code'] == 1){
|
||||||
foreach ($result['data'] as $k=>$v){
|
foreach ($result['data'] as $k=>$v){
|
||||||
if($v['lessee_two_flag'] == 1){
|
if($v['lessee_two_flag'] == 1){
|
||||||
@ -88,8 +94,7 @@ class VehicleLogic extends BaseLogic
|
|||||||
if($company['company_type'] != 18){
|
if($company['company_type'] != 18){
|
||||||
return ['code'=>0,'msg'=>'非小组服务公司不能添加车辆'];
|
return ['code'=>0,'msg'=>'非小组服务公司不能添加车辆'];
|
||||||
}
|
}
|
||||||
//http://logistics.lihaink.cn
|
$result = curl_post(self::$url.'/api/addVehicle',[],$params);
|
||||||
$result = curl_post('http://www.lst.local/api/addVehicle',[],$params);
|
|
||||||
if($result['code'] == 1){
|
if($result['code'] == 1){
|
||||||
return ['code'=>1,'msg'=>$result['msg']];
|
return ['code'=>1,'msg'=>$result['msg']];
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user