load(); } public function testQueueOrder() { refill\util::push_queue_order(1092,'abcdefg',30); $val = refill\util::query_queue_order(1092,'abcdefg'); } public function testWriteCard() { refill\util::write_card('1000113300017553895',mtopcard\SinopecCard,'13911129867'); } public function testChannelSubmitLimit() { $ch_name = 'test'; $fail_times = 10; $enough_times = 30; refill\util::write_ch_submit_times($ch_name,$fail_times,$enough_times); $val = refill\util::read_ch_submit_times($ch_name); $all = refill\util::read_ches_submit_times(); } public function testSingleCrash() { $card_no = 13911129867; $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 testCbparamsPick() { $cacher = Cache::getInstance('cacheredis'); $cfgs = $cacher->get('event-config', 'refill-'); if(!empty($cfgs)) { $cfgs = unserialize($cfgs); } if($cfgs['open_notify_osn'] || $cfgs['open_sms']) { $event = new refill\event\cbparams_pick(); $event->load($cfgs); $event->onEventCallback(['official_sn' => '1002','mchid' => 1093],[],$ctls); } } 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); } 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-'); } }