In response to challenges in unmanned aerial vehicle (UAV) path planning, such as low search efficiency, non-smooth paths, and the inability to adapt to unknown environments, this paper proposes a novel UAV path planning method integrating a dual-layer optimization of A* and the dynamic window approach(DWA). Firstly, neighbor node pruning rules are defined to optimize the node expansion process of the A* algorithm. The heuristic function of the A* algorithm is dynamically adjusted based on obstacle coverage, and key path nodes are extracted using the Bresenham algorithm. Secondly, a deviation sub-function is introduced to enhance local path planning coherence, and an adaptive weighting method for the evaluation function is designed. Lastly, the optimized key nodes are utilized as sub-goals for local path planning, integrating the dynamic window approach to enhance real-time obstacle avoidance and adaptability in unknown environments. Simulation results demonstrate that the proposed method significantly improves the efficiency, smoothness, and obstacle avoidance performance of mobile robot path planning, meeting the requirements of complex planning tasks more effectively.