stanley-king 1 year ago
parent
commit
dd72bf39e7

+ 5 - 0
data/model/refill_order.model.php

@@ -110,6 +110,11 @@ class refill_orderModel extends Model
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
         return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->update($datas);
     }
     }
 
 
+    public function get_detail($mchid,$mch_order)
+    {
+        return $this->table('refill_detail')->where(['mchid' => $mchid,'mch_order' => $mch_order])->find();
+    }
+
     public function exist($mchid, $mch_order, $part = '')
     public function exist($mchid, $mch_order, $part = '')
     {
     {
         $items = $this->table('refill_detail')->partition($part)->field('detail_id')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();
         $items = $this->table('refill_detail')->partition($part)->field('detail_id')->where(['mchid' => $mchid,'mch_order' => $mch_order])->select();

+ 1 - 1
docker/compose/homecuda/cpenv

@@ -1,7 +1,7 @@
 #!/bin/bash
 #!/bin/bash
 
 
 # shellcheck disable=SC2039
 # shellcheck disable=SC2039
-dest_dirs=("macc" "admin" "vendor" "cli" "cluster" "master" "racc" "slave" "worker")
+dest_dirs=("macc" "admin" "vendor" "cli" "cluster" "master" "racc" "slave" "worker" "remote")
 src_file=".env"
 src_file=".env"
 
 
 for dir in "${dest_dirs[@]}"; do
 for dir in "${dest_dirs[@]}"; do

+ 38 - 4
helper/refill/EventManager.php

@@ -2,8 +2,12 @@
 
 
 namespace refill;
 namespace refill;
 
 
-use Log;
+require_once(BASE_HELPER_PATH . '/refill/event/IEventRefill.php');
+require_once(BASE_HELPER_PATH . '/refill/event/crash.php');
+require_once(BASE_HELPER_PATH . '/refill/event/card_crash.php');
+
 use refill\event\card_crash;
 use refill\event\card_crash;
+use mtopcard;
 
 
 class EventManager
 class EventManager
 {
 {
@@ -24,7 +28,7 @@ class EventManager
         $cfgs = [
         $cfgs = [
             'open_crash' => true,
             'open_crash' => true,
             'cfgs_crash' => [
             'cfgs_crash' => [
-                'channels' => [],
+                'channels' => 'beirui_sec',
                 'succ_interval' => 900
                 'succ_interval' => 900
             ]
             ]
         ];
         ];
@@ -39,6 +43,10 @@ class EventManager
 
 
     public function onBeforeSubmit(order $order)
     public function onBeforeSubmit(order $order)
     {
     {
+        if(!$order->is_phone()) {
+            return true;
+        }
+
         foreach ($this->mStubs as $stub)
         foreach ($this->mStubs as $stub)
         {
         {
             if($stub->onBeforeSubmit($order) === false) {
             if($stub->onBeforeSubmit($order) === false) {
@@ -50,6 +58,10 @@ class EventManager
     }
     }
     public function onSubmit(order $order)
     public function onSubmit(order $order)
     {
     {
+        if(!$order->is_phone()) {
+            return;
+        }
+
         foreach ($this->mStubs as $stub) {
         foreach ($this->mStubs as $stub) {
             $stub->onSubmit($order);
             $stub->onSubmit($order);
         }
         }
@@ -57,6 +69,10 @@ class EventManager
 
 
     public function onBeforeCommit(order $order, $ch_name): bool
     public function onBeforeCommit(order $order, $ch_name): bool
     {
     {
+        if(!$order->is_phone()) {
+            return true;
+        }
+
         foreach ($this->mStubs as $stub)
         foreach ($this->mStubs as $stub)
         {
         {
             if ($stub->onBeforeCommit($order, $ch_name) === false) {
             if ($stub->onBeforeCommit($order, $ch_name) === false) {
@@ -68,6 +84,10 @@ class EventManager
     }
     }
     public function onCommit(order $order, $ch_name)
     public function onCommit(order $order, $ch_name)
     {
     {
+        if(!$order->is_phone()) {
+            return;
+        }
+
         foreach ($this->mStubs as $stub) {
         foreach ($this->mStubs as $stub) {
             $stub->onCommit($order, $ch_name);
             $stub->onCommit($order, $ch_name);
         }
         }
@@ -75,6 +95,10 @@ class EventManager
 
 
     public function onNeterror(order $order, $ch_name)
     public function onNeterror(order $order, $ch_name)
     {
     {
+        if(!$order->is_phone()) {
+            return;
+        }
+
         foreach ($this->mStubs as $stub) {
         foreach ($this->mStubs as $stub) {
             $stub->onNeterror($order, $ch_name);
             $stub->onNeterror($order, $ch_name);
         }
         }
@@ -82,15 +106,25 @@ class EventManager
 
 
     public function onNotify($refill_info, $order_info, $success)
     public function onNotify($refill_info, $order_info, $success)
     {
     {
+        $card_type = intval($refill_info['card_type']);
+        if(!in_array($card_type,[mtopcard\ChinaMobileCard,mtopcard\ChinaUnicomCard,mtopcard\ChinaTelecomCard])) {
+            return;
+        }
+
         foreach ($this->mStubs as $stub) {
         foreach ($this->mStubs as $stub) {
-            $stub->onNotify($$refill_info, $order_info, $success);
+            $stub->onNotify($refill_info, $order_info, $success);
         }
         }
     }
     }
 
 
     public function onComplete($refill_info, $order_info, $success)
     public function onComplete($refill_info, $order_info, $success)
     {
     {
+        $card_type = intval($refill_info['card_type']);
+        if(!in_array($card_type,[mtopcard\ChinaMobileCard,mtopcard\ChinaUnicomCard,mtopcard\ChinaTelecomCard])) {
+            return;
+        }
+
         foreach ($this->mStubs as $stub) {
         foreach ($this->mStubs as $stub) {
-            $stub->onComplete($$refill_info, $order_info, $success);
+            $stub->onComplete($refill_info, $order_info, $success);
         }
         }
     }
     }
 }
 }

+ 2 - 2
helper/refill/event/IEverntRefill.php

@@ -4,10 +4,10 @@ namespace refill\event;
 
 
 use refill\order;
 use refill\order;
 
 
-interface IEverntRefill
+interface IEventRefill
 {
 {
     public function load(array $cfgs);
     public function load(array $cfgs);
-    public static function onBeforeSubmit(order $order);
+    public function onBeforeSubmit(order $order);
     public function onSubmit(order $order);
     public function onSubmit(order $order);
     public function onBeforeCommit(order $order, $ch_name): bool;
     public function onBeforeCommit(order $order, $ch_name): bool;
     public function onCommit(order $order, $ch_name);
     public function onCommit(order $order, $ch_name);

+ 3 - 2
helper/refill/event/card_crash.MD

@@ -24,7 +24,7 @@ committings: 正在充值中,该卡号所有订单详情
 ### onEventBeforeSubmit
 ### onEventBeforeSubmit
 在收到用户卡号后,处理前。  
 在收到用户卡号后,处理前。  
 1,如果该卡号在这些通道成功了,并且时长不足指定时间,则该订单不被处理。  
 1,如果该卡号在这些通道成功了,并且时长不足指定时间,则该订单不被处理。  
-2,如果该卡号正在这些通道中,则该订单不被处理。
+2,如果该卡号正在充值中,则该订单不被处理。
 ### onEventSubmit
 ### onEventSubmit
 1,无需判断
 1,无需判断
 2,增加卡号和记录初始值。
 2,增加卡号和记录初始值。
@@ -38,11 +38,12 @@ committings: 正在充值中,该卡号所有订单详情
 ### onEventNotify
 ### onEventNotify
 1,失败按订单号,设正在提单的通道为空。
 1,失败按订单号,设正在提单的通道为空。
 ### onEventComplete
 ### onEventComplete
-1,失败的情况下,无需处理。
+1,成功和失败的情况下,都要清除当前订单信息。失败无须做进一步处理。
 2,如果之前无成功记录 -> 更换成功通道和成功时间。  
 2,如果之前无成功记录 -> 更换成功通道和成功时间。  
 3,如果之前有成功记录
 3,如果之前有成功记录
    如果该订单在这些通道成功 -> 更换成功通道和成功时间。  
    如果该订单在这些通道成功 -> 更换成功通道和成功时间。  
    如果之前在这些通道成功 -> 按时长判断是否更新
    如果之前在这些通道成功 -> 按时长判断是否更新
+
    否则->更新
    否则->更新
 4,清除该卡号,该订单的正在充值信息。
 4,清除该卡号,该订单的正在充值信息。
 
 

+ 47 - 101
helper/refill/event/card_crash.php

@@ -2,15 +2,16 @@
 
 
 namespace refill\event;
 namespace refill\event;
 
 
-use Log;
 use refill\order;
 use refill\order;
+use refill\util;
 
 
 # 规避相同手机卡号撞单问题解
 # 规避相同手机卡号撞单问题解
-class card_crash implements IEverntRefill
+class card_crash implements IEventRefill
 {
 {
-    private const cache_name = 'card_crash';
-    private $mChannels = [];
-    private $mSuccInterval = 900;
+    use crash;
+    public const cache_name = 'card_crash';
+    protected $mChannels = [];
+    protected $mSuccInterval = 900;
 
 
     public function __construct()
     public function __construct()
     {
     {
@@ -28,132 +29,77 @@ class card_crash implements IEverntRefill
         $this->mSuccInterval = intval($cfgs['succ_interval'] ?? 900);
         $this->mSuccInterval = intval($cfgs['succ_interval'] ?? 900);
     }
     }
 
 
-    public static function onBeforeSubmit(order $order)
-    {
-        return true;
-    }
-    public function onSubmit(order $order)
+    public function onBeforeSubmit(order $order)
     {
     {
         $card_no = $order->card_no();
         $card_no = $order->card_no();
-        $oid = $order->unique_id();
-        $org_val = [
-            'sc' => '', //succ ch_name
-            'st' => 0,  //succ time
-            'cc' => []  //正在提交的通道
-        ];
-
-        $val = $this->read($card_no) ?? $org_val;
-        $val['cc'][$oid] = '';
-        $this->write($card_no,$val);
-    }
-
+        $ret = $this->can_submit($card_no);
 
 
+        if(!$ret)
+        {
+            $mchid = $order->mchid();
+            $mch_order = $order->mch_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);
-    }
+            $mod_refill = Model('refill_order');
+            $val = $mod_refill->get_detail($mchid,$mch_order);
 
 
-    public function onComplete($refill_info, $order_info, $success)
-    {
-        $uid = "{$refill_info['mchid']}-{$refill_info['mch_order']}";
-        $ch_name = $refill_info['channel_name'];
+            if(!empty($val)) {
+                $params = json_decode($val['params'],true);
+                util::async_add($params, 60);
 
 
-        Log::record("onEvent complete uid=$uid channel=$ch_name success=$success", Log::DEBUG);
-    }
+                return false;
+            }
+        }
 
 
-    public function can_commit($card_no, $ch_name)
-    {
-        Log::record("card_crash can_commit $card_no $ch_name",Log::DEBUG);
         return true;
         return true;
     }
     }
-    private function can_add($card_no, $ch_name)
+    public function onSubmit(order $order)
     {
     {
-        if (!in_array($ch_name, card_crash::$stChannelNames)) {
-            return true;
-        }
-
-        $ret = $this->read($card_no);
-        if ($ret === false) {
-            return true;
-        }
-
-        [$ch_name, $time, $state] = $ret;
-        if (!in_array($ch_name, card_crash::$stChannelNames)) {
-            //如果限制的通道发生变化了,过去的数据无效处理。
-            dcache(card_crash::cache_name, 'refill-', $card_no);
-            return true;
-        }
+        $card_no = $order->card_no();
+        $oid = $order->unique_id();
 
 
-        if ($state === card_crash::SUCC)
-        {
-            if (time() - $time >= card_crash::SUCC_INTERVAL_SECS) {
-                return true;
-            } else {
-                return false;
-            }
-        }
-        elseif ($state === card_crash::SENDING) {
-            return false;
-        }
-        else {
-            return true;
-        }
+        $this->submit($card_no,$oid);
     }
     }
 
 
-    public function commit($card_no, $ch_name)
-    {
-        Log::record("card_crash commit $card_no $ch_name",Log::DEBUG);
-    }
 
 
-    public function notify($card_no, $ch_name, $fsucc)
+    public function onBeforeCommit(order $order, $ch_name): bool
     {
     {
-        Log::record("card_crash commit $card_no $ch_name succ=$fsucc",Log::DEBUG);
+        $card_no = $order->card_no();
+        $oid = $order->unique_id();
+
+        return $this->can_commit($card_no, $oid, $ch_name);
     }
     }
 
 
-    private function add($card_no, $chname)
+    public function onCommit(order $order, $ch_name)
     {
     {
+        $card_no = $order->card_no();
+        $oid = $order->unique_id();
 
 
+        $this->commit($card_no, $oid, $ch_name);
     }
     }
 
 
-    private function success($card_no, $chname)
+    public function onNeterror(order $order, $ch_name)
     {
     {
+        $card_no = $order->card_no();
+        $oid = $order->unique_id();
 
 
+        $this->submit($card_no,$oid);
     }
     }
 
 
-    private function fail($card_no, $chname)
+    public function onNotify($refill_info, $order_info, $success)
     {
     {
-    }
+        $oid = "{$refill_info['mchid']}-{$refill_info['mch_order']}";
+        $ch_name = $refill_info['channel_name'];
+        $card_no = $refill_info['card_no'];
 
 
-    private function write($card_no, $val)
-    {
-        $data = [$card_no => json_encode($val)];
-        wcache(card_crash::cache_name, $data, 'refill-');
+        $this->notify($card_no, $oid, $ch_name, $success);
     }
     }
 
 
-    private function read($card_no)
+    public function onComplete($refill_info, $order_info, $success)
     {
     {
-        $ret = rcache(card_crash::cache_name, 'refill-', $card_no);
-        if (empty($ret)) {
-            return false;
-        }
+        $oid = "{$refill_info['mchid']}-{$refill_info['mch_order']}";
+        $ch_name = $refill_info['channel_name'];
+        $card_no = $refill_info['card_no'];
 
 
-        $values = $ret[$card_no];
-        return json_decode($values, true);
+        $this->complete($card_no, $oid, $ch_name, $success);
     }
     }
 }
 }

+ 186 - 0
helper/refill/event/crash.php

@@ -0,0 +1,186 @@
+<?php
+
+namespace refill\event;
+
+trait crash
+{
+    private function can_submit($card_no)
+    {
+        if(empty($this->mChannels)) {
+            return true;
+        }
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            return true;
+        }
+
+        //目标是最佳解决撞单问题,唯一有效办法是睡眠.
+        $osc = $val['sc']; //old succ channel
+        $ost = $val['st']; //old succ time
+        //如果有充值中的相同卡号的单子,则睡眠.
+        if(!empty($val['cc'])) {
+            return false;
+        }
+
+        //成功的通道是撞单通道,并且成功时间还没过期,则睡眠
+        $now = time();
+        if (in_array($osc, $this->mChannels) and ($ost + $this->mSuccInterval >= $now)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private function submit($card_no, $oid)
+    {
+        if(empty($this->mChannels)) {
+            return;
+        }
+
+        $org_val = [
+            'sc' => '', //succ ch_name
+            'st' => 0,  //succ time
+            'cc' => []  //正在提交的通道
+        ];
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            $val = $org_val;
+        }
+
+        $val['cc'][$oid] = '';
+        $this->write($card_no,$val);
+    }
+
+    private function can_commit($card_no, $oid, $ch_name)
+    {
+        if(empty($this->mChannels)) {
+            return true;
+        }
+
+        //非撞单通道都可以提
+        if(!in_array($ch_name,$this->mChannels)) {
+            return true;
+        }
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            return true;
+        }
+
+        $ost = $val['st']; //old succ time
+        $now = time();
+        if($ost + $this->mSuccInterval >= $now) {
+            return false;
+        }
+
+        $commits = count($val['cc']);
+        if($commits > 1) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private function commit($card_no, $oid, $ch_name)
+    {
+        if(empty($this->mChannels)) {
+            return;
+        }
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            return;
+        }
+
+        $val['cc'][$oid] = $ch_name;
+        $this->write($card_no,$val);
+    }
+
+    private function notify($card_no, $oid, $ch_name,$succ)
+    {
+        if(empty($this->mChannels)) {
+            return;
+        }
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            return;
+        }
+
+        if(!$succ) {
+            $val['cc'][$oid] = '';
+            $this->write($card_no,$val);
+        } else {
+            $val['cc'][$oid] = $ch_name;
+            $this->write($card_no,$val);
+        }
+    }
+
+    private function complete($card_no, $oid, $ch_name,$succ)
+    {
+        if(empty($this->mChannels)) {
+            return;
+        }
+
+        $val = $this->read($card_no);
+        if($val === false) {
+            return;
+        }
+
+        unset($val['cc'][$oid]);
+        if($succ)
+        {
+            $now = time();
+            if(empty($val['sc'])) {
+                $val['sc'] = $ch_name;
+                $val['st'] = $now;
+            }
+            else
+            {
+                $osc = $val['sc']; //old succ channel
+                $ost = $val['st']; //old succ time
+
+                if(in_array($osc,$this->mChannels))
+                {
+                    //过去的成功通道,在撞单通道中。
+                    //如果新的通道也在撞单通道中,或者老的成功时间过了撞单周期
+                    //更新成功通道信息
+                    if (in_array($ch_name, $this->mChannels) or ($ost + $this->mSuccInterval < $now)) {
+                        $val['sc'] = $ch_name;
+                        $val['st'] = $now;
+                    }
+                }
+                else
+                {
+                    $val['sc'] = $ch_name;
+                    $val['st'] = $now;
+                }
+            }
+        }
+
+        $this->write($card_no,$val);
+    }
+
+    private function write($card_no, $val)
+    {
+        $data = [$card_no => json_encode($val)];
+        wcache(card_crash::cache_name, $data, 'refill-');
+    }
+
+    private function read($card_no)
+    {
+        $ret = rcache(card_crash::cache_name, 'refill-', $card_no);
+        if (empty($ret)) {
+            return false;
+        }
+
+        $values = $ret[$card_no];
+        return json_decode($values, true);
+    }
+    private function delete($card_no)
+    {
+        dcache(card_crash::cache_name, 'refill-', $card_no);
+    }
+}

+ 58 - 0
helper/refill/event/test_crash.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace refill\event;
+
+class test_crash
+{
+    use crash;
+
+    protected const cache_name = 'card_crash';
+    protected $mChannels = [];
+    protected $mSuccInterval = 900;
+
+    public function __construct()
+    {
+    }
+    public function load($cfgs)
+    {
+        $channels = $cfgs['channels'] ?? '';
+        $channels = explode(',',$channels);
+
+        $this->mChannels = [];
+        foreach ($channels as $item) {
+            $this->mChannels[] = trim($item);
+        }
+
+        $this->mSuccInterval = intval($cfgs['succ_interval'] ?? 900);
+    }
+    public function testDelete($card_no)
+    {
+        $this->delete($card_no);
+    }
+
+    public function testCan_submit($card_no)
+    {
+        return $this->can_submit($card_no);
+    }
+    public function testSubmit($card_no, $oid)
+    {
+        $this->submit($card_no,$oid);
+    }
+
+    public function testCan_commit($card_no, $oid, $ch_name)
+    {
+        return $this->can_commit($card_no, $oid, $ch_name);
+    }
+    public function testCommit($card_no, $oid, $ch_name)
+    {
+        $this->commit($card_no, $oid, $ch_name);
+    }
+    public function testNotify($card_no, $oid, $ch_name,$succ)
+    {
+        $this->notify($card_no, $oid, $ch_name,$succ);
+    }
+    public function testComplete($card_no, $oid, $ch_name,$succ)
+    {
+        $this->complete($card_no, $oid, $ch_name,$succ);
+    }
+}

+ 79 - 10
test/TestRefillUtil.php

@@ -10,8 +10,11 @@ require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_CORE_PATH . '/lrlz.php');
 require_once(BASE_CORE_PATH . '/lrlz.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_HELPER_PATH . '/refill/util.php');
 require_once(BASE_HELPER_PATH . '/refill/util.php');
-require_once(BASE_HELPER_PATH . '/refill/event/card_crash.php');
-require_once(BASE_HELPER_PATH . '/refill/event/IEventRefill.php');
+
+require_once(BASE_HELPER_PATH . '/refill/EventManager.php');
+require_once(BASE_HELPER_PATH . '/refill/event/test_crash.php');
+require_once(BASE_HELPER_PATH . '/refill/order.php');
+
 
 
 
 
 
 
@@ -45,15 +48,81 @@ class TestRefillUtil extends TestCase
         $all = refill\util::read_ches_submit_times();
         $all = refill\util::read_ches_submit_times();
     }
     }
 
 
-    public function testMonitor()
+    public function testSingleCrash()
     {
     {
         $card_no =  13911129867;
         $card_no =  13911129867;
-        $card_no1 = 13911129868;
-        $monitor = new refill\event\card_crash();
-        $ret = $monitor->can_commit($card_no,'beirui_nation');
-        $monitor->notify($card_no,'beirui_nation',true);
-        $ret = $monitor->can_commit($card_no1,'beirui_nation');
-        $monitor->commit($card_no1,'beirui_nation');
-        $monitor->notify($card_no,'beirui_nation',false);
+        $oid = '10486-S2311182459336';
+
+        $cfgs = [
+            'open_crash' => true,
+            'cfgs_crash' => [
+                'channels' => "a,b,c",
+                'succ_interval' => 900
+            ]
+        ];
+        $crasher = new refill\event\test_crash();
+        $crasher->load($cfgs['cfgs_crash'] ?? []);
+        $crasher->testDelete($card_no);
+        $crasher->testSubmit($card_no,$oid);
+        $crasher->testCommit($card_no,$oid,'a');
+        $crasher->testNotify($card_no,$oid,'a',false);
+        $crasher->testCommit($card_no,$oid,'b');
+        $crasher->testNotify($card_no,$oid,'b',false);
+        $crasher->testComplete($card_no,$oid,'b',true);
+    }
+
+    public function testCansubmit()
+    {
+        $card_no_a =  13911129867;
+        $oid_a = '10486-S2311182459336';
+        $oid_b = '10486-S2311182459338';
+
+        $cfgs = [
+            'open_crash' => true,
+            'cfgs_crash' => [
+                'channels' => "a,b,c",
+                'succ_interval' => 90
+            ]
+        ];
+        $crasher = new refill\event\test_crash();
+        $crasher->load($cfgs['cfgs_crash'] ?? []);
+        $ret = $crasher->testCan_submit($card_no_a);
+        if(!$ret) {
+            return;
+        }
+        $crasher->testSubmit($card_no_a,$oid_a);
+
+        $ret = $crasher->testCan_commit($card_no_a,$oid_a,'b');
+        if(!$ret) {
+            return;
+        }
+        $crasher->testCommit($card_no_a,$oid_a,'b');
+    }
+
+    public function testGetDetail()
+    {
+        $mod_refill = Model('refill_order');
+        $val = $mod_refill->get_detail('10216','FL21100909135245813399');
+        if(!empty($val)) {
+            $params = json_decode($val['params'],true);
+            $state = refill\util::async_add($params, 60);
+        }
+
+    }
+
+    public function testEventManager()
+    {
+        refill\EventManager::instance()->load();
+        $order_id = 3937988109;
+        $refill_info = Model('refill_order')->getOrderInfo(['order_id' => $order_id]);
+        $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
+
+        $order = refill\order::from_db($refill_info,$order_info);
+        $submit = refill\EventManager::instance()->onBeforeSubmit($order);
+        refill\EventManager::instance()->onSubmit($order);
+        $commit = refill\EventManager::instance()->onBeforeCommit($order,'a');
+        refill\EventManager::instance()->onCommit($order,'a');
+        refill\EventManager::instance()->onNotify($refill_info,$order_info,false);
+
     }
     }
 }
 }