123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php declare(strict_types=1);
- use PHPUnit\Framework\TestCase;
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 16/7/20
- * Time: 下午4:16
- */
- define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- class testQueue extends TestCase
- {
- public static function setUpBeforeClass() :void
- {
- Base::run_util();
- }
- public function testQueueSrv()
- {
- if (ob_get_level()) ob_end_clean();
- $model_queue = Model('queue',BASE_PATH);
- $worker = new QueueServer();
- while (true)
- {
- $list_key = $worker->scan();
- if (!empty($list_key) && is_array($list_key))
- {
- foreach ($list_key as $key) {
- $content = $worker->pop($list_key, 0);
- if (empty($content)) continue;
- $method = key($content);
- $arg = current($content);
- // $model_queue->$method($arg);
- echo date('Y-m-d H:i:s',time()).' '.$method."\n";
- flush();
- ob_flush();
- }
- }
- sleep(1);
- }
- }
- public function testPush()
- {
- //{"action":"sendreq","params":null}
- $x['action'] = 'sendreq';
- $x['params'] = ['speed' => 30];
- $y = json_encode($x);
- $param['member_id'] = 36490;
- $param['text'] = "红包退还通知:您发送的红包已超过24小时,退还未被领取的金额1234元,请在收支明细中查看.";
- $param['go_type'] = '';
- QueueClient::push('upushSendMsg',$param);
- }
- public function testOrderSuccess()
- {
- $mod = Model('order');
- $pay_sn = '270563196360813623';
- $order_info = $mod->getOrderInfo(array('pay_sn' => $pay_sn));
- $logic_order = Logic('order');
- $result = $logic_order->changeOrderStateReceive($order_info,'system','系统','超期未收货系统自动完成订单');
- }
- public function testRefund()
- {
- $client = Logic('queue');
- $client->QueryRefund(['order_id' => 1140016194]);
- }
- }
|