增加物流信息对外接口

This commit is contained in:
weiz 2023-11-08 15:00:07 +08:00
parent 87cf5fc481
commit 6084700454

View File

@ -1,6 +1,7 @@
<?php <?php
namespace app\common\controller; namespace app\common\controller;
use app\api\logic\LogisticsLogic;
use app\common\model\logistics\Logistics; use app\common\model\logistics\Logistics;
use app\common\model\logistics\LogisticsRecord; use app\common\model\logistics\LogisticsRecord;
use app\common\model\logistics\Product; use app\common\model\logistics\Product;
@ -100,4 +101,77 @@
//返回数据 //返回数据
return $this->success('请求成功',$logistics->toArray()); return $this->success('请求成功',$logistics->toArray());
} }
/*
* 获取配送员物流信息列表
* @method get
* @param int $courier_id 配送员id
* @param int $status 物流状态
* @param int $page_size 每页数量
* @param int $page_num 页码
* @return \think\response\Json
*/
public function courierLogisticsList(): \think\response\Json
{
//获取参数
$params = $this->request->post(['user_id','user_type','status','page_size','page_num','keywords']);
//验证参数
if(empty($params['user_id'])) return $this->fail('参数错误');
if(!isset($params['user_type'])) return $this->fail('参数错误');
if(empty($params['keywords'])) $params['keywords'] = '';
//返回数据
return $this->data(LogisticsLogic::list($params));
}
/*
* 获取物流信息详情
* @method get
* @param int $logistics_id 物流id
* @return \think\response\Json
*/
public function courierLogisticsDetail(): \think\response\Json
{
//获取参数
$logistics_id = $this->request->post('logistics_id');
//验证参数
if(empty($logistics_id)) return $this->fail('参数错误');
//返回数据
return $this->data(LogisticsLogic::cDetail($logistics_id));
}
/*
* 配送员提取商品
* @method post
* @param int $logistics_id 物流id
* @return \think\response\Json
*/
public function courierTakeGoods(): \think\response\Json
{
//获取参数
$params = $this->request->post(['logistics_id','order_id','order_sn']);
//验证参数
if(empty($params['logistics_id']) || empty($params['order_id']) || empty($params['order_sn'])) return $this->fail('参数错误');
//提取商品
$result = LogisticsLogic::takeGoods($params);
//返回数据
return $result['code'] ==1 ? $this->success('提取成功') : $this->fail($result['msg']);
}
/*
* 配送员完成配送
* @method post
* @param int $logistics_id 物流id
* @return \think\response\Json
*/
public function courierCompleteDelivery(): \think\response\Json
{
//获取参数
$params = $this->request->post(['logistics_id','take_code']);
//验证参数
if(empty($params['logistics_id']) || empty($params['take_code'])) return $this->fail('参数错误');
//完成配送
$result = LogisticsLogic::doneDelivery($params);
//返回数据
return $result['code'] ==1 ? $this->success('配送完成') : $this->fail($result['msg']);
}
} }