Home >Backend Development >PHP Tutorial >PHP implements sorting merchants
<code>需求是需要对一个行业的店铺进行排名,一个行业可能有几千个店铺。不知道大家有没有什么好的方法没有。</code>
<code>需求是需要对一个行业的店铺进行排名,一个行业可能有几千个店铺。不知道大家有没有什么好的方法没有。</code>
You can refer to Taobao or JD.com
For example: ranking by credit, product sales, number of views, activity, fans (number of followers), membership level, etc.
You can also make a comprehensive ranking based on these weights. The rules are up to you.
The sorting can be based on the store's operating indicators such as cumulative credit, credit/sales/comments/PV/UV increment on 3/7/30, return visit/retention rate on 3/7/30, new rate, number of violations in 60 days Wait, add a certain weight to get a final score, and sort according to the score.
It is not recommended to use PHP for processing. After all, if there are thousands of stores, there will be millions of order data and N number of user business behavior records.
In addition, the ranking of modern e-commerce is not static, and the ranking must be recommended based on the buyer's preferences. This involves many machine learning algorithms.
No matter how you organize your sorting algorithm, the ultimate goal is to facilitate transactions. So from the perspective of both buyers and sellers, think carefully about how the seller hopes to increase the transaction volume and how the buyer can quickly find the product that they are satisfied with.
Finally, I recommend reading "Ten Years of Taobao Product Stories" written by Taobao Product Dog.
For sorting, you can calculate a sorting value based on different proportions according to some attributes of the store. This depends on the direction of the product.
I think the more important thing about this issue is how to calculate this value and use it in paging. You can start a cron to calculate and store the calculated result store ID in memcached or redis according to the ranking. When accessing, take the corresponding ID to the database. Find detailed data.
For redis, you can use an ordered set structure.