Browse Source

订单完成API

master
weigang 6 years ago
parent
commit
c6614fa66e
  1. 14
      app/Controller/OrderController.php

14
app/Controller/OrderController.php

@ -71,12 +71,12 @@ class OrderController extends BaseController
}
$userId = $this->request->input('user_id');
$orderId = $this->request->input('order_id');
$orderExist = OrderMain::query()
$orderId = $this->request->input('order_id'); // TODO 等新订单列表接口处理完毕后全面转换成global_order_id
$orderMain = OrderMain::query()
->where(['id' => $orderId, 'state' => OrderMain::ORDER_STATE_DELIVERY, 'user_id' => $userId])
->exists();
->first();
if (!$orderExist) {
if (empty($orderMain)) {
$this->log->event(LogLabel::ONLINE_COMPLETE_LOG, ['order_not_found' => 'order_not_found']);
return $this->result(ErrorCode::SEPARATE_ACCOUNTS_ERROR, '', '操作失败,订单异常或不存在');
}
@ -84,11 +84,11 @@ class OrderController extends BaseController
Db::beginTransaction();
try {
$this->orderService->onlineCompleted($orderId);
$this->separateAccountsService->orderOnlineCompleted($orderId);
$this->orderService->onlineCompleted($orderMain->global_order_id);
$this->separateAccountsService->orderOnlineCompleted($orderMain->global_order_id);
Db::commit();
return $this->success(['order_id' => $orderId]);
return $this->success('');
} catch (\Exception $e) {
Db::rollBack();

Loading…
Cancel
Save