国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Preview
Configuration item description
Response in call chain mode
理解調(diào)用鏈上下文
自定義MVC響應(yīng)
Home WeChat Applet WeChat Development Tutorial on the use of Bee.WeiXin WeChat framework

Tutorial on the use of Bee.WeiXin WeChat framework

May 05, 2017 am 10:07 AM

Let’s take a look at how to develop the WeChat public platform through Bee.WeiXin. Regarding the general introduction of WeChat public platform, I will not go into details here. Just look for it in the garden. This article mainly introduces Bee.WeXin, and the code has been published to beeweixin.codeplex.com/.

BeeWeiXin is a development framework developed for Tencent’s WeChat public platform. This project is developed based on Bee OPOA Platform.

Contains the following functions:

1. WeChat reply model based on call tree. The call tree supports multi-level (with context) responses, and can respond in three ways: text, graphics, and custom. Among them, you can customize the three methods (text, graphics, music) provided by the WeChat public platform API.

2. Provides the function of synchronizing the WeChat following user list.

3. Provides menu management function.

4. Provides image and text management functions.

5. Natively integrate all functions on Bee OPOA Platform, mainly Permission management.

About Debugging, it is recommended to use the tools provided by garden friends WeChat public account to develop and release debugging tools

Preview

Configuration item description

Configuration items are all configured in [appSettings] in web.config.

[WeiXinToken] is the public platform API token;

[Debug] is Indicates whether it is currently in debugging mode. The difference between debugging mode and non-debugging mode is whether the initiated call is verified.

[WeiXinUserName] and [WeiXinPassword] are required for [Resynchronize All Users] in the menu [WeChat Follow Users]. Log in the simulated web page to the WeChat public platform, and then obtain the user list information. If it is not needed, you can ignore it or hide this menu.

[WeiXinAppId] and [WeiXinAppSec] are required in the menu [WeChat Menu Management], which can manage the menu of WeChat public accounts. Of course, this tool [WeChat Public Account Development and Debugging Tool Release] also has this function, which is more convenient. If it is not needed, you can ignore it or hide this menu.

[WeiXinController] is the default system response Controller. Please refer to the code for specific logic.

Response in call chain mode

The call chain is based on context. There is an option in the configuration item [Whether to enter the call chain]. If so, this response will be added to the call chain. to form context. For example, [Menu 1] needs to enter the call chain, otherwise the sub-items under this item will not respond.

First look at the following pictures:

From the preview picture, you can intuitively understand that the call chain can provide three types of responses: text, graphics, and customization.

Text is a general text response. For example, [Menu 1] has been configured in the Bee.WeiXinDemo project to respond with text, and the node value is V1001_M1_1.

回復(fù)1,test1
回復(fù)2,test2
回復(fù)3,test3

The reply is as follows:

#The image and text are the image and text information provided in the WeChat public platform API, configured in the call chain Just enter the specified article numbers in order [this number is the ID in WeChat article management] (separated by commas).

For example, test2 under [Menu 1] is in graphic and text format. To enter test2, you need to trigger menu 1 first, and then trigger test2. As shown below:

Customization is integrated into the Bee OPOA Platform frameworkMVC . Therefore, the configuration is also implemented through Controller, Action.

For example, test3 under [Menu 1] is a custom method. To enter test3, you need to trigger menu 1 first, and then trigger test3. As shown below:

I don’t know if you understand it? It is recommended that you download the source code and debug it to deepen your understanding. It is best to take a look at the code when you have time to help improve the project, haha.

[Menu 1] only has key values ??[1], [2], and [3]. How should the user respond if he inputs something else? At this time, you only need to configure the key value [*] as a response to other configuration items.

理解調(diào)用鏈上下文

在這種基于調(diào)用鏈的應(yīng)答中, 上下文是必要的。 怎么理解呢?舉例說明吧:我要查詢某個產(chǎn)品的某個國家的最近3個月的銷售情況。 由于微信平臺的特性, 我們不可能像其他應(yīng)用給用戶以直觀的查詢。

