60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\logic\vehicle\VehicleLogic;
|
|
use think\response\Json;
|
|
|
|
class VehicleController extends BaseApiController
|
|
{
|
|
public function setContractByTownCompany():Json
|
|
{
|
|
//获取参数
|
|
$params = $this->request->post(['party_a','num','car_ids']);
|
|
//验证参数
|
|
if(empty($params['party_a']) || empty($params['num']) || empty($params['car_ids'])){
|
|
return $this->fail('缺少必要参数');
|
|
}
|
|
if(empty($this->userInfo['company_id'])){
|
|
return $this->fail('签约公司不存在');
|
|
}
|
|
$params['party_b'] = $this->userInfo['company_id'];
|
|
if($params['party_b'] == $params['party_a']){
|
|
return $this->fail('甲方和乙方不能是同一个公司');
|
|
}
|
|
$params['rent_type'] = 1;//镇街公司批量租赁
|
|
$result = VehicleLogic::initiate_contract($params);
|
|
//返回数据
|
|
if($result['code'] == 1){
|
|
return $this->success($result['msg'],$result['data']);
|
|
}else{
|
|
return $this->fail($result['msg']);
|
|
}
|
|
}
|
|
|
|
public function setContractByVillageCompany():Json
|
|
{
|
|
//获取参数
|
|
$params = $this->request->post(['party_b','car_ids']);
|
|
//验证参数
|
|
if(empty($params['party_b']) || empty($params['car_ids'])){
|
|
return $this->fail('缺少必要参数');
|
|
}
|
|
if(empty($this->userInfo['company_id'])){
|
|
return $this->fail('签约公司不存在');
|
|
}
|
|
$params['party_a'] = $this->userInfo['company_id'];
|
|
if($params['party_b'] == $params['party_a']){
|
|
return $this->fail('甲方和乙方不能是同一个公司');
|
|
}
|
|
$params['rent_type'] = 2;//小组服务公司单辆租赁
|
|
$params['num'] = 1;
|
|
$result = VehicleLogic::initiate_contract($params);
|
|
//返回数据
|
|
if($result['code'] == 1){
|
|
return $this->success($result['msg'],$result['data']);
|
|
}else{
|
|
return $this->fail($result['msg']);
|
|
}
|
|
}
|
|
} |