新增订单发货状态接口
This commit is contained in:
parent
278c038e31
commit
b7a242df93
@ -785,6 +785,44 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
event('order.take', compact('order'));
|
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'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单列表头部统计数据
|
* 获取订单列表头部统计数据
|
||||||
|
@ -72,6 +72,16 @@ class Auth extends BaseController
|
|||||||
return app('json')->success($logisticsInfo);
|
return app('json')->success($logisticsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function takeGoods($id)
|
||||||
|
{
|
||||||
|
$orderSn = $this->request->param('order_sn');
|
||||||
|
if (empty($orderSn)) {
|
||||||
|
return app('json')->fail('参数order_sn不能为空');
|
||||||
|
}
|
||||||
|
app()->make(StoreOrderRepository::class)->takeGoods($id, $orderSn);
|
||||||
|
return app('json')->success('确认收货成功');
|
||||||
|
}
|
||||||
|
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
$type = $this->request->param('type');
|
$type = $this->request->param('type');
|
||||||
|
@ -22,6 +22,7 @@ use think\facade\Route;
|
|||||||
Route::group('api/', function () {
|
Route::group('api/', function () {
|
||||||
Route::any('test', 'api.Auth/test');
|
Route::any('test', 'api.Auth/test');
|
||||||
Route::any('dotest', 'api.Auth/dotest');
|
Route::any('dotest', 'api.Auth/dotest');
|
||||||
|
Route::post('goods/take/:id', 'api.Auth/takeGoods');
|
||||||
Route::resource('upload', 'api.Upload');
|
Route::resource('upload', 'api.Upload');
|
||||||
Route::post('articleCatch', 'api.Upload/article');
|
Route::post('articleCatch', 'api.Upload/article');
|
||||||
//强制登录
|
//强制登录
|
||||||
|
Loading…
x
Reference in New Issue
Block a user