我們只有采用引導(dǎo)式的方式去引導(dǎo)用戶得到她想要的結(jié)果。 設(shè)計的菜單如預(yù)覽圖中【多級菜單】項所示。具體的配置項如下圖:

當(dāng)用戶點擊菜單按鈕觸發(fā)了【V1001_M1_2】的事件, 系統(tǒng)響應(yīng)提示文本【上圖的1】; 用戶根據(jù)提示, 選擇產(chǎn)品, 輸入1, 系統(tǒng)提示輸入國家【上圖的2】。 由于國家太多, 不太可能配置所有國家的選項, 所有采用了一個通配符的方案【上圖的3】, 并采用自定義的方式應(yīng)答。? 代碼如下:

public WeiXinTextResult CheckCountry()
        {            string content = ViewData.TryGetValue<string>("content", string.Empty);            // 驗證輸入的國家是否合法
            bool validFlag = content.IndexOf("CN") >= 0;            if (validFlag)
            {                return WeiXinText("1 最近3個月銷售統(tǒng)計\r\n2 最近6個月銷售統(tǒng)計");
            }            else
            {                // 由于調(diào)用鏈有上下文, 用戶輸入錯誤, 需要將當(dāng)前應(yīng)答取消。Current.MessageStack.Pop();                Current.MessageStack.Pop();                return WeiXinText("國家不合法,請重新輸入國家。");
            }
        }

由以上代碼可以知道上下文可以通過Current.MessageStack獲取。

用戶輸入正確的國家代碼, 則引導(dǎo)用戶做下一個選擇.

自定義MVC響應(yīng)

這個基本上跟Bee OPOA Platform的方式一模一樣。 如【菜單1】下的【Other】項的響應(yīng)就是采用該方式的。代碼如下:

public ActionResult Other()
        {            return View();
        }

View代碼如下:

<%@ Page Language="C#" AutoEventWireup="false" Inherits="Bee.Web.BeePageView" %>

<%@ Import Namespace="Bee.Web" %>
<%@ Import Namespace="Bee" %>
<%@ Import Namespace="System.Collections.Generic" %>
<xml>
 <ToUserName><![CDATA[<%=ViewData["FromUserName"] %>]]></ToUserName>
 <FromUserName><![CDATA[<%=ViewData["ToUserName"] %>]]></FromUserName>
 <CreateTime><%=Bee.WeiXin.DateTimeUtil.GetWeixinDateTime(DateTime.Now) %></CreateTime>
 <MsgType><![CDATA[text]]></MsgType>
 <Content>回復(fù)1 聯(lián)系方式 
 回復(fù)2 在線咨詢</Content>
</xml>

框架基類 Bee.WeiXin.Controller.WeiXinControllerBase提供了微信公眾平臺API所對應(yīng)的三種響應(yīng)的ActionResult, 具體請查看源碼.

【相關(guān)推薦】

1. 微信公眾號平臺源碼下載

2.?微智創(chuàng)T+微信機器人源碼

The above is the detailed content of Tutorial on the use of Bee.WeiXin WeChat framework. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
PHP WeChat development: How to implement message encryption and decryption PHP WeChat development: How to implement message encryption and decryption May 13, 2023 am 11:40 AM

PHP is an open source scripting language that is widely used in web development and server-side programming, especially in WeChat development. Today, more and more companies and developers are starting to use PHP for WeChat development because it has become a truly easy-to-learn and easy-to-use development language. In WeChat development, message encryption and decryption are a very important issue because they involve data security. For messages without encryption and decryption methods, hackers can easily obtain the data, posing a threat to users.

PHP WeChat development: How to implement voting function PHP WeChat development: How to implement voting function May 14, 2023 am 11:21 AM

