siteModel->where('id', $this->siteId)->first(); if (empty($siteInfo)) throw new Exception('站点数据不存在'); $cycleInfo = $this->cycleModel->where('id', $this->cycleId)->first(); if (empty($cycleInfo)) throw new Exception('周期数据不存在'); $info = $this->driverStatusModel->where('cycle_id', $this->cycleId)->where('site_id',$this->siteId)->first(); if (empty($info)) throw new Exception('今日该点数据不存在'); $this->siteDriverStatementModel->where('cycle_id', $this->cycleId)->where('site_id',$this->siteId)->delete(); $insertModel = new SiteDriverStatement(); $insertModel->date = $cycleInfo->dates; $insertModel->cycle_id = $this->cycleId; $insertModel->city_id = $siteInfo->city_id; $insertModel->site_id = $this->siteId; $insertModel->kitchen_id = $siteInfo->kitchen_id; $insertModel->driver_id = $info->driver_id; $insertModel->option_order_number = $info->option_order_number; $insertModel->meal_order_number = $info->meal_order_number; $insertModel->option_copies = $info->option_copies; $insertModel->meal_copies = $info->meal_copies; $insertModel->option_add_staple_food_num = $info->option_add_staple_food_num; $insertModel->meal_add_staple_food_num = $info->meal_add_staple_food_num; if (!$insertModel->save()) throw new Exception('保存点位数据失败'); } }