LoRa is an IoT communication technology that realizes ultra-long-distance transmission through spread spectrum modulation. However, its ultra-long-distance transmission also sacrifices the corresponding rate, and data conflicts are prone to occur when the number of nodes is large. In this article, we investigate various types of data collisions in LoRa wireless work, most of which are affected by Spreading Factor (SF) assignment. At present, the distribution of the SF for LoRa in the industry is mostly based on Min-airtime and Min-distance. In the case of a large number of nodes, the data collision between nodes will increase sharply. This paper proposes a SF redistribution scheme under limited network resources, in order to improve the terminal capacity of the LoRa gateway. First, the problem of minimizing the data collision rate without expanding gateway or network resources is presented. Specifically, the reallocation of SF with increasing number of terminals is studied. Finally, considering the randomness of the data sent by the terminal, SF redistribution schemes based on deep reinforcement learning (DRL) are developed. The simulation results show that the collision rate of the proposed SF redistribution scheme is nearly 30% lower than Min-airtime and Min-distance, and its total energy consumption is close to Min-distance. Therefore, the proposed SF redistribution scheme can effectively improve the gateway capacity of LoRa wireless network.