In the development of WeChat public accounts, the voting function is often used. The voting function is a great way for users to quickly participate in interactions, and it is also an important tool for holding events and surveying opinions. This article will introduce you how to use PHP to implement WeChat voting function. Obtain the authorization of the WeChat official account. First, you need to obtain the authorization of the WeChat official account. On the WeChat public platform, you need to configure the API address of the WeChat public account, the official account, and the token corresponding to the public account. In the process of our development using PHP language, we need to use the PH officially provided by WeChat

Using PHP to develop WeChat mass messaging tools Using PHP to develop WeChat mass messaging tools May 13, 2023 pm 05:00 PM

With the popularity of WeChat, more and more companies are beginning to use it as a marketing tool. The WeChat group messaging function is one of the important means for enterprises to conduct WeChat marketing. However, if you only rely on manual sending, it is an extremely time-consuming and laborious task for marketers. Therefore, it is particularly important to develop a WeChat mass messaging tool. This article will introduce how to use PHP to develop WeChat mass messaging tools. 1. Preparation work To develop WeChat mass messaging tools, we need to master the following technical points: Basic knowledge of PHP WeChat public platform development Development tools: Sub

PHP WeChat development: How to implement customer service chat window management PHP WeChat development: How to implement customer service chat window management May 13, 2023 pm 05:51 PM

WeChat is currently one of the social platforms with the largest user base in the world. With the popularity of mobile Internet, more and more companies are beginning to realize the importance of WeChat marketing. When conducting WeChat marketing, customer service is a crucial part. In order to better manage the customer service chat window, we can use PHP language for WeChat development. 1. Introduction to PHP WeChat development PHP is an open source server-side scripting language that is widely used in the field of Web development. Combined with the development interface provided by WeChat public platform, we can use PHP language to conduct WeChat

PHP WeChat development: How to implement user tag management PHP WeChat development: How to implement user tag management May 13, 2023 pm 04:31 PM

In the development of WeChat public accounts, user tag management is a very important function, which allows developers to better understand and manage their users. This article will introduce how to use PHP to implement the WeChat user tag management function. 1. Obtain the openid of the WeChat user. Before using the WeChat user tag management function, we first need to obtain the user's openid. In the development of WeChat public accounts, it is a common practice to obtain openid through user authorization. After the user authorization is completed, we can obtain the user through the following code

PHP WeChat development: How to implement group message sending records PHP WeChat development: How to implement group message sending records May 13, 2023 pm 04:31 PM

As WeChat becomes an increasingly important communication tool in people's lives, its agile messaging function is quickly favored by a large number of enterprises and individuals. For enterprises, developing WeChat into a marketing platform has become a trend, and the importance of WeChat development has gradually become more prominent. Among them, the group sending function is even more widely used. So, as a PHP programmer, how to implement group message sending records? The following will give you a brief introduction. 1. Understand the development knowledge related to WeChat public accounts. Before understanding how to implement group message sending records, I

Steps to implement WeChat public account development using PHP Steps to implement WeChat public account development using PHP Jun 27, 2023 pm 12:26 PM

How to use PHP to develop WeChat public accounts WeChat public accounts have become an important channel for promotion and interaction for many companies, and PHP, as a commonly used Web language, can also be used to develop WeChat public accounts. This article will introduce the specific steps to use PHP to develop WeChat public accounts. Step 1: Obtain the developer account of the WeChat official account. Before starting the development of the WeChat official account, you need to apply for a developer account of the WeChat official account. For the specific registration process, please refer to the official website of WeChat public platform

How to use PHP for WeChat development? How to use PHP for WeChat development? May 21, 2023 am 08:37 AM

With the development of the Internet and mobile smart devices, WeChat has become an indispensable part of the social and marketing fields. In this increasingly digital era, how to use PHP for WeChat development has become the focus of many developers. This article mainly introduces the relevant knowledge points on how to use PHP for WeChat development, as well as some of the tips and precautions. 1. Development environment preparation Before developing WeChat, you first need to prepare the corresponding development environment. Specifically, you need to install the PHP operating environment and the WeChat public platform

See all articles