args[0] ?? 'user_id'; $recipeKey = $this->args[1] ?? 'recipe'; $userId = $data[$userIdKey] ?? null; $recipe = $this->validation->$recipeKey ?? null; if (!$userId || !$recipe) { $this->addError('验证合成条件时缺少必要参数'); return false; } // 如果配方没有条件组,则直接通过 if (!$recipe->condition_group_id) { return true; } try { // 使用条件组服务检查条件 $checkResult = ConditionService::checkCondition($userId, $recipe->condition_group_id); if (!$checkResult['success']) { $this->addError($checkResult['message']); return false; } return true; } catch (\Exception $e) { $this->addError('验证合成条件时发生错误: ' . $e->getMessage()); return false; } } }