推荐数据库架构

发布于 2024-07-16 11:36:32 字数 913 浏览 2 评论 0原文

我正在使用现在典型的“推荐”系统编写一个新的{每月|每年}付费网站:当新用户注册时,他们可以指定其他用户的{用户名|推荐代码}(如果他们来自一个特殊的 URL),这将导致推荐人获得新用户支付的一定比例的收入。

在重新发明轮子之前,我想知道你们中是否有人有在关系数据库中存储此类数据的经验。 目前我正在使用 MySQL,但我相信任何好的解决方案都应该能够轻松适应任何 RDBMS,对吗?

我希望支持以下功能:

  • 在线计费系统 - 每张发票支付后,就会计算推荐收入,并且他们将能够兑现。 当然,这包括在线浏览发票/付款的可能性。

  • 付费选项各不相同 - 它们的性质和成本不同(有时会有所不同),因此应根据每张最终发票计算佣金。

  • 跟踪推荐(用户之间的关系、推荐日期以及任何其他有用信息 - 有什么想法吗?)

  • 一种访问历史推荐数据(已支付多少)或应计费用的简单方法佣金。

  • 将来,我可能会提出用累积现金换取续订(涵盖整个新订阅或仅部分新订阅,如果需要,必须支付差额)

  • 多个级别 - 我正在考虑支付大约 10% 的直接推荐收入 + 2% 的下一个级别,但这可能会在未来发生变化(添加更多级别,更改百分比),所以我应该能够存储历史数据。

请注意,我不打算在任何其他项目中使用它,所以我不担心它是“即插即用”的。

您做过类似要求的工作吗? 如果是这样,你是如何处理所有这些事情的? 您会推荐任何特定的数据库架构吗? 为什么?

我是否缺少任何东西可以帮助使其成为更灵活的实施?

I'm coding a new {monthly|yearly} paid site with the now typical "referral" system: when a new user signs up, they can specify the {username|referral code} of other user (this can be detected automatically if they came through a special URL), which will cause the referrer to earn a percentage of anything the new user pays.

Before reinventing the wheel, I'd like to know if any of you have experience with storing this kind of data in a relational DB. Currently I'm using MySQL, but I believe any good solution should be easily adapted to any RDBMS, right?

I'm looking to support the following features:

  • Online billing system - once each invoice is paid, earnings for referrals are calculated and they will be able to cash-out. This includes, of course, having the possibility of browsing invoices / payments online.

  • Paid options vary - they are different in nature and in costs (which will vary sometime), so commissions should be calculated based on each final invoice.

  • Keeping track of referrals (relationship between users, date in which it was referred, and any other useful information - any ideas?)

  • A simple way to access historical referring data (how much have been paid) or accrued commissions.

  • In the future, I might offer to exchange accrued cash for subscription renewal (covering the whole of the new subscription or just a part of it, having to pay the difference if needed)

  • Multiple levels - I'm thinking of paying something around 10% of direct referred earnings + 2% the next level, but this may change in the future (add more levels, change percentages), so I should be able to store historical data.

Note that I'm not planning to use this in any other project, so I'm not worried about it being "plug and play".

Have you done any work with similar requirements? If so, how did you handle all this stuff? Would you recommend any particular DB schema? Why?

Is there anything I'm missing that would help making this a more flexible implementation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别低头,皇冠会掉 2024-07-23 11:36:32

令人惊奇的是,有一个数据库架构库。 虽然我看不到推荐的具体内容,但可能有一些相关的内容。 至少(希望)你应该能够得到一些想法。

Rather marvellously, there's a library of database schemas. Although I can't see something specific to referrals, there may be something related. At least (hopefully) you should be able to get some ideas.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文