SWOOLE_HOOK_NATIVE_CURL|SWOOLE_HOOK_SLEEP]); Log::record(__FILE__ . " 3",Log::DEBUG); class RefillSender { const co_routines = 1000; const co_orders = 1000; public function send($index) { $count = self::co_orders; $time = time() * 1000 + $index; for ($i = 0; $i < $count; $i++) { Log::record(__FUNCTION__ . " index={$i}",Log::DEBUG); $this->push_order(1092, $time, $i); } } public function sendex() { $count = self::co_routines; $pThis = $this; for ($i = 0;$i < $count; $i++) { Log::record(__FUNCTION__ . " index={$i}",Log::DEBUG); go(function () use ($pThis,$i) { $pThis->send($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); Log::record("resp={$resp}",Log::DEBUG); } } //docker run busybox nslookup test.xyzshops.cn //$sender = new RefillSender(); //$sender->send(1); Log::record("send message start",Log::DEBUG); go(function () { $sender = new RefillSender(); $sender->sendex(); }); Log::record("send message end",Log::DEBUG);