1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- declare(strict_types=0);
- define('MOBILE_SERVER',true);
- define('USE_COROUTINE',true);
- define('SUPPORT_PTHREAD',false);
- define('APP_ID', 'sender');
- define('BASE_ROOT_PATH',str_replace('/server','',dirname(__FILE__)));
- define('BASE_PATH',BASE_ROOT_PATH . '/server');
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- require_once(BASE_HELPER_PATH . '/refill_proxy.php');
- Co::set(['hook_flags' => SWOOLE_HOOK_NATIVE_CURL|SWOOLE_HOOK_SLEEP]);
- class RefillSender
- {
- public function send($index)
- {
- $time = time() * 1000 + $index;
- for ($i = 0; $i < 500; $i++)
- {
- $this->push_order(1092, $time, $i);
- }
- }
- public function sendex()
- {
- $pThis = $this;
- for ($i = 1000;$i < 3000; $i++)
- {
- go(function () use ($pThis,$i) {
- $pThis->send($i);
- });
- }
- }
- private function push_order($mchid,$time,$index)
- {
- $notify_url = "http://test.xyzshops.cn/mobile/callback/bridge_test.php";
- $params = [ 'mchid' => $mchid,
- 'amount' => 30,
- 'order_sn' => "{$time}" . sprintf("%'010d",$index),
- 'cardno' => '13911129867',
- "act" => "refill",
- "op" => "add",
- 'notifyurl' => $notify_url
- ];
- $proxy = new refill_proxy("210fe406954220f56085997d6a4c5b80");
- $resp = $proxy->send("http://test.xyzshops.cn/mobile/index.php", $params);
- }
- }
- go(function () {
- $sender = new RefillSender();
- $sender->sendex();
- });
|