We consider a harmonic charging field as an energy charger for the quantum battery, which consists of an ensemble of two-level atoms. The charging of noninteracting atoms is completely fulfilled, which exhibits a substantial improvement over previous static charging fields. Involving the repulsive interactions of atoms, the fully charging is achieved with shorter charged period over the noninteracting case, yielding an advantage for the charing. Excluding the charging field, a quantum phase transition is induced by the attractive atom-atom interactions, and the interacting atoms become to be degenerate in the ground state. We find that the degenerate states play a negative role in the charging due to the gapless energies. The atoms with strong attractive interactions can not be charged completely, which is accompanied by a drop of the maximum stored energy.