Public number third-party platform development tutorial Create a third-party platform for the public
Public number third-party platform development Tutorials two component_verify_ticket and Accesstoken access
Public number third party platform development Tutorials III Public License third party platform
Public number third-party platform development tutorial four-generation public number Launch page authorization instructions
Public number third party platform development Tutorial Five Dynasties public number processing messages and events
Public number third-party platform development tutorial Six generations of the public number using the JS SDK instructions
Another, thanks to this prawn blog, these things are in his blog based on the completion of his blog has some interface code can be downloaded
Development Series Tutorials
When a fan gives the public information, the server sends a message to the public number and the event receive URL.
The following directly on the processing function, after processing is completed directly on the page to output the encrypted message. Note To remove the HTML code from the foreground
Public voidResponsemessage () {Wxbizmsgcrypt wxcpt=NewWxbizmsgcrypt (); stringSreqdata =Getpost (); stringRespnsecontent =""; stringSresponse ="";//the reply text after encryption stringSMSG ="";//clear text after parsing intRET =0; RET= Wxcpt. Decryptmsg (Sreqmsgsig, Sreqtimestamp, Sreqnonce, Sreqdata,refSMSG); Logtool.logtodirdest (FilePath, Logtype.debug,string. Format ("information received by {1}: {0}", Sreqdata, Pageurl)); Logtool.logtodirdest (FilePath, Logtype.debug,string. Format ("{1} parsed message: {0}", SMSG, Pageurl)); varXDoc =Xdocument.parse (SMSG); List<XElement> q = ( fromCinchXdoc.elements ()Selectc). ToList (); varModel =New{tousername= Q.elements ("Tousername"). First (). Value, Fromusername= Q.elements ("Fromusername"). First (). Value, Createtime= Q.elements ("Createtime"). First (). Value, Msgtype= Q.elements ("Msgtype"). First (). Value, Content= (""+ q.elements ("Content"). First (). Value). Trim (), MsgId= Q.elements ("MsgId"). First (). Value}; if(false==string. IsNullOrEmpty (model. Content)) {Switch(model. Content.tolower ()) { Case "Help": Case " Help": Case "Hello2bizuser"://automatically respond when you are concernedRespnsecontent ="usage Help description: \ r \ n------------------------\ r \ n"+"Common commands: \ r \ n"+"1, view case; \ r \ n"+"2, contact information; \ r \ n"+"3. Help or help;\r\n"; Break; Case "View Case": Respnsecontent="View case: \ r \------------------------\ r \ n"; Break; Case "Contact Information": Respnsecontent="Contact information: \ r \ n------------------------\ n"; Break; default: Break; } varTEXTTPL ="<xml>"+"<tousername><! [cdata[{0}]]></tousername>"+"<fromusername><! [cdata[{1}]]></fromusername>"+"<CreateTime>{2}</CreateTime>"+"<msgtype><! [cdata[{3}]]></msgtype>"+"<content><! [cdata[{4}]]></content>"+"<FuncFlag>0</FuncFlag>"+"</xml>"; intEnret = wxcpt. Encryptmsg (string. Format (TEXTTPL, model. Fromusername, model. Tousername, Convertdatetimeint (DateTime.Now),"text", respnsecontent), Sreqtimestamp, Sreqnonce,refsresponse); Logtool.logtodirdest (FilePath, Logtype.debug,string. Format ("{1} message before encryption: {0}",string. Format (TEXTTPL, model. Fromusername, model. Tousername, Convertdatetimeint (DateTime.Now),"text", respnsecontent), pageurl); Logtool.logtodirdest (FilePath, Logtype.debug,string. Format ("{1} message after encryption: {0}", Sresponse, Pageurl)); Response.Write (Sresponse); Response.End (); }
Public number third-party platform development tutorial four-generation public number processing messages and events