A method for controlling device-to-device discovery, wherein the method comprises: obtaining, by a network device, N first relay function parameter sets of N user equipment supporting a relay function, wherein the N first relay function parameter sets correspond to the N user equipment supporting the relay function, and N is a positive integer, wherein the first relay function parameter set comprises the following relay function parameter: a discovery mechanism of the discovery process that is supported by the user equipment supporting the relay function, wherein the discovery mechanism of the discovery process includes a 3GPP Model A or a 3GPP Model B; obtaining, by the network device, a second relay function parameter set of remote user equipment, wherein the second relay function parameter set comprises the following relay function parameter: the discovery mechanism of the discovery process that is selected by the remote user equipment; wherein the obtaining, by the network device, the second relay function parameter set of remote user equipment further comprises: obtaining, by the network device, the second relay function parameter set of the remote user equipment from the remote user equipment; determining, by the network device for the remote user equipment, at least one of the N user equipment supporting the relay function, wherein the first relay function parameter set of the at least one user equipment supporting the relay function and the second relay function parameter set satisfy a preset matching relationship; and sending, by the network device, a first notification message to the at least one user equipment supporting the relay function, wherein the first notification message is used to trigger the at least one user equipment supporting the relay function to initiate a device-to-device discovery process. a discovery mechanism of the discovery process that is supported by the user equipment supporting the relay function, wherein the discovery mechanism of the discovery process includes a 3GPP Model A or a 3GPP Model B; obtaining, by the network device, a second relay function parameter set of remote user equipment, wherein the second relay function parameter set comprises the following relay function parameter: the discovery mechanism of the discovery process that is selected by the remote user equipment; wherein the obtaining, by the network device, the second relay function parameter set of remote user equipment further comprises: obtaining, by the network device, the second relay function parameter set of the remote user equipment from the remote user equipment; determining, by the network device for the remote user equipment, at least one of the N user equipment supporting the relay function, wherein the first relay function parameter set of the at least one user equipment supporting the relay function and the second relay function parameter set satisfy a preset matching relationship; and sending, by the network device, a first notification message to the at least one user equipment supporting the relay function, wherein the first notification message is used to trigger the at least one user equipment supporting the relay function to initiate a device-to-device discovery process. the discovery mechanism of the discovery process that is selected by the remote user equipment; wherein the obtaining, by the network device, the second relay function parameter set of remote user equipment further comprises: obtaining, by the network device, the second relay function parameter set of the remote user equipment from the remote user equipment; determining, by the network device for the remote user equipment, at least one of the N user equipment supporting the relay function, wherein the first relay function parameter set of the at least one user equipment supporting the relay function and the second relay function parameter set satisfy a preset matching relationship; and sending, by the network device, a first notification message to the at least one user equipment supporting the relay function, wherein the first notification message is used to trigger the at least one user equipment supporting the relay function to initiate a device-to-device discovery process. obtaining, by the network device, the second relay function parameter set of the remote user equipment from the remote user equipment; determining, by the network device for the remote user equipment, at least one of the N user equipment supporting the relay function, wherein the first relay function parameter set of the at least one user equipment supporting the relay function and the second relay function parameter set satisfy a preset matching relationship; and sending, by the network device, a first notification message to the at least one user equipment supporting the relay function, wherein the first notification message is used to trigger the at least one user equipment supporting the relay function to initiate a device-to-device discovery process.