|
@@ -286,31 +286,27 @@ class Order extends Base
|
|
|
{
|
|
|
// 验证请求参数
|
|
|
$validate = new \app\api\validate\Order();
|
|
|
- $params = ['order_sn' => $this->request->post('order_sn')];
|
|
|
+ $orderId = $this->request->post('orderId');
|
|
|
+ $params = ['orderId' => $orderId];
|
|
|
if (!$validate->scene('detail')->check($params)) {
|
|
|
$this->error($validate->getError());
|
|
|
- }
|
|
|
-
|
|
|
- $order_sn = $this->request->post('order_sn');
|
|
|
- $order = OrderModel::getByOrderSn($order_sn);
|
|
|
+ }
|
|
|
+ $order = OrderService::getByOrderId($orderId);
|
|
|
if (empty($order)) {
|
|
|
$this->error('订单不存在');
|
|
|
}
|
|
|
if ($order->user_id != $this->auth->id) {
|
|
|
- $this->error('不能越权操作');
|
|
|
- }
|
|
|
- if ($order->status == 'hidden') {
|
|
|
- $this->error('订单已失效!');
|
|
|
+ $this->error('该订单不属于当前用户');
|
|
|
}
|
|
|
- if ($order->paystate == 1 && !$order->orderstate && $order->shippingstate == 1) {
|
|
|
- $order->shippingstate = 2;
|
|
|
- $order->receivetime = time();
|
|
|
+ if ($order->canConfirmHandle()) {
|
|
|
+ $order->order_status = OrderEnum::STATUS_CONFIRM;
|
|
|
+ $order->receive_time = time();
|
|
|
$order->save();
|
|
|
//记录操作
|
|
|
OrderAction::push($order->order_sn, '系统', '订单确认收货成功');
|
|
|
$this->success('确认收货成功');
|
|
|
}
|
|
|
- $this->error('未可确认收货');
|
|
|
+ $this->error('订单不允许确认收货');
|
|
|
}
|
|
|
|
|
|
//查询物流
|