My preferred design is similar to DTF's:
(side view, ===> indicates a drawbridge raising to the right)
(outside)
(1) =====>+++++++++stone++++++++++
(2) \____=====>________________________[trade depot]
(3) \ +~~~magma~~~+ <====__[barracks]
(4) \_____<=.==>.<==.=>_____/
(5) ### grates ##___________[maintenance access]
(6) <============
The bridge at level 1 is lowered to seal off the fortress completely.
The bridge at level 2 is lowered to allow access to the trade depot, but raised for sieges.
The bridge at level 3 is raised to lure sieges into the magma trap. The magma reservoir has floor hatches along its length.
Level 4 is a bit tricky; the two short outer bridges are raised once siege forces have entered the trap, to seal them in. The ground under the long inner bridges is channeled out. When all four bridges are lowered, there should be no non-bridge floor space. (The periods in the schematic are just meant to show the division between the bridges.)
The grates at level 5 are the swag catcher.
The long bridge at level 6 is the magma drain.
When a siege arrives, Bridges (1), (2), and (3) are raised; all bridges on level (4) are lowered.
When forces are standing on the bridges at level (4), the short outer bridges are raised.
The floor hatches under the magma are opened just long enough to fill the chamber below, then shut. Immediately when the last invader burns to death, the long inner bridges are raised, dropping all contents of the chamber into the drain. Speed is important to keep the metal items the invaders were wearing from melting.
The grates at 5 catch all of the metal armor, weapons, etc., while the magma falls to level 6. The bridge at 6 is raised and lowered, erasing the magma.
Finally, all of the bridges at level 4 are lowered.
What I like about this system is that it kills battalions very quickly, and it doesn't leave any magma puddles on the walkway to block pathfinding, so it's immediately ready for use again. I typically have to burn through large sieges one chunk at a time. Then afterwards I can unforbid and cart off all of the swag caught on the grates.
Of course, this setup could be simplified considerably. You could skip the whole magma trap and just have Level 4 be lined with traps.