The traditional methods of analyzing consumption structure have many limitations, and data acquisition is difficult, so it is hard to scientifically verify the accuracy of algorithms. With the development of Internet economy, many scientific researchers focus on mining knowledge of consumer behavior using big data analysis technology. Because consumption decisions are influenced by not only personal characteristics but also social trends and environment, it is one-sided to analyze the impact of one single factor on the phenomenon of consumption. The authors of this paper combine the consumption structure analysis method and data processing technology using data from an e-commerce platform to extract the consumption structure of cities, compare the structural differences between different periods, and then discover consumption upgrading according to swarm intelligence. The experiments prove the efficacy of the algorithm proposed in this paper compared to other similar algorithms using several different datasets, which illustrates the algorithm’s efficacy and stable performance in consumption structure analysis.