Using the quick development framework, you can quickly set up WeChat to browse the blog homepage articles.

Source: Internet
Author: User

Over the past few days, I have successively published several articles about the platform in "quick development public platform framework-Introduction" and "quick development framework for public platforms". However, the response is average and there may not be many requirements. Let's continue to rebuild the framework.

Today, I updated the Framework Code, listened to @ RMay's suggestion, and added an information middleware to process xelement, avoiding repeated parsing, so all interfaces were changed. The update is as follows:

1. added information middleware MiddleMessage

2. Changed the interface parameter type and changed the original XElement to MiddleMessage.

3. the Demo project has been deleted and WebDemo will be used for demonstration in the future.

All code has been updated to my Gibhub

The updated content is introduced. Next we will continue to build our Demo project.

All we wrote previously are returned text information. This morning, I added a CnblogsArticleNewsMessageHandler, mainly to return a ResponseNewsMessage (Text Information), as long as the message is sent: blog garden article, you can get the list of articles in the first 5 of the homepage, but in order to avoid causing pears in the blog garden, I cached the information and updated it once every 10 minutes. This time, we mainly adopted the webclient + regular expression method. The collection method does not matter and everyone can make full use of it.

Let's take a look at CnblogsArticleNewsMessageHandler:

 

As you can see, the interface parameter has been changed to MiddleMessage, which avoids the use of MiddleMessage. RequestMessage when I first added a new RequestMessage.

CnBlogsFeed is a self-written collection class designed to collect the homepage data of the blog. The number Type constructor is an extraction quantity. Due to platform restrictions, this value must be between 1 and 10.

Because it is a text message, the blog garden only provides the user's profile picture in the Description, while the multi-text message uses the image of the first article as the main image, the size is 320*200, therefore, I made the first image a default image. If you have a thumbnail, you can use your avatar. If not, a default thumbnail is displayed. The size is 200*200.

Let's take a look at the CnBlogsFeed class, which is not well written:

 

After the basic work is completed, you only need to change the previous TextMessageRole:

 

This rule is simple. Later, we will consider creating a text command specification. Because the Demo does not involve databases, it is judged manually for the time being.

Next, upload the code and test it:

Enter the blog site:

 

Enter the blog post:

 

The test is complete and can be used together. A unified text command method will be used in the future, but it is a bit difficult to understand. You can provide comments as to how to use it. Currently, we think of the following:

Keyword + command + parameter (optional)

Blog Park + inday + 5 (blog Park, with the user as inday, first 5 articles)

Weather + Shanghai (get the weather in Shanghai today)

Weather + Shanghai + 3 (get the weather in Shanghai in the next 3 days)

I will write a series of tutorials later, and try to use common message types as much as possible.

PS: For job hunting, Shanghai + e-commerce companies, it is better to have a tourism industry. It doesn't matter if you have a job title. You just have a head up and a development prospect. I have 30 + jobs, I don't want to change jobs too often. I just need to pay a salary of 12 k +. for self-evaluation, I am still a responsible person, project, or study. I will invest in it, C # is proficient in other languages. Send me the Email you need: james # taogame.com (#-> @)

PS2: I have received my baby's desk calendar today.

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.