user = $this->getUser(); // 用户信息 } /** * 核销订单详情 * @param $order_id * @param int $order_type * @return array * @throws \app\common\exception\BaseException * @throws \think\exception\DbException */ public function detail($order_id, $order_type = OrderTypeEnum::MASTER) { // 订单详情 $model = OrderService::getOrderDetail($order_id, $order_type); // 验证是否为该门店的核销员 $clerkModel = ClerkModel::detail(['user_id' => $this->user['user_id']]); return $this->renderSuccess([ 'order' => $model, // 订单详情 'clerkModel' => $clerkModel, 'setting' => [ // 积分名称 'points_name' => SettingModel::getPointsName(), ], ]); } /** * 确认核销 * @param $order_id * @param int $order_type * @return array * @throws \app\common\exception\BaseException * @throws \think\exception\DbException */ public function extract($order_id, $order_type = OrderTypeEnum::MASTER) { // 订单详情 $order = OrderService::getOrderDetail($order_id, $order_type); // 验证是否为该门店的核销员 $ClerkModel = ClerkModel::detail(['user_id' => $this->user['user_id']]); if (!$ClerkModel->checkUser($order['extract_shop_id'])) { return $this->renderError($ClerkModel->getError()); } // 确认核销 if ($order->verificationOrder($ClerkModel['clerk_id'])) { return $this->renderSuccess([], '订单核销成功'); } return $this->renderError($order->getError() ?: '核销失败'); } }