The present invention relates to the technical field of logistics devices and discloses an
electromagnetic lock and a locker, wherein the
electromagnetic lock comprises a housing, a locking hook, a locking element, an
electromagnet, and a shock-
absorbing element, wherein the locking hook is capable of rotation relative to the housing and has a locking position and an unlocking position, wherein the locking element is capable of rotation relative to the housing and has a first position to prevent the locking hook from rotating to the unlocking position and a second position to allow the locking hook to rotate to the unlocking position, wherein the
electromagnet serves to drive the locking element to rotate between the first position and the second position.wherein the shock protection element can rotate relative to the housing and has a
home position and an operating position, wherein when the shock protection element is in the
home position, the shock protection element is separated from the locking element, whereas when an external disturbance force drives the locking hook in the locking position to rotate in a set direction and separate from the locking element, the locking hook can drive the shock protection element in the
home position to rotate into the operating position in order to prevent the locking element in the first position from rotating to the second position, thus ensuring that the locking element is always in the first position, which avoids unwanted unlocking caused by shock.