stanley-king 1 year ago
parent
commit
9eb4e8ee46

+ 0 - 8
admin/control/provider_ctl.php

@@ -85,10 +85,6 @@ class provider_ctlControl extends SystemControl
                 ->order('opened asc , sort desc')
                 ->select();
 
-//            if (empty($providers)) {
-//                showMessage('暂无相关通道', 'index.php?act=provider&op=index');
-//            }
-
             $formData = $this->formData($type, $form);
             $amounts = $formData['amounts'];
             $cfgs = $formData['cfgs'];
@@ -137,10 +133,6 @@ class provider_ctlControl extends SystemControl
                 $datas[$pid] = $result;
             }
 
-//            if (empty($datas)) {
-//                showMessage('暂无相关通道配置', 'index.php?act=provider&op=index');
-//            }
-
             Tpl::output('form', $formData);
             Tpl::output('datas', $datas);
             Tpl::output('providers', $providers);

+ 25 - 0
admin/control/refill_event.php

@@ -11,6 +11,31 @@ class refill_eventControl extends SystemControl
 
     public function indexOp()
     {
+        $cacher = Cache::getInstance('cacheredis');
+        $cfgs = $cacher->get('event-config', 'refill-');
+
+        if (empty($cfgs))
+        {
+            $cfgs['open_crash'] = true;
+            $cfgs['cfgs_crash'] = [
+                'channels' => "",
+                'succ_interval' => 900
+            ];
+        }
+        else {
+            $cfgs = unserialize($cfgs);
+        }
+
+        if (chksubmit()) {
+            $channels = trim($_POST['open_crash']);
+            $cfgs['open_crash'] = boolval($_POST['open_crash'] ?? false);
+            $cfgs['cfgs_crash'] = [
+                'channels' => $channels,
+                'succ_interval' => intval($_POST['succ_interval'])
+            ];
+            $cacher->set('event-config', serialize($cfgs), 'refill-');
+        }
+        Tpl::output('cfgs', $cfgs);
         Tpl::showpage('refill_event.index');
     }
 }

+ 1 - 0
helper/refill/event/card_crash.php

@@ -135,4 +135,5 @@ class card_crash implements IEventRefill
 
         $this->complete($card_no, $oid, $ch_name, $success);
     }
+
 }

+ 19 - 0
test/TestRefillUtil.php

@@ -119,6 +119,25 @@ class TestRefillUtil extends TestCase
         $commit = refill\EventManager::instance()->onBeforeCommit($order,'a');
         refill\EventManager::instance()->onCommit($order,'a');
         refill\EventManager::instance()->onNotify($refill_info,$order_info,false);
+    }
+
+    public function testLoadcfgs()
+    {
+        $cacher = Cache::getInstance('cacheredis');
+        $cfgs = $cacher->get('event-config', 'refill-');
+
+        if (empty($cfgs))
+        {
+            $cfgs['open_crash'] = true;
+            $cfgs['cfgs_crash'] = [
+                'channels' => "a,b,c",
+                'succ_interval' => 90
+            ];
+        }
+        else {
+            $cfgs = unserialize($cfgs);
+        }
 
+        $cacher->set('event-config', serialize($cfgs), 'refill-');
     }
 }