Edge computing can use many edge devices to provide users with real-time computing and storage functions. With the development of the Internet of Things (IOT), edge computing is becoming more and more prevalent currently. However, the consequent challenges in search efficiency, reliability requirements and resource allocation appear followed. Therefore, this article focuses on resource allocation and security performance issues. A lightweight trust evaluation mechanism was constructed and time-varying trust coefficients were introduced as incentives to address the problem of distrust between user terminals and edge server entities in multi-cell and multi-user scenarios. This enables the user terminal to immediately distinguish malicious servers. Considering the limited and dynamic changes of computing resources, the problem of complete migration of multi-user tasks was transformed into an issue of computing resource distribution to reduce the total system energy consumption. As a Markov game model, a system was developed to address the problems of centralized single-agent algorithms, including the explosion of action space and difficulty in convergence with increasing the number of users. Besides, a resource allocation algorithm was proposed based on a trust model and multi-agents that follows a centralized training and distributed implementation architecture. The simulated consequences indicated that the proposed algorithm resists malicious attacks, and can quickly make reasonable task migration decisions based on different system states, thereby efficiently decreasing the consumption of the total system energy, and providing a better user experience.