php - How does Yii flexibly configure the type and number of points affected by the entire site operation?
習慣沉默
習慣沉默 2017-06-07 09:23:06
0
1
863

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?

習慣沉默
習慣沉默

reply all(1)
代言

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template