DWQA QuestionsCategory: ProgramDesign problems of users' like function
Small wood asked 3 months ago

Just now I tried to write a praise function, just like that of social networking sites. Node is used in the background. When a user likes a picture, the user ID will be added to the praise table. Each time a user clicks, he will go to the background to check whether the user ID is in the praise table. However, some wechat and microblog platforms have tens of thousands of likes, I don’t know whether these functions are designed like me or whether there is a better method?,First of all, I don’t know how big platforms such as wechat and microblog are designed. Secondly, I don’t want my answer to mislead you. I happen to have similar functions on hand recently, so I’ll share my own solutions.
Considering that users like and cancel likes, and users can see whether they like some information when viewing the information list, and how many people like their information can be seen by the sender. Therefore, considering the function of “like”, the database and table are designed. The database and table are not mentioned. The table is a horizontal table with the information ID as the latitude. Then, the user’s behavior of praising and canceling praises each time is added to MQ. If the user stops praising and canceling praises within 30 minutes, the final results will be merged and written to the database.
It’s just a personal thing to do. I also hope more professional people can give you better answers.,Not exactly, but the principle is the same. I have answered it once. Go over there and have a look:https://segmentfault.com/q/10…

2 Answers
Happy Bobo answered 3 months ago

First of all, I don’t know how big platforms such as wechat and microblog are designed. Secondly, I don’t want my answer to mislead you. I happen to have similar functions on hand recently, so I’ll share my own solutions.
Considering that users like and cancel likes, and users can see whether they like some information when viewing the information list, and how many people like their information can be seen by the sender. Therefore, considering the function of “like”, the database and table are designed. The database and table are not mentioned. The table is a horizontal table with the information ID as the latitude. Then, the user’s behavior of praising and canceling praises each time is added to MQ. If the user stops praising and canceling praises within 30 minutes, the final results will be merged and written to the database.
It’s just a personal thing to do. I also hope more professional people can give you better answers.

Small wood replied 3 months ago

thanks!

Mongoing Chinese community answered 3 months ago

Not exactly, but the principle is the same. I have answered it once. Go over there and have a look:https://segmentfault.com/q/10…

Small wood replied 3 months ago

thanks!