Facebook申请邀请奖励
我正在尝试制作一款允许用户邀请朋友的 Facebook 游戏。我想提供一种激励措施,邀请其他人的人每被邀请者获得 10 点积分,即可获得 1 点奖励积分。 我正在使用 Python 运行时在 Google App Engine 上开发 facebook 应用程序。
实现这种功能的最佳方法是什么?我知道我可以找出谁邀请了特定的应用程序用户。我想要考虑到很多用户并希望节省尽可能多的服务器资源。
我正在考虑创建一个“用户”实体,其中有一个“id”值、一个“点”值和一个“引用来源”值。当为用户添加积分时,服务器会查找“引用来源”实体并相应地奖励积分。但由于我每 10 只奖励 1 点,服务器每次检查点 mod 10 是否为 0 可能会很浪费。而且,如果邀请点被带入,似乎整个用户数据存储命名空间都会不断地传播点,这也是浪费。
有什么好的实现方法吗?
I'm trying to make a facebook game that allows users to invite friends. I'd like to provide an incentive that people who invite others get 1 bonus point for every 10 points that their invitee gets.
I'm developing the facebook app on Google App Engine using the Python runtime.
What is the best way to implement this kind of feature? I know that I can find out who invited a given app user. I want to account for a lot of users and want to conserve as many server resources as possible.
I was thinking to create a 'User' entity, where there is a 'id' value, a 'points' value and a 'referred from' value. When points are added to for a user, the server looks up the 'referred from' entity and awards points accordingly. But since I am only awarding 1 point for every 10, it might be a waste for the server to check every time whether points mod 10 is 0. Also, if invitation points are carried through, it seems like the entire User datastore namespace would constantly be propagating points, which is also wasteful.
Any good way to implement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您所观察到的,实现此目的的一种方法是每次用户总共获得 10 分时更新父实体。如果他们一次只赚取一分,则最大开销为 10%。
更有效的选择可能是在用户赚取积分时设置一个标志,然后每天运行一次 MapReduce 或其他类似作业,汇总设置了该标志的用户推荐的所有积分,并将其添加到总积分中。
One way to do this, as you observe, is to update the parent entity every time the user earns a total of 10 points. If they only earn one point at a time, the maximum overhead for this is 10%.
A more efficient option might be to set a flag whenever a user earns points, and once a day, run a mapreduce or other similar job that sums up all the points for a user's referrals who have that flag set and adds it to their total.
这违反了 faecbooks 平台政策
This is against faecbooks platform policy