我正在研究一个 Web 应用程序的游戏化,我将使用像 StackOverflow 上的声誉一样的积分。环境是 LAMP,我必须:
- 每次点赞都会增加用户积分。
- 每次投反对票都会减少用户积分。
- 按天跟踪用户积分。
- 按用户发布的类别和日期跟踪用户积分。
所以我需要在不同的 MySQL 表中为每个赞成票和反对票进行插入和更新。
最有效的方法是什么?使用一组 PHP 函数(在事务中)、单个 MySQL 存储过程或通过不同的方式?
最佳答案
我推荐你读一下这篇文章 Who Needs Stored Procedures ..我引用这个
Having used both stored procedures and dynamic SQL extensively I definitely prefer the latter: easier to manage, better encapsulation, no BL in the data access layer, greater flexibility and much more. Virtually every major open-source PHP project uses dynamic SQL over stored procs (see: Drupal, Wordpress, Magento and many more).
来自@leepowers (MySQL stored procedures or php code?)
关于php - 我应该使用 PHP 代码还是 MySQL 存储过程来创建高效的奖励积分系统?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23311367/