logistics_sy/app/api/controller/LogisticController.php

84 lines
2.4 KiB
PHP

<?php
namespace app\api\controller;
use think\response\Json;
class LogisticController extends BaseApiController
{
//物流信息列表
public function lists(): Json
{
//获取参数
$params = $this->request->get(['status','page_size','page_num','keywords']);
if($this->userInfo['company_type'] != 18){
return $this->fail('当前用户身份错误');
}
$params['user_id'] = $this->userInfo['user_id'];
$params['user_type'] = 0;
//获取数据
$result = curl_post(env('project.logistic_domain').'/common/logistic/courierLogisticsList',$params);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return $this->success('请求成功',$result['data']['data']);
}
//物流信息详情
public function detail(): Json
{
$params = $this->request->get(['id']);
if(empty($params['id'])){
return $this->fail('参数错误');
}
//获取数据
$result = curl_post(env('project.logistic_domain').'/common/logistic/courierLogisticsDetail',[
'logistics_id' => $params['id']
]);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return $this->success('请求成功',$result['data']);
}
//提取商品
public function takeGoods(): Json
{
//获取参数
$params = $this->request->post(['id','order_id','order_sn']);
//验证参数
if(empty($params['id']) || empty($params['order_id']) || empty($params['order_sn'])) {
return $this->fail('参数错误');
}
//获取数据
$result = curl_post(env('project.logistic_domain').'/common/logistic/courierTakeGoods',[
'logistics_id' => $params['id'],
'order_id' => $params['order_id'],
'order_sn' => $params['order_sn'],
]);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return $this->success('请求成功');
}
//完成配送
public function delivery(): Json
{
//获取参数
$params = $this->request->post(['id','take_code']);
//验证参数
if(empty($params['id']) || empty($params['take_code'])) {
return $this->fail('参数错误');
}
//获取数据
$result = curl_post(env('project.logistic_domain').'/common/logistic/courierCompleteDelivery',[
'logistics_id' => $params['id'],
'take_code' => $params['take_code'],
]);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return $this->success('请求成功');
}
}