Lithium-ion battery charging and discharging mechanism