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?
用一个表记录“操作-积分变动”
每一种涉及到积分变化的操作,均在这个表里有一条对应记录。操作发生时,去数据库里找对应的记录然后根据记录的值进行对应的操作
例如:积分变动字段为数组,key表示积分类型(金币/威望/...),value表示增减量(+2/-1/...),json后存数据库