更新扫描取件状态
This commit is contained in:
parent
f414e55cb7
commit
355c15b76a
@ -785,46 +785,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
event('order.take', compact('order'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param User $user
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/17
|
||||
*/
|
||||
public function takeGoods($id, $orderSn)
|
||||
{
|
||||
$order = $this->dao->search([], null)->where('order_sn', $orderSn)->where('order_id', $id)->where('StoreOrder.is_del', 0)->find();
|
||||
if (!$order)
|
||||
throw new ValidateException('订单不存在');
|
||||
if ($order['status'] != 1 || $order['order_type'])
|
||||
throw new ValidateException('订单状态有误');
|
||||
$func = 'createUserLog';
|
||||
$user = $order->user;
|
||||
$order->status = 2;
|
||||
$order->verify_time = date('Y-m-d H:i:s');
|
||||
/*
|
||||
event('order.take.before', compact('order'));
|
||||
//订单记录
|
||||
$storeOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
|
||||
$orderStatus = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'type' => $storeOrderStatusRepository::TYPE_ORDER,
|
||||
'change_message' => '已收货',
|
||||
'change_type' => $storeOrderStatusRepository::ORDER_STATUS_TAKE,
|
||||
];
|
||||
Db::transaction(function () use ($order, $user,$storeOrderStatusRepository,$orderStatus,$func) {
|
||||
$this->takeAfter($order, $user);
|
||||
$order->save();
|
||||
$storeOrderStatusRepository->{$func}($orderStatus);
|
||||
});
|
||||
event('order.take', compact('order'));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单列表头部统计数据
|
||||
@ -2675,4 +2635,21 @@ class StoreOrderRepository extends BaseRepository
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @param $orderSn
|
||||
* 更新扫描发货状态
|
||||
*/
|
||||
public function takeGoods($orderId, $orderSn)
|
||||
{
|
||||
$order = $this->dao->search([], null)->where('order_sn', $orderSn)->where('order_id', $orderId)->where('StoreOrder.is_del', 0)->find();
|
||||
if (!$order)
|
||||
throw new ValidateException('订单不存在');
|
||||
if ($order['status'] != 0 || $order['order_type'])
|
||||
throw new ValidateException('订单状态有误');
|
||||
$order->status = 1;
|
||||
$order->mark = '快递员扫描取件';
|
||||
$order->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -882,13 +882,13 @@ class Auth extends BaseController
|
||||
}
|
||||
|
||||
//物流系统扫码取货确认商家发货
|
||||
public function takeGoods($id)
|
||||
public function deliveryGoods($id)
|
||||
{
|
||||
$orderSn = $this->request->param('order_sn');
|
||||
if (empty($orderSn)) {
|
||||
return app('json')->fail('参数order_sn不能为空');
|
||||
}
|
||||
app()->make(StoreOrderRepository::class)->takeGoods($id, $orderSn);
|
||||
app()->make(StoreOrderRepository::class)->deliveryGoods($id, $orderSn);
|
||||
return app('json')->success('确认收货成功');
|
||||
}
|
||||
|
||||
|
@ -200,6 +200,17 @@ class StoreOrder extends BaseController
|
||||
return app('json')->success('发货成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 扫描发货
|
||||
* @param $orderId
|
||||
* @param $orderSn
|
||||
*/
|
||||
public function deliveryGoods($orderId, $orderSn, StoreOrderRepository $repository)
|
||||
{
|
||||
app()->make(StoreOrderRepository::class)->takeGoods($orderId, $orderSn);
|
||||
return app('json')->success('扫描发货成功');
|
||||
}
|
||||
|
||||
public function payPrice($merId, StoreOrderRepository $repository)
|
||||
{
|
||||
list($start, $stop, $month) = $this->request->params([
|
||||
|
@ -22,7 +22,7 @@ use think\facade\Route;
|
||||
Route::group('api/', function () {
|
||||
Route::any('test', 'api.Auth/test');
|
||||
Route::any('dotest', 'api.Auth/dotest');
|
||||
Route::post('goods/take/:id', 'api.Auth/takeGoods');
|
||||
Route::post('goods/take/:id', 'api.Auth/deliveryGoods');
|
||||
Route::resource('upload', 'api.Upload');
|
||||
Route::post('articleCatch', 'api.Upload/article');
|
||||
//强制登录
|
||||
|
Loading…
x
Reference in New Issue
Block a user