12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?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()
- {
- $time = time();
- for ($i = 0; $i < 10000; $i++)
- {
- $pThis = $this;
- go(function () use($time, $i,$pThis) {
- $pThis->push_order(1092, $time, $i);
- });
- }
- }
- private function push_order($mchid,$time,$index)
- {
- $notify_url = "https://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("https://test.xyzshops.cn/mobile/index.php", $params);
- $resp = json_encode($resp);
- Log::record("resp={$resp}",Log::DEBUG);
- }
- }
- Log::record("send message start",Log::DEBUG);
- go(function () {
- $sender = new RefillSender();
- $sender->send();
- });
- Log::record("send message end",Log::DEBUG);
|