search

Home  >  Q&A  >  body text

php - How does Yii flexibly configure the type and number of points affected by the entire site operation?

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?

習慣沉默習慣沉默2756 days ago891

reply all(1)I'll reply

  • 代言

    代言2017-06-07 09:25:06

    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

    reply
    0
  • Cancelreply