Since the traditional cloud computing paradigm can no longer meet the growing computing needs of the power Internet of Things (IoT), the article introduces 5G mobile edge computing (MEC) to realize the nearby processing of computing tasks. And the task offloading issue is formulated as a long-term delay optimization problem where the long-term energy consumption constraints and service priority are taken into account. Further, the article utilizes Lyapunov optimization to transform it into a series of short-term deterministic optimization problems, and analyzes its theoretical upper bound. Via the auction algorithm based on gradient prices, the article can realize the joint allocation and optimization of communication, energy and computing resources. The simulation results show that the proposed method can effectively solve the problem of offloading conflicts among multiple terminals, reduce the offloading delay as much as possible while meeting long-term energy consumption constraints, and achieve a compromise between delay and energy consumption performance through appropriate parameter settings.