1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace refill;
- use Log;
- class EventManager
- {
- private static $stInstance = null;
- public static function instance()
- {
- if (self::$stInstance == null) {
- self::$stInstance = new EventManager();
- }
- return self::$stInstance;
- }
- public function load()
- {
- }
- public static function onBeforeSubmit(order $order)
- {
- return true;
- }
- public function onSubmit(order $order)
- {
- }
- public function onBeforeCommit(order $order, $ch_name): bool
- {
- return true;
- }
- public function onCommit(order $order, $ch_name)
- {
- }
- public function onNeterror(order $order, $ch_name)
- {
- }
- public function onNotify($refill_info, $order_info, $success)
- {
- $uid = "{$refill_info['mchid']}-{$refill_info['mch_order']}";
- $ch_name = $refill_info['channel_name'];
- Log::record("onEvent notify uid=$uid channel=$ch_name success=$success", Log::DEBUG);
- }
- public function onComplete($refill_info, $order_info, $success)
- {
- $uid = "{$refill_info['mchid']}-{$refill_info['mch_order']}";
- $ch_name = $refill_info['channel_name'];
- Log::record("onEvent complete uid=$uid channel=$ch_name success=$success", Log::DEBUG);
- }
- }
|