In this paper, we present a recommendation algorithm based on the resource-allocation progresses on bipartite networks. In this model, each node is assigned an attraction that is proportional to the power of its degree, where the exponent β is an adjustable parameter that controls the configuration of attractions. In the resource-allocation process, each transmitter distributes its each neighbor a fragment of resource that is proportional to the attraction of the neighbor. Based on a benchmark database, we find that decreasing the attractions that the nodes with higher degrees are assigned can further improve the algorithmic accuracy. More significantly, numerical results show that the optimal configuration of attractions subject to accuracy can also generate more diverse and less popular recommendations.