


Detailed explanation of examples of simulated payment page jump notifications
This article mainly introduces in detail the relevant information on how to use SignalR to send page jump notifications. It has certain reference value. Interested friends can refer to it
Use Alipay to pay in WeChat Mall When the transaction is completed, there needs to be a transition page to prompt the user to open the page with a browser to pay, and then open WeChat after the user has completed the payment in the browser (WeChat still displays the transition page at this time), and the transition page needs to jump to the order details page. . So how does this excessive page know that it needs to jump?
What I can think of now is to use SigbalR to send a notification to tell the transition page to jump.
The first step is to add SigbalR related dll first.
The second step, customize hub
public class myHub:Hub { public override Task OnConnected() { return base.OnConnected(); } }
The third step, customize the UserIdProvider, because we need to send a jump notification to the specified user
public class CustomerUserIdProvider: IUserIdProvider { public string GetUserId(IRequest request) { //获取当前登录用户 var customer = EngineContext.Current.Resolve<IWorkContext>().CurrentCustomer; if(customer==null) { return ""; }else { //返回当前登录用户id return customer.Id.ToString(); } } }
The fourth step, register our customized UserIdProvider in startup
//SignlR var idProvider = new CustomerUserIdProvider(); GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => idProvider); app.MapSignalR();
The fifth step, add this line of code to the asynchronous notification of Alipay payment completion Send a notification and pass in the order number parameter. Here, a notification is sent to the user who ordered customerid. The order customerid is the same as the ID of the current login. So the information can be received.
var myHub = GlobalHost.ConnectionManager.GetHubContext<myHub>(); myHub.Clients.User(order.OrderCustomerId.ToString()).redirctOrderDetails(order.OrderNumber);
The sixth step, accept and execute on the transition page
// 声明一个代理引用该集线器,记得$.connection.后面的方法首字母必须要小写,这也是我为什么使用别名的原因 var chat = $.connection.chinookHub; // 这里是注册集线器调用的方法,和1.0不同的是需要chat.client后注册,1.0则不需要 chat.client.redirctOrderDetails = function (oerderNumber) { window.location.href = "/Customer/MyOrderDetails?page=4&orderNumber=" + oerderNumber; }; chat.client.redirctMoneyAccountDetail = function () { window.location.href = "/Customer/AccountDetail/Money"; }; // 启动连接 $.connection.hub.start();
In this way, you can perfectly realize the page jump after the payment is completed. I can't think of a better way at the moment.
【Related Recommendations】
1. ASP.NET Free Video Tutorial
3. Geek Academy ASP.NET Video Tutorial
The above is the detailed content of Detailed explanation of examples of simulated payment page jump notifications. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Detailed explanation of PHP page jump functions: Page jump techniques for header, location, redirect and other functions, which require specific code examples. Introduction: When developing a Web website or application, jumping between pages is an essential function. PHP provides a variety of ways to implement page jumps, including header functions, location functions, and jump functions provided by some third-party libraries, such as redirect. This article will introduce in detail how to use these functions

Title: Using uniapp to achieve page jump animation effect In recent years, the user interface design of mobile applications has become one of the important factors in attracting users. Page jump animation effects play an important role in improving user experience and visualization effects. This article will introduce how to use uniapp to achieve page jump animation effects, and provide specific code examples. uniapp is a cross-platform application development framework developed based on Vue.js. It can compile and generate applications for multiple platforms such as mini programs, H5, and App through a set of codes.

How to use routing to implement page jump in Vue? With the continuous development of front-end development technology, Vue.js has become one of the most popular front-end frameworks. In Vue development, page jump is an essential part. Vue provides VueRouter to manage application routing, and seamless switching between pages can be achieved through routing. This article will introduce how to use routing to implement page jumps in Vue, with code examples. First, install the vue-router plugin in the Vue project.

Title: PHP code example: How to use POST to pass parameters and implement page jumps In web development, it often involves the need to pass parameters through POST and process them on the server side to implement page jumps. PHP, as a popular server-side scripting language, provides a wealth of functions and syntax to achieve this purpose. The following will introduce how to use PHP to implement this function through a practical example. First, we need to prepare two pages, one to receive POST requests and process parameters

WeChat applet implements page jump animation effect In WeChat applet, page jump is a very common function. In order to improve the user experience, we can make page switching smoother and more vivid by adding animation effects. Below I will introduce how to use the WeChat applet API to achieve page jump animation effects, and attach specific code examples. First, we need to understand the life cycle function of the page in the WeChat applet. When the page is about to be displayed, you can implement page jump animation by listening to the onShow life cycle function of the page.

UniApp is a cross-platform development framework that can be used to quickly develop multi-terminal applications such as applets, apps, and H5. However, during the development process using UniApp, we will also encounter some problems. One of the common problems is the error message "Unable to find 'xxx' page jump". So, how do we solve this problem? First, we need to identify what is causing the problem. This problem is usually caused by an incorrect path setting on the page. In UniApp, we usually use routing (router

How to implement page jumps and navigation in uniapp. uniapp is a front-end framework that supports one-time coding and multi-end publishing. It is based on Vue.js. Developers can use uniapp to quickly develop mobile applications. In uniapp, implementing page jumps and navigation is a very common requirement. This article will introduce how to implement page jump and navigation in uniapp, and provide specific code examples. 1. Page jump Use the methods provided by uniapp to jump the page. uniapp provides a set of methods for implementation.

Best practices for using Golang to implement page jumps When developing web applications, page jumps are a common functional requirement. In Golang, we can use some libraries to implement page jumps, such as using the Gin framework to handle routing and page jumps. This article will introduce the best practices on how to implement page jumps in Golang, and give specific code examples. Introduction to Gin framework Gin is a web framework written in Go language, which is powerful and easy to use.
