insertGetId([ 'uid' => $uid, 'type' => $type, 'data' => json_encode($param), 'time' => time(), ]); //执行任务 self::Task($type, ['taskId' => $updatId]); } /** * 执行任务数据 * @param $type 任务类型 * @param array $data 任务code * @return bool 任务数据 */ public static function Task($type, array $data = []) { $data['type'] = $type; $client = new \swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_SYNC); $ret = @$client->connect('127.0.0.1', 9506); if (!$ret) return false; $client->send(serialize($data) . "\r\n"); return true; try { }catch (\think\Exception $e) { return false; } } }