简体   繁体   English

使用PHP在iOS社交网络应用中发送好友请求并添加好友?

[英]Sending friend request and adding friends in an iOS social network app using PHP?

Basically, I am now making a basic social network app on iOS platform, using PHP as the backend. 基本上,我现在正在使用PHP作为后端,在iOS平台上制作一个基本的社交网络应用程序。 I am be able to make the login, register functions in my social network app, however, I am now struggling how to add friend in my app. 我可以在我的社交网络应用程序中进行登录,注册功能,但是,我现在正在努力如何在我的应用程序中添加朋友。

As far as I know, I have to make a table for making_friends, just following this tutorial: http://www.9lessons.info/2014/03/facebook-style-friend-request-system.html 据我所知,我必须按照本教程制作一张makeing_friends表: http ://www.9lessons.info/2014/03/facebook-style-friend-request-system.html

However, what I wonder is, if one user send a friend request to another user, then the "status" in the "making_friends" table maybe "0", to indicate that the friend request is sent and waiting for the reply. 但是,我想知道的是,如果一个用户向另一个用户发送了一个朋友请求,那么“ making_friends”表中的“状态”可能为“ 0”,以指示该朋友请求已发送并等待答复。 But how to let the other user know, that a user is sending a friend request to him, and then the other user may accept the friend request and updating the "status" to "1", which means the other user accepts the friend request. 但是如何让另一个用户知道一个用户正在向他发送一个好友请求,然后另一个用户可以接受该好友请求并将“状态”更新为“ 1”,这意味着另一个用户接受了好友请求。

In a word, I am not sure how to communicate from one client to another client, using server as a bridge. 总之,我不确定如何使用服务器作为桥梁从一个客户端到另一个客户端进行通信。 Does anyone have any good suggestions? 有人有什么好的建议吗?

You can use push notification to send a request to a client or hit to server periodically and check the status but this is not a good way to handle it 您可以使用推送通知将请求发送到客户端或定期发送到服务器并检查状态,但这不是处理请求的好方法

For ios push notification check this Apple Push Notification Services 对于ios推送通知,请检查此Apple Push Notification Services。

You can INSERT both users as one record in making_friends table and make a status for it. 您可以将两个用户作为一条记录INSERT making_friends表中,并making_friends建立状态。

 making_friends table
--------------------
User1
User2
Status

Once a user inserted in this table you can make a flag on status and let the user know the request 用户插入此表后,您可以在状态上做一个标记,并让用户知道请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM