A good recommender system can infer customers' preferences based on their historical purchase records, and recommend products that the customers may be interested in, saving them a lot of time and energy. For enterprises, it is difficult to recommend accurately to each customer, and the bad recommendation may be counterproductive. Customer loyalty is an indicator that measures the preference relationship between customers and products in the field of marketing. A hypothesis is proposed in this study: if companies can divide customers into different groups based on customer loyalty, the recommendation effect on certain groups is better than that on overall customers.In this study, customer loyalty is measured by four features of the RFML model. All customers are viewed as points on a four-dimensional space, which are clustered by the k-means model. Two recommendation algorithms based on complex networks are tested: recommendation algorithm based on bipartite graph and PersonalRank (BGPR), and recommendation algorithm based on a single vertex set network and DeepWalk (SVDW). The experimental results show that customer loyalty has improved the effectiveness of the two algorithms over 14%, and the recommendation effect is the best on customer groups with a loyalty level of 4 (the highest level is 5). The recommendation algorithms with customer loyalty are better than using them alone.