User operations such as posting, collecting, supporting, opposing, etc.
These all involve the increase or decrease of user points, but points are divided into N types. How to uniformly manage which type of points are associated with these operations and the amount of increase or decrease? ?
For example: at first the user posts, gold coins 2 (gold coins are points type, 2 is the quantity), and later the user posts, prestige 1 (prestige is also the point type)
Such as: How to flexibly and uniformly manage similar configurations across the entire site?
Use a table to record "operations - points changes"
Every operation involving points changes has a corresponding record in this table. When an operation occurs, go to the database to find the corresponding record and then perform the corresponding operation based on the recorded value
For example: the points change field is an array, key represents the point type (gold coins/prestige/...), value represents the increase or decrease (+2/-1/...), json is stored in the database