[C #] asp.net development of the WeChat public platform (7) first 6 Overall framework demo source code

Source: Internet
Author: User

The demo provided here is the source code of the public platform with the overall framework. The so-called demo is something that can be directly demonstrated in the past, of course, there won't be anything specific to the business and data layers. Everyone can make full use of it on this basis. As long as you finish reading the first six articles, you will be able to develop your own things. The demo is easy to understand. Anyone can understand it. Here is the difference between the demo and my actual project: 1. the demo is not connected to the database. You can directly download the demo and use it. It is not convenient for everyone to connect to the database. In article 1st, the entire database is open-source, including the visual interface during design and the database to be connected, after creating the database, add an EF connection. The connection method is in Article 1. 2. The demo does not encapsulate the received message model. Because the purpose of the received message encapsulation is to record the message and add it to the database. Since there is no 1 message, this is also absent. The message encapsulation Article 3rd has been written; 3. The encrypted signature is not verified at the demo entrance. Because the demo can be used if anyone needs to retrieve it. If encryption signature verification is added, many people may fail to call it. For local testing, there is no encrypted signature for verification (in fact, the local test can return true directly ), for anyone to understand, the verification method is removed, and the code of the verification method is kept in the first article. 4. The demo has no IOC injection and cache problems. Not every business requirement needs to use cache and IOC injection, and not everyone has come into contact with this. For general purpose, this will be removed. If you encounter problems related to IOC injection and cache processing in other projects, you can ask me. I am happy to answer the question: demo is a complete and simple public platform framework, it is also suitable for any developer. The database related to the actual project needs to use all the code and operation methods in the previous articles. Based on the demo, anyone can quickly create their own public platforms. The most important thing is to share the overall idea ~ The public platform is actually very simple. Most people do not clarify the ins and outs of message receipt and processing, for these different cases, it may take a long time for many developers to clarify (it has nothing to do with technical capabilities, mainly because some friends cannot understand it all at once) and share the demo source code, anyone can get started with copying code 1 public void LookMsgType (string msgType) 2 {3 4 # region determine Message Type 5 switch (msgType) 6 {7 case "text ": 8 RText mText = new RText (); 9 mText = ReadXml. getModel <RText> (mText, xmlModel); 10 BLLWei. doText (dbHome, mText); // text message 11 break; 12 case "image": 13 RImg mImg = new RImg (); 14 mImg = ReadXml. getModel <RImg> (mImg, xmlModel); 15 BLLWei. doImg (dbHome, mImg); // picture 16 break; 17 case "voice": // sound 18 RVoice mVoice = new RVoice (); 19 mVoice = ReadXml. getModel <RVoice> (mVoice, xmlModel); 20 BLLWei. doVoice (dbHome, mVoice); 21 break; 22 23 case "video": // video 24 RVideo mVideo = new RVideo (); 25 mVideo = ReadXml. getModel <RVideo> (mVideo, xmlModel); 26 BLLWei. doVideo (dbHome, mVideo); 27 break; 28 29 case "loca Tion ": // Location 30 RLocation mLocation = new RLocation (); 31 mLocation = ReadXml. getModel <RLocation> (mLocation, xmlModel); 32 BLLWei. doLocation (dbHome, mLocation); 33 break; 34 case "link": // link 35 RLink mLink = new RLink (); 36 mLink = ReadXml. getModel <RLink> (mLink, xmlModel); 37 BLLWei. doLink (dbHome, mLink); 38 break; 39 # region event 40 case "event": 41 42 switch (ReadXml. readModel ("Event", xmlModel) 43 {44 case "su Bscribe ": 45 46 if (ReadXml. readModel ("EventKey", xmlModel ). indexOf ("qrscene _")> = 0) 47 {48 RCodeNotSub mNotSub = new RCodeNotSub (); 49 mNotSub = ReadXml. getModel <RCodeNotSub> (mNotSub, xmlModel); 50 BLLWei. doCodeNotSub (dbHome, mNotSub); // for new users not paying attention to, scan the QR code with parameters to follow 51} 52 else53 {54 RSub mSub = new RSub (); 55 mSub = ReadXml. getModel <RSub> (mSub, xmlModel); 56 BLLWei. doSub (dbHome, mSub); // follow 57} 58 break; 59 case" Unsubscribe ": 60 RUnsub mUnSub = new RUnsub (); 61 mUnSub = ReadXml. getModel <RUnsub> (mUnSub, xmlModel); 62 BLLWei. doUnSub (dbHome, mUnSub); // remove 63 break; 64 65 case "SCAN": 66 RCodeSub mCodeSub = new RCodeSub (); 67 mCodeSub = ReadXml. getModel <RCodeSub> (mCodeSub, xmlModel); 68 BLLWei. doCodeSub (dbHome, mCodeSub); // The following user scans the two-dimensional code 69 break with parameters; 70 case "LOCATION": // The user reports the geographical LOCATION 71 72 RSubLocation mSubLoc = new RSubLoca Tion (); 73 mSubLoc = ReadXml. getModel <RSubLocation> (mSubLoc, xmlModel); 74 75 BLLWei. doSubLocation (dbHome, mSubLoc); 76 break; 77 case "CLICK": // CLICK 78 79 RMenuClick mMenuClk = new RMenuClick (); 80 mMenuClk = ReadXml. getModel <RMenuClick> (mMenuClk, xmlModel); 81 BLLWei. doMenuClick (dbHome, mMenuClk); 82 break; 83 case "VIEW": // custom menu jump event 84 85 RMenuView mMenuVw = new RMenuView (); 86 mMenuVw = ReadXml. getMod El <RMenuView> (mMenuVw, xmlModel); 87 BLLWei. doMenuView (dbHome, mMenuVw); 88 break; 89}; 90 break; 91 # endregion92} 93 # endregion94} copy the code and I will write an article later, just to share the development history, you can see that all of my articles have dropped the numbers, names, and so on, although no user's general number is used for testing when writing an article.

Related Article

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.