How to realize the function of the circle of friends in the app fast implementation of user information customization
Self-correlating social elements:
Many of the social element APIs in ansocial, such as posts (post), albums (Album), files, and so on, allow the IDs of other social elements to be passed into the optional parameters of these APIs.
When we pass these IDs, the IDs are stored in the server database, but in the returned results they are returned as objects.
This greatly improves the query efficiency, originally need to query two times the function, now can be implemented at once, such as the next to say the user Avatar function development can be used in the field.
User Picture:
When we create a user on the app, we need to call the Users/create.json API.
What if the user has an avatar? Try passing in the photo field when calling this method (both Android and iOS are implemented by the Ansocialfile class)!
When this field is passed in, the server saves the picture and automatically generates a photo, and the return value of the server converts the photo_id in the original user object into a photo object.
In this way, when we query the user, we can directly obtain the user's avatar address, instead of using the photo_id to call a Photos/get.json method to get the avatar address.
The following is an example of returning a JSON object:
{ "meta": { "code": 200, "status": "OK ", " MethodName ": " CreateUser " }, " Response ": { "user": { "id": "55574fe8b361dbaefc000005", "username": "testuser", "created_ At ": " 2015-05-16t14:10:48.593z ", " Updated_at ": " 2015-05-16T14 : 10:48.606z ", " Photo ": { "id": "55574fe8b361dbaefc000008", "filename": " Userphoto.png ", " url ":" Http://cloud.arrownock.com/v2/resources/ 55574fe8b361dbaefc000006/userphoto.png ", " user_id ": " 55574fe8b361dbaefc000005 ", "Commentcount": 0, "Commentrate": 0, "Likecount": 0, "Dislikecount": 0, " Created_at ": " 2015-05-16t14:10:48.603z ", " Updated_at ": "2015-05-16t14:10:48.604z"       }    }  }}
Ps:users/update.json can also be passed in.
How to implement the Circle of Friends feature in the App series article:
A brief analysis of the realization principle of circle of friends
Second, quickly realize the customization of user information
Three quick realization of two-way friend function
Four in the circle of friends to add the Send picture function
Five likes, comments attribute detailed analysis
The six-speed implementation of the pull-down load friend circle function
Seven fast implementation of pull-up load friends circle function
The logic and implementation of the eight page load function
This article from "Arrow Buckle technology Arrownock" blog, reproduced please contact the author!
How to realize the function of the circle of friends in the app fast realization of user information customization--arrow buckle technology Arrownock