request->input('id'); // 获取数据源 $this->logInfo = $this->orderOptionCateringLogModel->find($id); if (empty($this->logInfo)) throw new ErrException('配餐记录不存在'); $this->__initRedisKey(); if (!$this->isBuildPickupCode() || !$this->isCateringByCache() || !$this->checkIsPrint()) throw new ErrException('先执行整线路配餐后才可以获取已配餐信息'); if ($this->logInfo->quantity <= 0) throw new ErrException('该点无任何配餐数据'); $siteInfo = $this->siteModel->getInfoById($this->logInfo->site_id); if (empty($siteInfo)) throw new ErrException('配餐地址不存在,请确认信息'); $driverInfo = $this->driverSequenceModel->getInfoByDriverId($siteInfo->delivered_id); if (empty($driverInfo)) throw new ErrException('线路司机信息不存在,请确认信息'); $orderIds = $this->orderModel ->where('site_id', $siteInfo->id) ->where('cycle_id', $this->cycleId) ->where('type',OrderCode::ORDER_TYPE_OPTIONAL) ->where('status',OrderCode::PAYED) ->orderBy('id') ->pluck('id') ->toArray(); if (empty($orderIds)) throw new ErrException('该点无任何配餐数据'); $pickUpCodeList = $this->pickupCodeModel->whereIn('order_id',$orderIds)->select(['pickup_code','order_id','copies','id'])->get(); if ($pickUpCodeList->isEmpty()) throw new ErrException('该点未生成取餐码'); return $this->return->success('success', [ 'list' => $pickUpCodeList->toArray(), 'site_name' => $siteInfo->name, 'driver_num' => $driverInfo->driver_num.'-'.$siteInfo->sequence ]); } }