What is the call principle of mall development event ? Down here, Niu ger So Niushop Alipay payment plug-in (apipay) The principle of popular description of the event call principle :
How to call the event , example event(‘Pay’, [‘pay_type’ => ‘alipay’]);
The query can be implemented Pay List of plug-ins for the event :
By querying the plug-in configuration file event.php
return [
‘bind’ => [
],
‘listen’ => [
// Payment asynchronous callback 'PayNotify' => [ 'addon\alipay\event\PayNotify' ], // Payment method , Background query
'PayType' => [ 'addon\alipay\event\PayType' ], // payment , Foreground application 'Pay' => [
'addon\alipay\event\Pay' ], 'PayClose' => [ 'addon\alipay\event\PayClose' ],
'PayRefund' => [ 'addon\alipay\event\PayRefund' ], 'PayTransfer' => [
'addon\alipay\event\PayTransfer' ], 'TransferType' => [
'addon\alipay\event\TransferType' ]
],
‘subscribe’ => [
],
];
By instantiating the class file of the corresponding event , Establishing objects , Execute the corresponding method at the same time
for example : Event configuration file :‘addon\alipay\event\Pay’, Create the object first :
$class = new addon\alipay\event\Pay();
Next, call the corresponding handle($param):
$res = $class->handle([‘pay_type’ => ‘alipay’]);
Loop plug-in configuration file event.php Return the data in turn
A Niu ger Using Alipay payment plug-in configuration as an example , This paper introduces the principle of event call in open source mall system , I hope it can help you !
Technology