Sweep code with parameter QR code Scan code attention

Source: Internet
Author: User

Parsing the passed XML, judging if event is subscribe and Eventkey is not empty and contains qrscene_ or event is scan,

1. Get the scene number

int scanId = Int. Parse (TXTMessage_T.EventKey.Replace ("Qrscene_", "" "));

2. Build return XML, message sender and receiver Exchange

XML = new XmlDocument ();
XmlElement Elem;
Xmlcdatasection XC;
XmlNodeList nodelist;
XmlNode node;
Construct send message to user XML node content
Elem = XML. createelement ("xml");
Xml. AppendChild (Elem);
NodeList = XML. SelectNodes ("Descendant::xml");
node = nodelist. Item (nodelist. COUNT-1);
Redeem the original message sender and receiver
Elem = XML. CreateElement ("Tousername");
XC = XML. Createcdatasection (Txtmessage_t.fromusername);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Elem = XML. CreateElement ("Fromusername");
XC = XML. Createcdatasection (Txtmessage_t.tousername);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Time conversion to Long integer type
Elem = XML. CreateElement ("Createtime");
Elem. InnerText = Methods.fanlitime (). ToString ();
Node. AppendChild (Elem);

Building the text message XML

Elem = XML. CreateElement ("Msgtype");
Text message
XC = XML. Createcdatasection ("News");
Elem. AppendChild (XC);
Node. AppendChild (Elem);
The maximum number of text messages is 10
Elem = XML. CreateElement ("Articlecount");
Elem. InnerText = "1";
Node. AppendChild (Elem);
Text message Content
Elem = XML. CreateElement ("articles");
Node. AppendChild (Elem);
NodeList = XML. SelectNodes ("Xml/articles");
node = nodelist. Item (nodelist. COUNT-1);
Single text message item
Elem = XML. CreateElement ("item");
Node. AppendChild (Elem);
NodeList = XML. SelectNodes ("Xml/articles/item");
node = nodelist. Item (nodelist. COUNT-1);
Title
Elem = XML. CreateElement ("Title");
XC = XML. Createcdatasection (title);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Describe
Elem = XML. CreateElement ("Description");
XC = XML. Createcdatasection (title);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Image
Elem = XML. CreateElement ("Picurl");
XC = XML. Createcdatasection (IMG);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Link
Elem = XML. CreateElement ("Url");
XC = XML. Createcdatasection (Scanurl);
Elem. AppendChild (XC);
Node. AppendChild (Elem);

return XML

System.Web.HttpContext.Current.Response.Write (XML. OuterXml);

Sweep code with parameter QR code Scan code attention

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.