新增车辆详情接口
This commit is contained in:
parent
dc3c91719e
commit
35f172a673
@ -3,6 +3,7 @@
|
|||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
use app\common\logic\vehicle\VehicleLogic;
|
use app\common\logic\vehicle\VehicleLogic;
|
||||||
|
use app\common\model\Company;
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
|
|
||||||
class VehicleController extends BaseApiController
|
class VehicleController extends BaseApiController
|
||||||
@ -58,7 +59,7 @@ class VehicleController extends BaseApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function carList():Json {
|
public function townCompanyCarList():Json {
|
||||||
//获取参数
|
//获取参数
|
||||||
$params = $this->request->get(['is_rent','license','company_name','page_no','page_size']);
|
$params = $this->request->get(['is_rent','license','company_name','page_no','page_size']);
|
||||||
if(empty($params['is_rent'])){
|
if(empty($params['is_rent'])){
|
||||||
@ -70,7 +71,7 @@ class VehicleController extends BaseApiController
|
|||||||
//获取公司id
|
//获取公司id
|
||||||
$params['company_id'] = $this->userInfo['company_id'];
|
$params['company_id'] = $this->userInfo['company_id'];
|
||||||
//获取车辆
|
//获取车辆
|
||||||
$result = VehicleLogic::carList($params);
|
$result = VehicleLogic::townCompanyCarList($params);
|
||||||
//返回数据
|
//返回数据
|
||||||
if($result['code'] == 1){
|
if($result['code'] == 1){
|
||||||
return $this->success($result['msg'],$result['data']);
|
return $this->success($result['msg'],$result['data']);
|
||||||
@ -96,4 +97,27 @@ class VehicleController extends BaseApiController
|
|||||||
return $this->fail($result['msg']);
|
return $this->fail($result['msg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCarInfo():Json {
|
||||||
|
//获取参数
|
||||||
|
$params = $this->request->get(['car_id','car_type']);
|
||||||
|
if(empty($params['car_id']) || empty($params['car_type'])){
|
||||||
|
return $this->fail('缺少必要参数');
|
||||||
|
}
|
||||||
|
if(!in_array($params['car_type'],[1,2])){
|
||||||
|
return $this->fail('车辆类型错误');
|
||||||
|
}
|
||||||
|
//获取车辆详情
|
||||||
|
$result = curl_post('http://logistics.lihaink.cn/api/carInfo',[],$params);
|
||||||
|
//返回数据
|
||||||
|
if($result && $result['code'] == 1){
|
||||||
|
if($result['data']['type'] == 1 && $result['data']['lessee_two_flag'] == 1){
|
||||||
|
$lessee_two_company = Company::where('id','lessee_two_company_id')->find();
|
||||||
|
$result['data']['lessee_two_company_address'] = $lessee_two_company['address'];
|
||||||
|
}
|
||||||
|
return $this->success($result['msg'],$result['data']);
|
||||||
|
}else{
|
||||||
|
return $this->fail($result['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ use think\facade\Db;
|
|||||||
class VehicleLogic extends BaseLogic
|
class VehicleLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
public static string $url = 'http://logistics.lihaink.cn';
|
public static string $url = 'http://logistics.lihaink.cn';
|
||||||
|
// public static string $url = 'http://www.lst.local';
|
||||||
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){
|
||||||
@ -71,10 +72,10 @@ class VehicleLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function carList($params):array {
|
public static function townCompanyCarList($params):array {
|
||||||
//请求物流系统获取车辆详情
|
//请求物流系统获取车辆详情
|
||||||
$result = curl_post(self::$url.'/api/companyCarList',[],$params);
|
$result = curl_post(self::$url.'/api/companyCarList',[],$params);
|
||||||
if($result['code'] == 1){
|
if($result && $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){
|
||||||
$lessee_two_company = Company::where('id','lessee_two_company_id')->find();
|
$lessee_two_company = Company::where('id','lessee_two_company_id')->find();
|
||||||
@ -95,7 +96,7 @@ class VehicleLogic extends BaseLogic
|
|||||||
return ['code'=>0,'msg'=>'非小组服务公司不能添加车辆'];
|
return ['code'=>0,'msg'=>'非小组服务公司不能添加车辆'];
|
||||||
}
|
}
|
||||||
$result = curl_post(self::$url.'/api/addVehicle',[],$params);
|
$result = curl_post(self::$url.'/api/addVehicle',[],$params);
|
||||||
if($result['code'] == 1){
|
if($result && $result['code'] == 1){
|
||||||
return ['code'=>1,'msg'=>$result['msg']];
|
return ['code'=>1,'msg'=>$result['msg']];
|
||||||
}else{
|
}else{
|
||||||
return ['code'=>0,'msg'=>$result['msg']];
|
return ['code'=>0,'msg'=>$result['msg']];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user