gpt4 book ai didi

php - 我应该使用 PHP 代码还是 MySQL 存储过程来创建高效的奖励积分系统?

转载 作者:行者123 更新时间:2023-11-29 01:40:50 25 4
gpt4 key购买 nike

我正在研究 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com