The micro-trust platform is very hot after opening, many third-party applications want to try this platform, after all, can use the micro-letter to build up the relationship chain to expand their application is quite good, can save a lot of social expenses, I recently because of internship needs are also studying this thing, However, found that the relevant information on the Internet is very small, here my whole research situation to come out, I hope to learn together.
Class diagram of the main class used in the micro-letter SDK
The above class diagram shows the request class and response class in the communication process with the micro-letter, and the third party application
The accompanying message field to carry messages to the micro-credit process. Where BASERESP has an inner class that is Errcode,
It defines a few constant fields that, when we send a request to a micro-letter, will be returned as a field
To return to our application, we can do the corresponding processing according to this, in the following sequence diagram will be mentioned
To. The following is the message object in the SDK.
The above class diagram is primarily a message object that contains a field that refers to the media object, which
Is the object that we can pass on to the micro-letters. With the message object and the media object, the next thing to give is to eliminate
The communication class that the object sends out.
The above IWXAPI is called the Communication class, all with the micro-letter communication work is he is doing, and his
The build is done by the following factory class. The next Iwxapieventhandler interface is required for third party applications
If we want to process the request information of the micro-letter or the Identity field he returns after we send him a request.
Second, third-party applications and micro-letter communication sequence diagram
1. Send message to micro-letter
The application only needs to register once, then in the future use only need to encapsulate the message, let the communication class
can be sent. As you can see from the previous class diagram, the order in which messages are encapsulated is to generate the media that needs to be sent first
object, then attaches the media object to the Message object, creates the request object, and finally uses the communication class to send
can be sent. The code looks like this:
Here are some pictures:
After the program has entered
Register to download click Send, micro-letter to give a buddy list
Select a friend, the additional message editing interface, can not fill anything
Click Share to return to a third party application and receive a message in your friend's micro-mail
The added point here is that the frame in the diagram is the message object that is defined by the micro-letter, not the third party application definition, as compared to the previous picture.
Temporarily this to say this, as if this blog a can't carry so many things ah, the rest of the article in the back, thank you.
Because I wrote the demo in the internship after the end of the lost, so to an official demo download, if there is not clear to communicate, thank you for your cooperation and hope to learn together.