Browse Source

composer require workerman/gatewayclient

lizhen_gitee 1 year ago
parent
commit
a88717f9e4

+ 2 - 1
composer.json

@@ -11,7 +11,8 @@
         "laravel/framework": "^8.75",
         "laravel/sanctum": "^2.11",
         "laravel/tinker": "^2.5",
-        "maniac/easemob-php": "^1.0"
+        "maniac/easemob-php": "^1.0",
+        "workerman/gatewayclient": "^3.0"
     },
     "require-dev": {
         "facade/ignition": "^2.5",

+ 39 - 2
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "7ee24f946bd09d5146e203f4384b455e",
+    "content-hash": "3d6c107fd4f2f6b5ed74d9c4d3233d31",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -6034,6 +6034,43 @@
                 "source": "https://github.com/webmozarts/assert/tree/1.11.0"
             },
             "time": "2022-06-03T18:03:27+00:00"
+        },
+        {
+            "name": "workerman/gatewayclient",
+            "version": "v3.0.17",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/walkor/GatewayClient.git",
+                "reference": "0f67651ce92628d5e85d2ae45478f12b0d1e9f66"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/walkor/GatewayClient/zipball/0f67651ce92628d5e85d2ae45478f12b0d1e9f66",
+                "reference": "0f67651ce92628d5e85d2ae45478f12b0d1e9f66",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "GatewayClient\\": "./"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "homepage": "http://www.workerman.net",
+            "support": {
+                "issues": "https://github.com/walkor/GatewayClient/issues",
+                "source": "https://github.com/walkor/GatewayClient/tree/v3.0.17"
+            },
+            "time": "2023-11-09T13:48:46+00:00"
         }
     ],
     "packages-dev": [
@@ -8557,5 +8594,5 @@
         "php": "^7.3|^8.0"
     },
     "platform-dev": [],
-    "plugin-api-version": "2.6.0"
+    "plugin-api-version": "2.1.0"
 }

+ 0 - 18
vendor/autoload.php

@@ -2,24 +2,6 @@
 
 // autoload.php @generated by Composer
 
-if (PHP_VERSION_ID < 50600) {
-    if (!headers_sent()) {
-        header('HTTP/1.1 500 Internal Server Error');
-    }
-    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
-    if (!ini_get('display_errors')) {
-        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
-            fwrite(STDERR, $err);
-        } elseif (!headers_sent()) {
-            echo $err;
-        }
-    }
-    trigger_error(
-        $err,
-        E_USER_ERROR
-    );
-}
-
 require_once __DIR__ . '/composer/autoload_real.php';
 
 return ComposerAutoloaderInited4271df5cac54f00267a6eeb6e632d2::getLoader();

+ 33 - 131
vendor/composer/ClassLoader.php

@@ -42,76 +42,30 @@ namespace Composer\Autoload;
  */
 class ClassLoader
 {
-    /** @var \Closure(string):void */
-    private static $includeFile;
-
-    /** @var string|null */
     private $vendorDir;
 
     // PSR-4
-    /**
-     * @var array<string, array<string, int>>
-     */
     private $prefixLengthsPsr4 = array();
-    /**
-     * @var array<string, list<string>>
-     */
     private $prefixDirsPsr4 = array();
-    /**
-     * @var list<string>
-     */
     private $fallbackDirsPsr4 = array();
 
     // PSR-0
-    /**
-     * List of PSR-0 prefixes
-     *
-     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
-     *
-     * @var array<string, array<string, list<string>>>
-     */
     private $prefixesPsr0 = array();
-    /**
-     * @var list<string>
-     */
     private $fallbackDirsPsr0 = array();
 
-    /** @var bool */
     private $useIncludePath = false;
-
-    /**
-     * @var array<string, string>
-     */
     private $classMap = array();
-
-    /** @var bool */
     private $classMapAuthoritative = false;
-
-    /**
-     * @var array<string, bool>
-     */
     private $missingClasses = array();
-
-    /** @var string|null */
     private $apcuPrefix;
 
-    /**
-     * @var array<string, self>
-     */
     private static $registeredLoaders = array();
 
-    /**
-     * @param string|null $vendorDir
-     */
     public function __construct($vendorDir = null)
     {
         $this->vendorDir = $vendorDir;
-        self::initializeIncludeClosure();
     }
 
-    /**
-     * @return array<string, list<string>>
-     */
     public function getPrefixes()
     {
         if (!empty($this->prefixesPsr0)) {
@@ -121,42 +75,28 @@ class ClassLoader
         return array();
     }
 
-    /**
-     * @return array<string, list<string>>
-     */
     public function getPrefixesPsr4()
     {
         return $this->prefixDirsPsr4;
     }
 
-    /**
-     * @return list<string>
-     */
     public function getFallbackDirs()
     {
         return $this->fallbackDirsPsr0;
     }
 
-    /**
-     * @return list<string>
-     */
     public function getFallbackDirsPsr4()
     {
         return $this->fallbackDirsPsr4;
     }
 
-    /**
-     * @return array<string, string> Array of classname => path
-     */
     public function getClassMap()
     {
         return $this->classMap;
     }
 
     /**
-     * @param array<string, string> $classMap Class to filename map
-     *
-     * @return void
+     * @param array $classMap Class to filename map
      */
     public function addClassMap(array $classMap)
     {
@@ -171,25 +111,22 @@ class ClassLoader
      * Registers a set of PSR-0 directories for a given prefix, either
      * appending or prepending to the ones previously set for this prefix.
      *
-     * @param string              $prefix  The prefix
-     * @param list<string>|string $paths   The PSR-0 root directories
-     * @param bool                $prepend Whether to prepend the directories
-     *
-     * @return void
+     * @param string       $prefix  The prefix
+     * @param array|string $paths   The PSR-0 root directories
+     * @param bool         $prepend Whether to prepend the directories
      */
     public function add($prefix, $paths, $prepend = false)
     {
-        $paths = (array) $paths;
         if (!$prefix) {
             if ($prepend) {
                 $this->fallbackDirsPsr0 = array_merge(
-                    $paths,
+                    (array) $paths,
                     $this->fallbackDirsPsr0
                 );
             } else {
                 $this->fallbackDirsPsr0 = array_merge(
                     $this->fallbackDirsPsr0,
-                    $paths
+                    (array) $paths
                 );
             }
 
@@ -198,19 +135,19 @@ class ClassLoader
 
         $first = $prefix[0];
         if (!isset($this->prefixesPsr0[$first][$prefix])) {
-            $this->prefixesPsr0[$first][$prefix] = $paths;
+            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
 
             return;
         }
         if ($prepend) {
             $this->prefixesPsr0[$first][$prefix] = array_merge(
-                $paths,
+                (array) $paths,
                 $this->prefixesPsr0[$first][$prefix]
             );
         } else {
             $this->prefixesPsr0[$first][$prefix] = array_merge(
                 $this->prefixesPsr0[$first][$prefix],
-                $paths
+                (array) $paths
             );
         }
     }
@@ -219,28 +156,25 @@ class ClassLoader
      * Registers a set of PSR-4 directories for a given namespace, either
      * appending or prepending to the ones previously set for this namespace.
      *
-     * @param string              $prefix  The prefix/namespace, with trailing '\\'
-     * @param list<string>|string $paths   The PSR-4 base directories
-     * @param bool                $prepend Whether to prepend the directories
+     * @param string       $prefix  The prefix/namespace, with trailing '\\'
+     * @param array|string $paths   The PSR-4 base directories
+     * @param bool         $prepend Whether to prepend the directories
      *
      * @throws \InvalidArgumentException
-     *
-     * @return void
      */
     public function addPsr4($prefix, $paths, $prepend = false)
     {
-        $paths = (array) $paths;
         if (!$prefix) {
             // Register directories for the root namespace.
             if ($prepend) {
                 $this->fallbackDirsPsr4 = array_merge(
-                    $paths,
+                    (array) $paths,
                     $this->fallbackDirsPsr4
                 );
             } else {
                 $this->fallbackDirsPsr4 = array_merge(
                     $this->fallbackDirsPsr4,
-                    $paths
+                    (array) $paths
                 );
             }
         } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@@ -250,18 +184,18 @@ class ClassLoader
                 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
             }
             $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
-            $this->prefixDirsPsr4[$prefix] = $paths;
+            $this->prefixDirsPsr4[$prefix] = (array) $paths;
         } elseif ($prepend) {
             // Prepend directories for an already registered namespace.
             $this->prefixDirsPsr4[$prefix] = array_merge(
-                $paths,
+                (array) $paths,
                 $this->prefixDirsPsr4[$prefix]
             );
         } else {
             // Append directories for an already registered namespace.
             $this->prefixDirsPsr4[$prefix] = array_merge(
                 $this->prefixDirsPsr4[$prefix],
-                $paths
+                (array) $paths
             );
         }
     }
@@ -270,10 +204,8 @@ class ClassLoader
      * Registers a set of PSR-0 directories for a given prefix,
      * replacing any others previously set for this prefix.
      *
-     * @param string              $prefix The prefix
-     * @param list<string>|string $paths  The PSR-0 base directories
-     *
-     * @return void
+     * @param string       $prefix The prefix
+     * @param array|string $paths  The PSR-0 base directories
      */
     public function set($prefix, $paths)
     {
@@ -288,12 +220,10 @@ class ClassLoader
      * Registers a set of PSR-4 directories for a given namespace,
      * replacing any others previously set for this namespace.
      *
-     * @param string              $prefix The prefix/namespace, with trailing '\\'
-     * @param list<string>|string $paths  The PSR-4 base directories
+     * @param string       $prefix The prefix/namespace, with trailing '\\'
+     * @param array|string $paths  The PSR-4 base directories
      *
      * @throws \InvalidArgumentException
-     *
-     * @return void
      */
     public function setPsr4($prefix, $paths)
     {
@@ -313,8 +243,6 @@ class ClassLoader
      * Turns on searching the include path for class files.
      *
      * @param bool $useIncludePath
-     *
-     * @return void
      */
     public function setUseIncludePath($useIncludePath)
     {
@@ -337,8 +265,6 @@ class ClassLoader
      * that have not been registered with the class map.
      *
      * @param bool $classMapAuthoritative
-     *
-     * @return void
      */
     public function setClassMapAuthoritative($classMapAuthoritative)
     {
@@ -359,8 +285,6 @@ class ClassLoader
      * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
      *
      * @param string|null $apcuPrefix
-     *
-     * @return void
      */
     public function setApcuPrefix($apcuPrefix)
     {
@@ -381,8 +305,6 @@ class ClassLoader
      * Registers this instance as an autoloader.
      *
      * @param bool $prepend Whether to prepend the autoloader or not
-     *
-     * @return void
      */
     public function register($prepend = false)
     {
@@ -402,8 +324,6 @@ class ClassLoader
 
     /**
      * Unregisters this instance as an autoloader.
-     *
-     * @return void
      */
     public function unregister()
     {
@@ -423,8 +343,7 @@ class ClassLoader
     public function loadClass($class)
     {
         if ($file = $this->findFile($class)) {
-            $includeFile = self::$includeFile;
-            $includeFile($file);
+            includeFile($file);
 
             return true;
         }
@@ -475,20 +394,15 @@ class ClassLoader
     }
 
     /**
-     * Returns the currently registered loaders keyed by their corresponding vendor directories.
+     * Returns the currently registered loaders indexed by their corresponding vendor directories.
      *
-     * @return array<string, self>
+     * @return self[]
      */
     public static function getRegisteredLoaders()
     {
         return self::$registeredLoaders;
     }
 
-    /**
-     * @param  string       $class
-     * @param  string       $ext
-     * @return string|false
-     */
     private function findFileWithExtension($class, $ext)
     {
         // PSR-4 lookup
@@ -554,26 +468,14 @@ class ClassLoader
 
         return false;
     }
+}
 
-    /**
-     * @return void
-     */
-    private static function initializeIncludeClosure()
-    {
-        if (self::$includeFile !== null) {
-            return;
-        }
-
-        /**
-         * Scope isolated include.
-         *
-         * Prevents access to $this/self from included files.
-         *
-         * @param  string $file
-         * @return void
-         */
-        self::$includeFile = \Closure::bind(static function($file) {
-            include $file;
-        }, null, null);
-    }
+/**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ */
+function includeFile($file)
+{
+    include $file;
 }

+ 11 - 33
vendor/composer/InstalledVersions.php

@@ -20,27 +20,12 @@ use Composer\Semver\VersionParser;
  *
  * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
  *
- * To require its presence, you can require `composer-runtime-api ^2.0`
- *
- * @final
+ * To require it's presence, you can require `composer-runtime-api ^2.0`
  */
 class InstalledVersions
 {
-    /**
-     * @var mixed[]|null
-     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
-     */
     private static $installed;
-
-    /**
-     * @var bool|null
-     */
     private static $canGetVendors;
-
-    /**
-     * @var array[]
-     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
-     */
     private static $installedByVendor = array();
 
     /**
@@ -98,7 +83,7 @@ class InstalledVersions
     {
         foreach (self::getInstalled() as $installed) {
             if (isset($installed['versions'][$packageName])) {
-                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
+                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
             }
         }
 
@@ -119,7 +104,7 @@ class InstalledVersions
      */
     public static function satisfies(VersionParser $parser, $packageName, $constraint)
     {
-        $constraint = $parser->parseConstraints((string) $constraint);
+        $constraint = $parser->parseConstraints($constraint);
         $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
 
         return $provided->matches($constraint);
@@ -243,7 +228,7 @@ class InstalledVersions
 
     /**
      * @return array
-     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
+     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
      */
     public static function getRootPackage()
     {
@@ -257,7 +242,7 @@ class InstalledVersions
      *
      * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
      * @return array[]
-     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
+     * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
      */
     public static function getRawData()
     {
@@ -280,7 +265,7 @@ class InstalledVersions
      * Returns the raw data of all installed.php which are currently loaded for custom implementations
      *
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
      */
     public static function getAllRawData()
     {
@@ -303,7 +288,7 @@ class InstalledVersions
      * @param  array[] $data A vendor/composer/installed.php data set
      * @return void
      *
-     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
+     * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
      */
     public static function reload($data)
     {
@@ -313,7 +298,7 @@ class InstalledVersions
 
     /**
      * @return array[]
-     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
+     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
      */
     private static function getInstalled()
     {
@@ -328,9 +313,7 @@ class InstalledVersions
                 if (isset(self::$installedByVendor[$vendorDir])) {
                     $installed[] = self::$installedByVendor[$vendorDir];
                 } elseif (is_file($vendorDir.'/composer/installed.php')) {
-                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
-                    $required = require $vendorDir.'/composer/installed.php';
-                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
+                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
                         self::$installed = $installed[count($installed) - 1];
                     }
@@ -342,17 +325,12 @@ class InstalledVersions
             // only require the installed.php file if this file is loaded from its dumped location,
             // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
             if (substr(__DIR__, -8, 1) !== 'C') {
-                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
-                $required = require __DIR__ . '/installed.php';
-                self::$installed = $required;
+                self::$installed = require __DIR__ . '/installed.php';
             } else {
                 self::$installed = array();
             }
         }
-
-        if (self::$installed !== array()) {
-            $installed[] = self::$installed;
-        }
+        $installed[] = self::$installed;
 
         return $installed;
     }

+ 8 - 2
vendor/composer/autoload_classmap.php

@@ -2,10 +2,12 @@
 
 // autoload_classmap.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
+    'App\\Common\\Library\\Easemob' => $baseDir . '/app/Common/Library/Easemob.php',
+    'App\\Console\\Commands\\Plantask' => $baseDir . '/app/Console/Commands/Plantask.php',
     'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
     'App\\Exceptions\\Handler' => $baseDir . '/app/Exceptions/Handler.php',
     'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php',
@@ -18,6 +20,8 @@ return array(
     'App\\Http\\Middleware\\TrustHosts' => $baseDir . '/app/Http/Middleware/TrustHosts.php',
     'App\\Http\\Middleware\\TrustProxies' => $baseDir . '/app/Http/Middleware/TrustProxies.php',
     'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
+    'App\\Jobs\\GiftJob' => $baseDir . '/app/Jobs/GiftJob.php',
+    'App\\Jobs\\GrabgiftJob' => $baseDir . '/app/Jobs/GrabgiftJob.php',
     'App\\Models\\User' => $baseDir . '/app/Models/User.php',
     'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
     'App\\Providers\\AuthServiceProvider' => $baseDir . '/app/Providers/AuthServiceProvider.php',
@@ -872,7 +876,6 @@ return array(
     'Faker\\Provider\\nl_BE\\Payment' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_BE/Payment.php',
     'Faker\\Provider\\nl_BE\\Person' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_BE/Person.php',
     'Faker\\Provider\\nl_BE\\PhoneNumber' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php',
-    'Faker\\Provider\\nl_BE\\Text' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_BE/Text.php',
     'Faker\\Provider\\nl_NL\\Address' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_NL/Address.php',
     'Faker\\Provider\\nl_NL\\Color' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_NL/Color.php',
     'Faker\\Provider\\nl_NL\\Company' => $vendorDir . '/fakerphp/faker/src/Faker/Provider/nl_NL/Company.php',
@@ -997,6 +1000,9 @@ return array(
     'Faker\\ValidGenerator' => $vendorDir . '/fakerphp/faker/src/Faker/ValidGenerator.php',
     'Fruitcake\\Cors\\CorsServiceProvider' => $vendorDir . '/fruitcake/laravel-cors/src/CorsServiceProvider.php',
     'Fruitcake\\Cors\\HandleCors' => $vendorDir . '/fruitcake/laravel-cors/src/HandleCors.php',
+    'GatewayClient\\Context' => $vendorDir . '/workerman/gatewayclient/Context.php',
+    'GatewayClient\\Gateway' => $vendorDir . '/workerman/gatewayclient/Gateway.php',
+    'GatewayClient\\GatewayProtocol' => $vendorDir . '/workerman/gatewayclient/GatewayProtocol.php',
     'GrahamCampbell\\ResultType\\Error' => $vendorDir . '/graham-campbell/result-type/src/Error.php',
     'GrahamCampbell\\ResultType\\Result' => $vendorDir . '/graham-campbell/result-type/src/Result.php',
     'GrahamCampbell\\ResultType\\Success' => $vendorDir . '/graham-campbell/result-type/src/Success.php',

+ 17 - 17
vendor/composer/autoload_files.php

@@ -2,39 +2,39 @@
 
 // autoload_files.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
     'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
-    '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
     '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
+    'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
+    '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
     'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
-    '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
-    '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
     '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
     'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
     '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
-    '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
-    'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
-    '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
+    '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
+    'c72349b1fe8d0deeedd3a52e8aa814d8' => $vendorDir . '/mockery/mockery/library/helpers.php',
+    'ce9671a430e4846b44e1c68c7611f9f5' => $vendorDir . '/mockery/mockery/library/Mockery.php',
+    '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
     '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
-    'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
     'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
-    '9cdd7b9056abc3081735233ba9dd9c7f' => $vendorDir . '/facade/flare-client-php/src/helpers.php',
-    '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+    'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
+    '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
+    '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
+    '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
     '538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php',
-    '801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php',
     'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php',
-    '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
-    'ed962a97bd972bc82007176b647d4e36' => $vendorDir . '/facade/ignition/src/helpers.php',
-    '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
     '265b4faa2b3a9766332744949e83bf97' => $vendorDir . '/laravel/framework/src/Illuminate/Collections/helpers.php',
     'c7a3c339e7e14b60e06a2d7fcce9476b' => $vendorDir . '/laravel/framework/src/Illuminate/Events/functions.php',
     'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
     '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
+    '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
+    '9cdd7b9056abc3081735233ba9dd9c7f' => $vendorDir . '/facade/flare-client-php/src/helpers.php',
+    '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+    '801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php',
+    'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
+    'ed962a97bd972bc82007176b647d4e36' => $vendorDir . '/facade/ignition/src/helpers.php',
     '0f5bcb416d34db1c9ad4167f1809a53c' => $vendorDir . '/maniac/easemob-php/src/functions.php',
-    'c72349b1fe8d0deeedd3a52e8aa814d8' => $vendorDir . '/mockery/mockery/library/helpers.php',
-    'ce9671a430e4846b44e1c68c7611f9f5' => $vendorDir . '/mockery/mockery/library/Mockery.php',
-    'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
 );

+ 1 - 1
vendor/composer/autoload_namespaces.php

@@ -2,7 +2,7 @@
 
 // autoload_namespaces.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(

+ 2 - 1
vendor/composer/autoload_psr4.php

@@ -2,7 +2,7 @@
 
 // autoload_psr4.php @generated by Composer
 
-$vendorDir = dirname(__DIR__);
+$vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
@@ -68,6 +68,7 @@ return array(
     'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
     'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
     'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'),
+    'GatewayClient\\' => array($vendorDir . '/workerman/gatewayclient'),
     'Fruitcake\\Cors\\' => array($vendorDir . '/fruitcake/laravel-cors/src'),
     'Faker\\' => array($vendorDir . '/fakerphp/faker/src/Faker'),
     'Facade\\Ignition\\' => array($vendorDir . '/facade/ignition/src'),

+ 37 - 12
vendor/composer/autoload_real.php

@@ -25,26 +25,51 @@ class ComposerAutoloaderInited4271df5cac54f00267a6eeb6e632d2
         require __DIR__ . '/platform_check.php';
 
         spl_autoload_register(array('ComposerAutoloaderInited4271df5cac54f00267a6eeb6e632d2', 'loadClassLoader'), true, true);
-        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
+        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
         spl_autoload_unregister(array('ComposerAutoloaderInited4271df5cac54f00267a6eeb6e632d2', 'loadClassLoader'));
 
-        require __DIR__ . '/autoload_static.php';
-        call_user_func(\Composer\Autoload\ComposerStaticInited4271df5cac54f00267a6eeb6e632d2::getInitializer($loader));
+        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
+        if ($useStaticLoader) {
+            require __DIR__ . '/autoload_static.php';
 
-        $loader->register(true);
+            call_user_func(\Composer\Autoload\ComposerStaticInited4271df5cac54f00267a6eeb6e632d2::getInitializer($loader));
+        } else {
+            $map = require __DIR__ . '/autoload_namespaces.php';
+            foreach ($map as $namespace => $path) {
+                $loader->set($namespace, $path);
+            }
 
-        $filesToLoad = \Composer\Autoload\ComposerStaticInited4271df5cac54f00267a6eeb6e632d2::$files;
-        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
-            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
-                $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+            $map = require __DIR__ . '/autoload_psr4.php';
+            foreach ($map as $namespace => $path) {
+                $loader->setPsr4($namespace, $path);
+            }
 
-                require $file;
+            $classMap = require __DIR__ . '/autoload_classmap.php';
+            if ($classMap) {
+                $loader->addClassMap($classMap);
             }
-        }, null, null);
-        foreach ($filesToLoad as $fileIdentifier => $file) {
-            $requireFile($fileIdentifier, $file);
+        }
+
+        $loader->register(true);
+
+        if ($useStaticLoader) {
+            $includeFiles = Composer\Autoload\ComposerStaticInited4271df5cac54f00267a6eeb6e632d2::$files;
+        } else {
+            $includeFiles = require __DIR__ . '/autoload_files.php';
+        }
+        foreach ($includeFiles as $fileIdentifier => $file) {
+            composerRequireed4271df5cac54f00267a6eeb6e632d2($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
+
+function composerRequireed4271df5cac54f00267a6eeb6e632d2($fileIdentifier, $file)
+{
+    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
+        require $file;
+
+        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+    }
+}

+ 28 - 17
vendor/composer/autoload_static.php

@@ -8,36 +8,36 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
 {
     public static $files = array (
         'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
-        '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
         '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
+        'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
+        '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
         'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
-        '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
-        '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
         '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
         'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
         '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
-        '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
-        'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
-        '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
+        '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
+        'c72349b1fe8d0deeedd3a52e8aa814d8' => __DIR__ . '/..' . '/mockery/mockery/library/helpers.php',
+        'ce9671a430e4846b44e1c68c7611f9f5' => __DIR__ . '/..' . '/mockery/mockery/library/Mockery.php',
+        '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
         '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
-        'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
         'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
-        '9cdd7b9056abc3081735233ba9dd9c7f' => __DIR__ . '/..' . '/facade/flare-client-php/src/helpers.php',
-        '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+        'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
+        '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
+        '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
+        '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
         '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php',
-        '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
         'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php',
-        '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
-        'ed962a97bd972bc82007176b647d4e36' => __DIR__ . '/..' . '/facade/ignition/src/helpers.php',
-        '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
         '265b4faa2b3a9766332744949e83bf97' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Collections/helpers.php',
         'c7a3c339e7e14b60e06a2d7fcce9476b' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Events/functions.php',
         'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
         '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
+        '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
+        '9cdd7b9056abc3081735233ba9dd9c7f' => __DIR__ . '/..' . '/facade/flare-client-php/src/helpers.php',
+        '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+        '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
+        'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
+        'ed962a97bd972bc82007176b647d4e36' => __DIR__ . '/..' . '/facade/ignition/src/helpers.php',
         '0f5bcb416d34db1c9ad4167f1809a53c' => __DIR__ . '/..' . '/maniac/easemob-php/src/functions.php',
-        'c72349b1fe8d0deeedd3a52e8aa814d8' => __DIR__ . '/..' . '/mockery/mockery/library/helpers.php',
-        'ce9671a430e4846b44e1c68c7611f9f5' => __DIR__ . '/..' . '/mockery/mockery/library/Mockery.php',
-        'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
     );
 
     public static $prefixLengthsPsr4 = array (
@@ -141,6 +141,7 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
             'GuzzleHttp\\Promise\\' => 19,
             'GuzzleHttp\\' => 11,
             'GrahamCampbell\\ResultType\\' => 26,
+            'GatewayClient\\' => 14,
         ),
         'F' => 
         array (
@@ -434,6 +435,10 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
         array (
             0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
         ),
+        'GatewayClient\\' => 
+        array (
+            0 => __DIR__ . '/..' . '/workerman/gatewayclient',
+        ),
         'Fruitcake\\Cors\\' => 
         array (
             0 => __DIR__ . '/..' . '/fruitcake/laravel-cors/src',
@@ -521,6 +526,8 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
     );
 
     public static $classMap = array (
+        'App\\Common\\Library\\Easemob' => __DIR__ . '/../..' . '/app/Common/Library/Easemob.php',
+        'App\\Console\\Commands\\Plantask' => __DIR__ . '/../..' . '/app/Console/Commands/Plantask.php',
         'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
         'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
         'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php',
@@ -533,6 +540,8 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
         'App\\Http\\Middleware\\TrustHosts' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustHosts.php',
         'App\\Http\\Middleware\\TrustProxies' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustProxies.php',
         'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
+        'App\\Jobs\\GiftJob' => __DIR__ . '/../..' . '/app/Jobs/GiftJob.php',
+        'App\\Jobs\\GrabgiftJob' => __DIR__ . '/../..' . '/app/Jobs/GrabgiftJob.php',
         'App\\Models\\User' => __DIR__ . '/../..' . '/app/Models/User.php',
         'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
         'App\\Providers\\AuthServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AuthServiceProvider.php',
@@ -1387,7 +1396,6 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
         'Faker\\Provider\\nl_BE\\Payment' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_BE/Payment.php',
         'Faker\\Provider\\nl_BE\\Person' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_BE/Person.php',
         'Faker\\Provider\\nl_BE\\PhoneNumber' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_BE/PhoneNumber.php',
-        'Faker\\Provider\\nl_BE\\Text' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_BE/Text.php',
         'Faker\\Provider\\nl_NL\\Address' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_NL/Address.php',
         'Faker\\Provider\\nl_NL\\Color' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_NL/Color.php',
         'Faker\\Provider\\nl_NL\\Company' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/Provider/nl_NL/Company.php',
@@ -1512,6 +1520,9 @@ class ComposerStaticInited4271df5cac54f00267a6eeb6e632d2
         'Faker\\ValidGenerator' => __DIR__ . '/..' . '/fakerphp/faker/src/Faker/ValidGenerator.php',
         'Fruitcake\\Cors\\CorsServiceProvider' => __DIR__ . '/..' . '/fruitcake/laravel-cors/src/CorsServiceProvider.php',
         'Fruitcake\\Cors\\HandleCors' => __DIR__ . '/..' . '/fruitcake/laravel-cors/src/HandleCors.php',
+        'GatewayClient\\Context' => __DIR__ . '/..' . '/workerman/gatewayclient/Context.php',
+        'GatewayClient\\Gateway' => __DIR__ . '/..' . '/workerman/gatewayclient/Gateway.php',
+        'GatewayClient\\GatewayProtocol' => __DIR__ . '/..' . '/workerman/gatewayclient/GatewayProtocol.php',
         'GrahamCampbell\\ResultType\\Error' => __DIR__ . '/..' . '/graham-campbell/result-type/src/Error.php',
         'GrahamCampbell\\ResultType\\Result' => __DIR__ . '/..' . '/graham-campbell/result-type/src/Result.php',
         'GrahamCampbell\\ResultType\\Success' => __DIR__ . '/..' . '/graham-campbell/result-type/src/Success.php',

+ 40 - 0
vendor/composer/installed.json

@@ -8865,6 +8865,46 @@
                 "source": "https://github.com/webmozarts/assert/tree/1.11.0"
             },
             "install-path": "../webmozart/assert"
+        },
+        {
+            "name": "workerman/gatewayclient",
+            "version": "v3.0.17",
+            "version_normalized": "3.0.17.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/walkor/GatewayClient.git",
+                "reference": "0f67651ce92628d5e85d2ae45478f12b0d1e9f66"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/walkor/GatewayClient/zipball/0f67651ce92628d5e85d2ae45478f12b0d1e9f66",
+                "reference": "0f67651ce92628d5e85d2ae45478f12b0d1e9f66",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "time": "2023-11-09T13:48:46+00:00",
+            "type": "library",
+            "installation-source": "dist",
+            "autoload": {
+                "psr-4": {
+                    "GatewayClient\\": "./"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "homepage": "http://www.workerman.net",
+            "support": {
+                "issues": "https://github.com/walkor/GatewayClient/issues",
+                "source": "https://github.com/walkor/GatewayClient/tree/v3.0.17"
+            },
+            "install-path": "../workerman/gatewayclient"
         }
     ],
     "dev": true,

File diff suppressed because it is too large
+ 110 - 110
vendor/composer/installed.php


+ 3 - 0
vendor/workerman/gatewayclient/.gitignore

@@ -0,0 +1,3 @@
+/vendor
+/.vscode
+/.idea

+ 115 - 0
vendor/workerman/gatewayclient/Context.php

@@ -0,0 +1,115 @@
+<?php
+namespace GatewayClient;
+
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
+/**
+ * 上下文 包含当前用户uid, 内部通信local_ip local_port socket_id ,以及客户端client_ip client_port
+ */
+class Context
+{
+    /**
+     * 内部通讯id
+     * @var string
+     */
+    public static $local_ip;
+    /**
+     * 内部通讯端口
+     * @var int
+     */
+    public static $local_port;
+    /**
+     * 客户端ip
+     * @var string
+     */
+    public static $client_ip;
+    /**
+     * 客户端端口
+     * @var int
+     */
+    public static $client_port;
+    /**
+     * client_id
+     * @var string
+     */
+    public static $client_id;
+    /**
+     * 连接connection->id
+     * @var int
+     */
+    public static $connection_id;
+
+    /**
+     * 旧的session
+     *
+     * @var string
+     */
+    public static $old_session;
+
+    /**
+     * 编码session
+     * @param mixed $session_data
+     * @return string
+     */
+    public static function sessionEncode($session_data = '')
+    {
+        if ($session_data !== '') {
+            return serialize($session_data);
+        }
+
+        return '';
+    }
+
+    /**
+     * 解码session
+     * @param string $session_buffer
+     * @return mixed
+     */
+    public static function sessionDecode($session_buffer)
+    {
+        return unserialize($session_buffer);
+    }
+
+    /**
+     * 清除上下文
+     * @return void
+     */
+    public static function clear()
+    {
+        static::$local_ip = static::$local_port = static::$client_ip = static::$client_port =
+        static::$client_id = static::$connection_id  = static::$old_session = null;
+    }
+
+    /**
+     * 通讯地址到client_id的转换
+     * @return string
+     */
+    public static function addressToClientId($local_ip, $local_port, $connection_id)
+    {
+        return bin2hex(pack('NnN', $local_ip, $local_port, $connection_id));
+    }
+
+    /**
+     * client_id到通讯地址的转换
+     * @return array
+     */
+    public static function clientIdToAddress($client_id)
+    {
+        if (strlen($client_id) !== 20) {
+            throw new \Exception("client_id $client_id is invalid");
+        }
+        return unpack('Nlocal_ip/nlocal_port/Nconnection_id' ,pack('H*', $client_id));
+    }
+
+}

+ 1381 - 0
vendor/workerman/gatewayclient/Gateway.php

@@ -0,0 +1,1381 @@
+<?php
+namespace GatewayClient;
+use \Exception;
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
+if (! class_exists(\Composer\Autoload\ClassLoader::class)) {
+    require_once __DIR__ . '/Context.php';
+    require_once __DIR__ . '/GatewayProtocol.php';
+}
+
+/**
+ * 数据发送相关
+ */
+class Gateway
+{
+    /**
+     * gateway 实例
+     *
+     * @var object
+     */
+    protected static $businessWorker = null;
+
+    /**
+     * 注册中心地址
+     *
+     * @var string|array
+     */
+    public static $registerAddress = '127.0.0.1:1236';
+
+    /**
+     * 秘钥
+     * @var string
+     */
+    public static $secretKey = '';
+
+    /**
+     * 链接超时时间
+     * @var int
+     */
+    public static $connectTimeout = 3;
+
+    /**
+     * 与Gateway是否是长链接
+     * @var bool
+     */
+    public static $persistentConnection = false;
+
+    /**
+     * 是否清除注册地址缓存
+     * @var bool
+     */
+    public static $addressesCacheDisable = false;
+    
+    /**
+     * 向所有客户端连接(或者 client_id_array 指定的客户端连接)广播消息
+     *
+     * @param string $message           向客户端发送的消息
+     * @param array  $client_id_array   客户端 id 数组
+     * @param array  $exclude_client_id 不给这些client_id发
+     * @param bool   $raw               是否发送原始数据(即不调用gateway的协议的encode方法)
+     * @return void
+     * @throws Exception
+     */
+    public static function sendToAll($message, $client_id_array = null, $exclude_client_id = null, $raw = false)
+    {
+        $gateway_data         = GatewayProtocol::$empty;
+        $gateway_data['cmd']  = GatewayProtocol::CMD_SEND_TO_ALL;
+        $gateway_data['body'] = $message;
+        if ($raw) {
+            $gateway_data['flag'] |= GatewayProtocol::FLAG_NOT_CALL_ENCODE;
+        }
+
+        if ($exclude_client_id) {
+            if (!is_array($exclude_client_id)) {
+                $exclude_client_id = array($exclude_client_id);
+            }
+            if ($client_id_array) {
+                $exclude_client_id = array_flip($exclude_client_id);
+            }
+        }
+
+        if ($client_id_array) {
+            if (!is_array($client_id_array)) {
+                echo new \Exception('bad $client_id_array:'.var_export($client_id_array, true));
+                return;
+            }
+            $data_array = array();
+            foreach ($client_id_array as $client_id) {
+                if (isset($exclude_client_id[$client_id])) {
+                    continue;
+                }
+                $address = Context::clientIdToAddress($client_id);
+                if ($address) {
+                    $key                                         = long2ip($address['local_ip']) . ":{$address['local_port']}";
+                    $data_array[$key][$address['connection_id']] = $address['connection_id'];
+                }
+            }
+            foreach ($data_array as $addr => $connection_id_list) {
+                $the_gateway_data             = $gateway_data;
+                $the_gateway_data['ext_data'] = json_encode(array('connections' => $connection_id_list));
+                static::sendToGateway($addr, $the_gateway_data);
+            }
+            return;
+        } elseif (empty($client_id_array) && is_array($client_id_array)) {
+            return;
+        }
+
+        if (!$exclude_client_id) {
+            return static::sendToAllGateway($gateway_data);
+        }
+
+        $address_connection_array = static::clientIdArrayToAddressArray($exclude_client_id);
+
+        // 如果有businessWorker实例,说明运行在workerman环境中,通过businessWorker中的长连接发送数据
+        if (static::$businessWorker) {
+            foreach (static::$businessWorker->gatewayConnections as $address => $gateway_connection) {
+                $gateway_data['ext_data'] = isset($address_connection_array[$address]) ?
+                    json_encode(array('exclude'=> $address_connection_array[$address])) : '';
+                /** @var TcpConnection $gateway_connection */
+                $gateway_connection->send($gateway_data);
+            }
+        } // 运行在其它环境中,通过注册中心得到gateway地址
+        else {
+            $all_addresses = static::getAllGatewayAddressesFromRegister();
+            foreach ($all_addresses as $address) {
+                $gateway_data['ext_data'] = isset($address_connection_array[$address]) ?
+                    json_encode(array('exclude'=> $address_connection_array[$address])) : '';
+                static::sendToGateway($address, $gateway_data);
+            }
+        }
+
+    }
+
+    /**
+     * 向某个client_id对应的连接发消息
+     *
+     * @param string    $client_id
+     * @param string $message
+     * @return void
+     */
+    public static function sendToClient($client_id, $message)
+    {
+        return static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_SEND_TO_ONE, $message);
+    }
+
+    /**
+     * 判断某个uid是否在线
+     *
+     * @param string $uid
+     * @return int 0|1
+     */
+    public static function isUidOnline($uid)
+    {
+        return (int)static::getClientIdByUid($uid);
+    }
+
+    public static function isUidsOnline($uids)
+    {
+        return array_map(function ($item) {
+            return (int) $item;
+        }, static::batchGetClientIdByUid($uids));
+    }
+    
+    /**
+     * 判断client_id对应的连接是否在线
+     *
+     * @param string $client_id
+     * @return int 0|1
+     */
+    public static function isOnline($client_id)
+    {
+        $address_data = Context::clientIdToAddress($client_id);
+        if (!$address_data) {
+            return 0;
+        }
+        $address      = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+        if (isset(static::$businessWorker)) {
+            if (!isset(static::$businessWorker->gatewayConnections[$address])) {
+                return 0;
+            }
+        }
+        $gateway_data                  = GatewayProtocol::$empty;
+        $gateway_data['cmd']           = GatewayProtocol::CMD_IS_ONLINE;
+        $gateway_data['connection_id'] = $address_data['connection_id'];
+        return (int)static::sendAndRecv($address, $gateway_data);
+    }
+
+    /**
+     * 获取所有在线用户的session,client_id为 key(弃用,请用getAllClientSessions代替)
+     *
+     * @param string $group
+     * @return array
+     */
+    public static function getAllClientInfo($group = '')
+    {
+        echo "Warning: Gateway::getAllClientInfo is deprecated and will be removed in a future, please use Gateway::getAllClientSessions instead.";
+        return static::getAllClientSessions($group);
+    }
+
+    /**
+     * 获取所有在线client_id的session,client_id为 key
+     *
+     * @param string $group
+     * @return array
+     */
+    public static function getAllClientSessions($group = '')
+    {
+        $gateway_data = GatewayProtocol::$empty;
+        if (!$group) {
+            $gateway_data['cmd']      = GatewayProtocol::CMD_GET_ALL_CLIENT_SESSIONS;
+        } else {
+            $gateway_data['cmd']      = GatewayProtocol::CMD_GET_CLIENT_SESSIONS_BY_GROUP;
+            $gateway_data['ext_data'] = $group;
+        }
+        $status_data      = array();
+        $all_buffer_array = static::getBufferFromAllGateway($gateway_data);
+        foreach ($all_buffer_array as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $data) {
+                if ($data) {
+                    foreach ($data as $connection_id => $session_buffer) {
+                        $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                        if ($client_id === Context::$client_id) {
+                            $status_data[$client_id] = (array)$_SESSION;
+                        } else {
+                            $status_data[$client_id] = $session_buffer ? Context::sessionDecode($session_buffer) : array();
+                        }
+                    }
+                }
+            }
+        }
+        return $status_data;
+    }
+
+    /**
+     * 获取某个组的连接信息(弃用,请用getClientSessionsByGroup代替)
+     *
+     * @param string $group
+     * @return array
+     */
+    public static function getClientInfoByGroup($group)
+    {
+        echo "Warning: Gateway::getClientInfoByGroup is deprecated and will be removed in a future, please use Gateway::getClientSessionsByGroup instead.";
+        return static::getAllClientSessions($group);
+    }
+
+    /**
+     * 获取某个组的所有client_id的session信息
+     *
+     * @param string $group
+     *
+     * @return array
+     */
+    public static function getClientSessionsByGroup($group)
+    {
+        if (static::isValidGroupId($group)) {
+            return static::getAllClientSessions($group);
+        }
+        return array();
+    }
+
+    /**
+     * 获取所有在线client_id数
+     *
+     * @return int
+     */
+    public static function getAllClientIdCount()
+    {
+        return static::getClientCountByGroup();
+    }
+
+    /**
+     * 获取所有在线client_id数(getAllClientIdCount的别名)
+     *
+     * @return int
+     */
+    public static function getAllClientCount()
+    {
+        return static::getAllClientIdCount();
+    }
+
+    /**
+     * 获取某个组的在线client_id数
+     *
+     * @param string $group
+     * @return int
+     */
+    public static function getClientIdCountByGroup($group = '')
+    {
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_GET_CLIENT_COUNT_BY_GROUP;
+        $gateway_data['ext_data'] = $group;
+        $total_count              = 0;
+        $all_buffer_array         = static::getBufferFromAllGateway($gateway_data);
+        foreach ($all_buffer_array as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $count) {
+                if ($count) {
+                    $total_count += $count;
+                }
+            }
+        }
+        return $total_count;
+    }
+
+    /**
+     * getClientIdCountByGroup 函数的别名
+     *
+     * @param string $group
+     * @return int
+     */
+    public static function getClientCountByGroup($group = '')
+    {
+        return static::getClientIdCountByGroup($group);
+    }
+
+    /**
+     * 获取某个群组在线client_id列表
+     *
+     * @param string $group
+     * @return array
+     */
+    public static function getClientIdListByGroup($group)
+    {
+        if (!static::isValidGroupId($group)) {
+            return array();
+        }
+
+        $data = static::select(array('uid'), array('groups' => is_array($group) ? $group : array($group)));
+        $client_id_map = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                    $client_id_map[$client_id] = $client_id;
+                }
+            }
+        }
+        return $client_id_map;
+    }
+
+    /**
+     * 获取集群所有在线client_id列表
+     *
+     * @return array
+     */
+    public static function getAllClientIdList()
+    {
+        return static::formatClientIdFromGatewayBuffer(static::select(array('uid')));
+    }
+
+    /**
+     * 格式化client_id
+     *
+     * @param $data
+     * @return array
+     */
+    protected static function formatClientIdFromGatewayBuffer($data)
+    {
+        $client_id_list = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                    $client_id_list[$client_id] = $client_id;
+                }
+            }
+        }
+        return $client_id_list;
+    }
+
+
+    /**
+     * 获取与 uid 绑定的 client_id 列表
+     *
+     * @param string $uid
+     * @return array
+     */
+    public static function getClientIdByUid($uid)
+    {
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_GET_CLIENT_ID_BY_UID;
+        $gateway_data['ext_data'] = $uid;
+        $client_list              = array();
+        $all_buffer_array         = static::getBufferFromAllGateway($gateway_data);
+        foreach ($all_buffer_array as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $connection_id_array) {
+                if ($connection_id_array) {
+                    foreach ($connection_id_array as $connection_id) {
+                        $client_list[] = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                    }
+                }
+            }
+        }
+        return $client_list;
+    }
+
+    /**
+     * 批量获取与 uid 绑定的 client_id 列表
+     *
+     * @param array $uids
+     * @return array
+     */
+    public static function batchGetClientIdByUid($uids)
+    {
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_BATCH_GET_CLIENT_ID_BY_UID;
+        $gateway_data['ext_data'] = json_encode($uids);
+        $client_list              = [];
+        $all_buffer_array         = static::getBufferFromAllGateway($gateway_data);
+        foreach ($all_buffer_array as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $uid_connection_id_array) {
+                if ($uid_connection_id_array) {
+                    foreach ($uid_connection_id_array as $uid => $connection_ids) {
+                        if (! isset($client_list[$uid])) {
+                            $client_list[$uid] = [];
+                        }
+                        foreach ($connection_ids as $connection_id) {
+                            $client_list[$uid][] = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                        }
+                    }
+                }
+            }
+        }
+        return $client_list;
+    }
+
+    /**
+     * 获取某个群组在线uid列表
+     *
+     * @param string $group
+     * @return array
+     */
+    public static function getUidListByGroup($group)
+    {
+        if (!static::isValidGroupId($group)) {
+            return array();
+        }
+
+        $group = is_array($group) ? $group : array($group);
+        $data = static::select(array('uid'), array('groups' => $group));
+        $uid_map = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    if (!empty($info['uid'])) {
+                        $uid_map[$info['uid']] = $info['uid'];
+                    }
+                }
+            }
+        }
+        return $uid_map;
+    }
+
+    /**
+     * 获取某个群组在线uid数
+     *
+     * @param string $group
+     * @return int
+     */
+    public static function getUidCountByGroup($group)
+    {
+        if (static::isValidGroupId($group)) {
+            return count(static::getUidListByGroup($group));
+        }
+        return 0;
+    }
+
+    /**
+     * 获取全局在线uid列表
+     *
+     * @return array
+     */
+    public static function getAllUidList()
+    {
+        $data = static::select(array('uid'));
+        $uid_map = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    if (!empty($info['uid'])) {
+                        $uid_map[$info['uid']] = $info['uid'];
+                    }
+                }
+            }
+        }
+        return $uid_map;
+    }
+
+    /**
+     * 获取全局在线uid数
+     * @return int
+     */
+    public static function getAllUidCount()
+    {
+        return count(static::getAllUidList());
+    }
+
+    /**
+     * 通过client_id获取uid
+     *
+     * @param $client_id
+     * @return mixed
+     */
+    public static function getUidByClientId($client_id)
+    {
+        $data = static::select(array('uid'), array('client_id'=>array($client_id)));
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $info) {
+                    return $info['uid'];
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取所有在线的群组id
+     *
+     * @return array
+     */
+    public static function getAllGroupIdList()
+    {
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_GET_GROUP_ID_LIST;
+        $group_id_list            = array();
+        $all_buffer_array         = static::getBufferFromAllGateway($gateway_data);
+        foreach ($all_buffer_array as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $group_id_array) {
+                if (is_array($group_id_array)) {
+                    foreach ($group_id_array as $group_id) {
+                        if (!isset($group_id_list[$group_id])) {
+                            $group_id_list[$group_id] = $group_id;
+                        }
+                    }
+                }
+            }
+        }
+        return $group_id_list;
+    }
+
+
+    /**
+     * 获取所有在线分组的uid数量,也就是每个分组的在线用户数
+     *
+     * @return array
+     */
+    public static function getAllGroupUidCount()
+    {
+        $group_uid_map = static::getAllGroupUidList();
+        $group_uid_count_map = array();
+        foreach ($group_uid_map as $group_id => $uid_list) {
+            $group_uid_count_map[$group_id] = count($uid_list);
+        }
+        return $group_uid_count_map;
+    }
+
+
+
+    /**
+     * 获取所有分组uid在线列表
+     *
+     * @return array
+     */
+    public static function getAllGroupUidList()
+    {
+        $data = static::select(array('uid','groups'));
+        $group_uid_map = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    if (empty($info['uid']) || empty($info['groups'])) {
+                        break;
+                    }
+                    $uid = $info['uid'];
+                    foreach ($info['groups'] as $group_id) {
+                        if(!isset($group_uid_map[$group_id])) {
+                            $group_uid_map[$group_id] = array();
+                        }
+                        $group_uid_map[$group_id][$uid] = $uid;
+                    }
+                }
+            }
+        }
+        return $group_uid_map;
+    }
+
+    /**
+     * 获取所有群组在线client_id列表
+     *
+     * @return array
+     */
+    public static function getAllGroupClientIdList()
+    {
+        $data = static::select(array('groups'));
+        $group_client_id_map = array();
+        foreach ($data as $local_ip => $buffer_array) {
+            foreach ($buffer_array as $local_port => $items) {
+                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
+                foreach ($items as $connection_id => $info) {
+                    if (empty($info['groups'])) {
+                        break;
+                    }
+                    $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
+                    foreach ($info['groups'] as $group_id) {
+                        if(!isset($group_client_id_map[$group_id])) {
+                            $group_client_id_map[$group_id] = array();
+                        }
+                        $group_client_id_map[$group_id][$client_id] = $client_id;
+                    }
+                }
+            }
+        }
+        return $group_client_id_map;
+    }
+
+    /**
+     * 获取所有群组在线client_id数量,也就是获取每个群组在线连接数
+     *
+     * @return array
+     */
+    public static function getAllGroupClientIdCount()
+    {
+        $group_client_map = static::getAllGroupClientIdList();
+        $group_client_count_map = array();
+        foreach ($group_client_map as $group_id => $client_id_list) {
+            $group_client_count_map[$group_id] = count($client_id_list);
+        }
+        return $group_client_count_map;
+    }
+
+
+    /**
+     * 根据条件到gateway搜索数据
+     *
+     * @param array $fields
+     * @param array $where
+     * @return array
+     */
+    protected static function select($fields = array('session','uid','groups'), $where = array())
+    {
+        $t = microtime(true);
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_SELECT;
+        $gateway_data['ext_data'] = array('fields' => $fields, 'where' => $where);
+        $gateway_data_list   = array();
+        // 有client_id,能计算出需要和哪些gateway通讯,只和必要的gateway通讯能降低系统负载
+        if (isset($where['client_id'])) {
+            $client_id_list = $where['client_id'];
+            unset($gateway_data['ext_data']['where']['client_id']);
+            $gateway_data['ext_data']['where']['connection_id'] = array();
+            foreach ($client_id_list as $client_id) {
+                $address_data = Context::clientIdToAddress($client_id);
+                if (!$address_data) {
+                    continue;
+                }
+                $address = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+                if (!isset($gateway_data_list[$address])) {
+                    $gateway_data_list[$address] = $gateway_data;
+                }
+                $gateway_data_list[$address]['ext_data']['where']['connection_id'][$address_data['connection_id']] = $address_data['connection_id'];
+            }
+            foreach ($gateway_data_list as $address => $item) {
+                $gateway_data_list[$address]['ext_data'] = json_encode($item['ext_data']);
+            }
+            // 有其它条件,则还是需要向所有gateway发送
+            if (count($where) !== 1) {
+                $gateway_data['ext_data'] = json_encode($gateway_data['ext_data']);
+                foreach (static::getAllGatewayAddress() as $address) {
+                    if (!isset($gateway_data_list[$address])) {
+                        $gateway_data_list[$address] = $gateway_data;
+                    }
+                }
+            }
+            $data = static::getBufferFromSomeGateway($gateway_data_list);
+        } else {
+            $gateway_data['ext_data'] = json_encode($gateway_data['ext_data']);
+            $data = static::getBufferFromAllGateway($gateway_data);
+        }
+
+        return $data;
+    }
+
+    /**
+     * 生成验证包,用于验证此客户端的合法性
+     * 
+     * @return string
+     */
+    protected static function generateAuthBuffer()
+    {
+        $gateway_data         = GatewayProtocol::$empty;
+        $gateway_data['cmd']  = GatewayProtocol::CMD_GATEWAY_CLIENT_CONNECT;
+        $gateway_data['body'] = json_encode(array(
+            'secret_key' => static::$secretKey,
+        ));
+        return GatewayProtocol::encode($gateway_data);
+    }
+
+    /**
+     * 批量向某些gateway发包,并得到返回数组
+     *
+     * @param array $gateway_data_array
+     * @return array
+     * @throws Exception
+     */
+    protected static function getBufferFromSomeGateway($gateway_data_array)
+    {
+        $gateway_buffer_array = array();
+        $auth_buffer = static::$secretKey ? static::generateAuthBuffer() : '';
+        foreach ($gateway_data_array as $address => $gateway_data) {
+            if ($auth_buffer) {
+                $gateway_buffer_array[$address] = $auth_buffer.GatewayProtocol::encode($gateway_data);
+            } else {
+                $gateway_buffer_array[$address] = GatewayProtocol::encode($gateway_data);
+            }
+        }
+        return static::getBufferFromGateway($gateway_buffer_array);
+    }
+
+    /**
+     * 批量向所有 gateway 发包,并得到返回数组
+     *
+     * @param string|array $gateway_data
+     * @return array
+     * @throws Exception
+     */
+    protected static function getBufferFromAllGateway($gateway_data)
+    {
+        $addresses = static::getAllGatewayAddress();
+        $gateway_buffer_array = array();
+        $gateway_buffer = GatewayProtocol::encode($gateway_data);
+        $gateway_buffer = static::$secretKey ? static::generateAuthBuffer() . $gateway_buffer : $gateway_buffer;
+        foreach ($addresses as $address) {
+            $gateway_buffer_array[$address] = $gateway_buffer;
+        }
+
+        return static::getBufferFromGateway($gateway_buffer_array);
+    }
+
+    /**
+     * 获取所有gateway内部通讯地址
+     *
+     * @return array
+     * @throws Exception
+     */
+    protected static function getAllGatewayAddress()
+    {
+        if (isset(static::$businessWorker)) {
+            $addresses = static::$businessWorker->getAllGatewayAddresses();
+            if (empty($addresses)) {
+                throw new Exception('businessWorker::getAllGatewayAddresses return empty');
+            }
+        } else {
+            $addresses = static::getAllGatewayAddressesFromRegister();
+            if (empty($addresses)) {
+                return array();
+            }
+        }
+        return $addresses;
+    }
+
+    /**
+     * 批量向gateway发送并获取数据
+     * @param $gateway_buffer_array
+     * @return array
+     */
+    protected static function getBufferFromGateway($gateway_buffer_array)
+    {
+        $client_array = $status_data = $client_address_map = $receive_buffer_array = $recv_length_array = array();
+        // 批量向所有gateway进程发送请求数据
+        foreach ($gateway_buffer_array as $address => $gateway_buffer) {
+            $client = stream_socket_client("tcp://$address", $errno, $errmsg, static::$connectTimeout);
+            if ($client && strlen($gateway_buffer) === stream_socket_sendto($client, $gateway_buffer)) {
+                $socket_id                        = (int)$client;
+                $client_array[$socket_id]         = $client;
+                $client_address_map[$socket_id]   = explode(':', $address);
+                $receive_buffer_array[$socket_id] = '';
+            }
+        }
+        // 超时5秒
+        $timeout    = 5;
+        $time_start = microtime(true);
+        // 批量接收请求
+        while (count($client_array) > 0) {
+            $write = $except = array();
+            $read  = $client_array;
+            if (@stream_select($read, $write, $except, $timeout)) {
+                foreach ($read as $client) {
+                    $socket_id = (int)$client;
+                    $buffer    = stream_socket_recvfrom($client, 65535);
+                    if ($buffer !== '' && $buffer !== false) {
+                        $receive_buffer_array[$socket_id] .= $buffer;
+                        $receive_length = strlen($receive_buffer_array[$socket_id]);
+                        if (empty($recv_length_array[$socket_id]) && $receive_length >= 4) {
+                            $recv_length_array[$socket_id] = current(unpack('N', $receive_buffer_array[$socket_id]));
+                        }
+                        if (!empty($recv_length_array[$socket_id]) && $receive_length >= $recv_length_array[$socket_id] + 4) {
+                            unset($client_array[$socket_id]);
+                        }
+                    } elseif (feof($client)) {
+                        unset($client_array[$socket_id]);
+                    }
+                }
+            }
+            if (microtime(true) - $time_start > $timeout) {
+                break;
+            }
+        }
+        $format_buffer_array = array();
+        foreach ($receive_buffer_array as $socket_id => $buffer) {
+            $local_ip                                    = ip2long($client_address_map[$socket_id][0]);
+            $local_port                                  = $client_address_map[$socket_id][1];
+            $format_buffer_array[$local_ip][$local_port] = unserialize(substr($buffer, 4));
+        }
+        return $format_buffer_array;
+    }
+
+    /**
+     * 踢掉某个客户端,并以$message通知被踢掉客户端
+     *
+     * @param string $client_id
+     * @param string $message
+     * @return void
+     */
+    public static function closeClient($client_id, $message = null)
+    {
+        if ($client_id === Context::$client_id) {
+            return static::closeCurrentClient($message);
+        } // 不是发给当前用户则使用存储中的地址
+        else {
+            $address_data = Context::clientIdToAddress($client_id);
+            if (!$address_data) {
+                return false;
+            }
+            $address      = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+            return static::kickAddress($address, $address_data['connection_id'], $message);
+        }
+    }
+
+    /**
+     * 踢掉某个客户端并直接立即销毁相关连接
+     *
+     * @param string $client_id
+     * @return bool
+     */
+    public static function destoryClient($client_id)
+    {
+        if ($client_id === Context::$client_id) {
+            return static::destoryCurrentClient();
+        } // 不是发给当前用户则使用存储中的地址
+        else {
+            $address_data = Context::clientIdToAddress($client_id);
+            if (!$address_data) {
+                return false;
+            }
+            $address = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+            return static::destroyAddress($address, $address_data['connection_id']);
+        }
+    }
+
+    /**
+     * 踢掉当前客户端并直接立即销毁相关连接
+     *
+     * @return bool
+     * @throws Exception
+     */
+    public static function destoryCurrentClient()
+    {
+        if (!Context::$connection_id) {
+            throw new Exception('destoryCurrentClient can not be called in async context');
+        }
+        $address = long2ip(Context::$local_ip) . ':' . Context::$local_port;
+        return static::destroyAddress($address, Context::$connection_id);
+    }
+
+    /**
+     * 将 client_id 与 uid 绑定
+     *
+     * @param string        $client_id
+     * @param int|string $uid
+     * @return void
+     */
+    public static function bindUid($client_id, $uid)
+    {
+        static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_BIND_UID, '', $uid);
+    }
+
+    /**
+     * 将 client_id 与 uid 解除绑定
+     *
+     * @param string        $client_id
+     * @param int|string $uid
+     * @return void
+     */
+    public static function unbindUid($client_id, $uid)
+    {
+        static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_UNBIND_UID, '', $uid);
+    }
+
+    /**
+     * 将 client_id 加入组
+     *
+     * @param string        $client_id
+     * @param int|string $group
+     * @return void
+     */
+    public static function joinGroup($client_id, $group)
+    {
+
+        static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_JOIN_GROUP, '', $group);
+    }
+
+    /**
+     * 将 client_id 离开组
+     *
+     * @param string        $client_id
+     * @param int|string $group
+     *
+     * @return void
+     */
+    public static function leaveGroup($client_id, $group)
+    {
+        static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_LEAVE_GROUP, '', $group);
+    }
+
+    /**
+     * 取消分组
+     *
+     * @param int|string $group
+     *
+     * @return void
+     */
+    public static function ungroup($group)
+    {
+        if (!static::isValidGroupId($group)) {
+            return false;
+        }
+        $gateway_data             = GatewayProtocol::$empty;
+        $gateway_data['cmd']      = GatewayProtocol::CMD_UNGROUP;
+        $gateway_data['ext_data'] = $group;
+        return static::sendToAllGateway($gateway_data);
+
+    }
+
+    /**
+     * 向所有 uid 发送
+     *
+     * @param int|string|array $uid
+     * @param string           $message
+     *
+     * @return void
+     */
+    public static function sendToUid($uid, $message)
+    {
+        $gateway_data         = GatewayProtocol::$empty;
+        $gateway_data['cmd']  = GatewayProtocol::CMD_SEND_TO_UID;
+        $gateway_data['body'] = $message;
+
+        if (!is_array($uid)) {
+            $uid = array($uid);
+        }
+
+        $gateway_data['ext_data'] = json_encode($uid);
+
+        static::sendToAllGateway($gateway_data);
+    }
+
+    /**
+     * 向 group 发送
+     *
+     * @param int|string|array $group             组(不允许是 0 '0' false null array()等为空的值)
+     * @param string           $message           消息
+     * @param array            $exclude_client_id 不给这些client_id发
+     * @param bool             $raw               发送原始数据(即不调用gateway的协议的encode方法)
+     *
+     * @return void
+     */
+    public static function sendToGroup($group, $message, $exclude_client_id = null, $raw = false)
+    {
+        if (!static::isValidGroupId($group)) {
+            return false;
+        }
+        $gateway_data         = GatewayProtocol::$empty;
+        $gateway_data['cmd']  = GatewayProtocol::CMD_SEND_TO_GROUP;
+        $gateway_data['body'] = $message;
+        if ($raw) {
+            $gateway_data['flag'] |= GatewayProtocol::FLAG_NOT_CALL_ENCODE;
+        }
+
+        if (!is_array($group)) {
+            $group = array($group);
+        }
+
+        // 分组发送,没有排除的client_id,直接发送
+        $default_ext_data_buffer = json_encode(array('group'=> $group, 'exclude'=> null));
+        if (empty($exclude_client_id)) {
+            $gateway_data['ext_data'] = $default_ext_data_buffer;
+            return static::sendToAllGateway($gateway_data);
+        }
+
+        // 分组发送,有排除的client_id,需要将client_id转换成对应gateway进程内的connectionId
+        if (!is_array($exclude_client_id)) {
+            $exclude_client_id = array($exclude_client_id);
+        }
+
+        $address_connection_array = static::clientIdArrayToAddressArray($exclude_client_id);
+        // 如果有businessWorker实例,说明运行在workerman环境中,通过businessWorker中的长连接发送数据
+        if (static::$businessWorker) {
+            foreach (static::$businessWorker->gatewayConnections as $address => $gateway_connection) {
+                $gateway_data['ext_data'] = isset($address_connection_array[$address]) ?
+                    json_encode(array('group'=> $group, 'exclude'=> $address_connection_array[$address])) :
+                    $default_ext_data_buffer;
+                /** @var TcpConnection $gateway_connection */
+                $gateway_connection->send($gateway_data);
+            }
+        } // 运行在其它环境中,通过注册中心得到gateway地址
+        else {
+            $addresses = static::getAllGatewayAddressesFromRegister();
+            foreach ($addresses as $address) {
+                $gateway_data['ext_data'] = isset($address_connection_array[$address]) ?
+                    json_encode(array('group'=> $group, 'exclude'=> $address_connection_array[$address])) :
+                    $default_ext_data_buffer;
+                static::sendToGateway($address, $gateway_data);
+            }
+        }
+    }
+
+    /**
+     * 更新 session,框架自动调用,开发者不要调用
+     *
+     * @param string    $client_id
+     * @param string $session_str
+     * @return bool
+     */
+    public static function setSocketSession($client_id, $session_str)
+    {
+        return static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_SET_SESSION, '', $session_str);
+    }
+
+    /**
+     * 设置 session,原session值会被覆盖
+     *
+     * @param string   $client_id
+     * @param array $session
+     *
+     * @return void
+     */
+    public static function setSession($client_id, array $session)
+    {
+        if (Context::$client_id === $client_id) {
+            $_SESSION = $session;
+            Context::$old_session = $_SESSION;
+        }
+        static::setSocketSession($client_id, Context::sessionEncode($session));
+    }
+    
+    /**
+     * 更新 session,实际上是与老的session合并
+     *
+     * @param string   $client_id
+     * @param array $session
+     *
+     * @return void
+     */
+    public static function updateSession($client_id, array $session)
+    {
+        if (Context::$client_id === $client_id) {
+            $_SESSION = array_replace_recursive((array)$_SESSION, $session);
+            Context::$old_session = $_SESSION;
+        }
+        static::sendCmdAndMessageToClient($client_id, GatewayProtocol::CMD_UPDATE_SESSION, '', Context::sessionEncode($session));
+    }
+    
+    /**
+     * 获取某个client_id的session
+     *
+     * @param string   $client_id
+     * @return mixed false表示出错、null表示用户不存在、array表示具体的session信息 
+     */
+    public static function getSession($client_id)
+    {
+        $address_data = Context::clientIdToAddress($client_id);
+        if (!$address_data) {
+            return false;
+        }
+        $address      = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+        if (isset(static::$businessWorker)) {
+            if (!isset(static::$businessWorker->gatewayConnections[$address])) {
+                return null;
+            }
+        }
+        $gateway_data                  = GatewayProtocol::$empty;
+        $gateway_data['cmd']           = GatewayProtocol::CMD_GET_SESSION_BY_CLIENT_ID;
+        $gateway_data['connection_id'] = $address_data['connection_id'];
+        return static::sendAndRecv($address, $gateway_data);
+    }
+
+    /**
+     * 向某个用户网关发送命令和消息
+     *
+     * @param string    $client_id
+     * @param int    $cmd
+     * @param string $message
+     * @param string $ext_data
+     * @return boolean
+     */
+    protected static function sendCmdAndMessageToClient($client_id, $cmd, $message, $ext_data = '')
+    {
+        // 如果是发给当前用户则直接获取上下文中的地址
+        if ($client_id === Context::$client_id || $client_id === null) {
+            $address       = long2ip(Context::$local_ip) . ':' . Context::$local_port;
+            $connection_id = Context::$connection_id;
+        } else {
+            $address_data  = Context::clientIdToAddress($client_id);
+            if (!$address_data) {
+                return false;
+            }
+            $address       = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
+            $connection_id = $address_data['connection_id'];
+        }
+        $gateway_data                  = GatewayProtocol::$empty;
+        $gateway_data['cmd']           = $cmd;
+        $gateway_data['connection_id'] = $connection_id;
+        $gateway_data['body']          = $message;
+        if (!empty($ext_data)) {
+            $gateway_data['ext_data'] = $ext_data;
+        }
+
+        return static::sendToGateway($address, $gateway_data);
+    }
+
+    /**
+     * 发送数据并返回
+     *
+     * @param int   $address
+     * @param mixed $data
+     * @return bool
+     * @throws Exception
+     */
+    protected static function sendAndRecv($address, $data)
+    {
+        $buffer = GatewayProtocol::encode($data);
+        $buffer = static::$secretKey ? static::generateAuthBuffer() . $buffer : $buffer;
+        $client = stream_socket_client("tcp://$address", $errno, $errmsg, static::$connectTimeout);
+        if (!$client) {
+            throw new Exception("can not connect to tcp://$address $errmsg");
+        }
+        if (strlen($buffer) === stream_socket_sendto($client, $buffer)) {
+            $timeout = 5;
+            // 阻塞读
+            stream_set_blocking($client, 1);
+            // 1秒超时
+            stream_set_timeout($client, 1);
+            $all_buffer = '';
+            $time_start = microtime(true);
+            $pack_len = 0;
+            while (1) {
+                $buf = stream_socket_recvfrom($client, 655350);
+                if ($buf !== '' && $buf !== false) {
+                    $all_buffer .= $buf;
+                } else {
+                    if (feof($client)) {
+                        throw new Exception("connection close tcp://$address");
+                    } elseif (microtime(true) - $time_start > $timeout) {
+                        break;
+                    }
+                    continue;
+                }
+                $recv_len = strlen($all_buffer);
+                if (!$pack_len && $recv_len >= 4) {
+                    $pack_len= current(unpack('N', $all_buffer));
+                }
+                // 回复的数据都是以\n结尾
+                if (($pack_len && $recv_len >= $pack_len + 4) || microtime(true) - $time_start > $timeout) {
+                    break;
+                }
+            }
+            // 返回结果
+            return unserialize(substr($all_buffer, 4));
+        } else {
+            throw new Exception("sendAndRecv($address, \$bufer) fail ! Can not send data!", 502);
+        }
+    }
+
+    /**
+     * 发送数据到网关
+     *
+     * @param string $address
+     * @param array  $gateway_data
+     * @return bool
+     */
+    protected static function sendToGateway($address, $gateway_data)
+    {
+        return static::sendBufferToGateway($address, GatewayProtocol::encode($gateway_data));
+    }
+
+    /**
+     * 发送buffer数据到网关
+     * @param string $address
+     * @param string $gateway_buffer
+     * @return bool
+     */
+    protected static function sendBufferToGateway($address, $gateway_buffer)
+    {
+        // 有$businessWorker说明是workerman环境,使用$businessWorker发送数据
+        if (static::$businessWorker) {
+            if (!isset(static::$businessWorker->gatewayConnections[$address])) {
+                return false;
+            }
+            return static::$businessWorker->gatewayConnections[$address]->send($gateway_buffer, true);
+        }
+        // 非workerman环境
+        $gateway_buffer = static::$secretKey ? static::generateAuthBuffer() . $gateway_buffer : $gateway_buffer;
+        $flag           = static::$persistentConnection ? STREAM_CLIENT_PERSISTENT | STREAM_CLIENT_CONNECT : STREAM_CLIENT_CONNECT;
+        $client         = stream_socket_client("tcp://$address", $errno, $errmsg, static::$connectTimeout, $flag);
+        return strlen($gateway_buffer) == stream_socket_sendto($client, $gateway_buffer);
+    }
+
+    /**
+     * 向所有 gateway 发送数据
+     *
+     * @param string $gateway_data
+     * @throws Exception
+     *
+     * @return void
+     */
+    protected static function sendToAllGateway($gateway_data)
+    {
+        $buffer = GatewayProtocol::encode($gateway_data);
+        // 如果有businessWorker实例,说明运行在workerman环境中,通过businessWorker中的长连接发送数据
+        if (static::$businessWorker) {
+            foreach (static::$businessWorker->gatewayConnections as $gateway_connection) {
+                /** @var TcpConnection $gateway_connection */
+                $gateway_connection->send($buffer, true);
+            }
+        } // 运行在其它环境中,通过注册中心得到gateway地址
+        else {
+            $all_addresses = static::getAllGatewayAddressesFromRegister();
+            foreach ($all_addresses as $address) {
+                static::sendBufferToGateway($address, $buffer);
+            }
+        }
+    }
+
+    /**
+     * 踢掉某个网关的 socket
+     *
+     * @param string $address
+     * @param int    $connection_id
+     * @return bool
+     */
+    protected static function kickAddress($address, $connection_id, $message)
+    {
+        $gateway_data                  = GatewayProtocol::$empty;
+        $gateway_data['cmd']           = GatewayProtocol::CMD_KICK;
+        $gateway_data['connection_id'] = $connection_id;
+        $gateway_data['body'] = $message;
+        return static::sendToGateway($address, $gateway_data);
+    }
+
+    /**
+     * 销毁某个网关的 socket
+     *
+     * @param string $address
+     * @param int    $connection_id
+     * @return bool
+     */
+    protected static function destroyAddress($address, $connection_id)
+    {
+        $gateway_data                  = GatewayProtocol::$empty;
+        $gateway_data['cmd']           = GatewayProtocol::CMD_DESTROY;
+        $gateway_data['connection_id'] = $connection_id;
+        return static::sendToGateway($address, $gateway_data);
+    }
+
+    /**
+     * 将clientid数组转换成address数组
+     *
+     * @param array $client_id_array
+     * @return array
+     */
+    protected static function clientIdArrayToAddressArray(array $client_id_array)
+    {
+        $address_connection_array = array();
+        foreach ($client_id_array as $client_id) {
+            $address_data = Context::clientIdToAddress($client_id);
+            if ($address_data) {
+                $address                                                            = long2ip($address_data['local_ip']) .
+                    ":{$address_data['local_port']}";
+                $address_connection_array[$address][$address_data['connection_id']] = $address_data['connection_id'];
+            }
+        }
+        return $address_connection_array;
+    }
+
+    /**
+     * 设置 gateway 实例
+     *
+     * @param \GatewayWorker\BusinessWorker $business_worker_instance
+     */
+    public static function setBusinessWorker($business_worker_instance)
+    {
+        static::$businessWorker = $business_worker_instance;
+    }
+
+    /**
+     * 获取通过注册中心获取所有 gateway 通讯地址
+     *
+     * @return array
+     * @throws Exception
+     */
+    protected static function getAllGatewayAddressesFromRegister()
+    {
+        static $addresses_cache, $last_update;
+        if (static::$addressesCacheDisable) {
+            $addresses_cache = null;
+        }
+        $time_now = time();
+        $expiration_time = 1;
+        $register_addresses = (array)static::$registerAddress;
+        $client = null;
+        if(empty($addresses_cache) || $time_now - $last_update > $expiration_time) {
+            foreach ($register_addresses as $register_address) {
+                set_error_handler(function(){});
+                $client = stream_socket_client('tcp://' . $register_address, $errno, $errmsg, static::$connectTimeout);
+                restore_error_handler();
+                if ($client) {
+                    break;
+                }
+            }
+            if (!$client) {
+                throw new Exception('Can not connect to tcp://' . $register_address . ' ' . $errmsg);
+            }
+
+            fwrite($client, '{"event":"worker_connect","secret_key":"' . static::$secretKey . '"}' . "\n");
+            stream_set_timeout($client, 5);
+            $ret = fgets($client, 655350);
+            if (!$ret || !$data = json_decode(trim($ret), true)) {
+                throw new Exception('getAllGatewayAddressesFromRegister fail. tcp://' .
+                    $register_address . ' return ' . var_export($ret, true));
+            }
+            $last_update = $time_now;
+            $addresses_cache = $data['addresses'];
+        }
+        if (!$addresses_cache) {
+            throw new Exception('Gateway::getAllGatewayAddressesFromRegister() with registerAddress:' .
+                json_encode(static::$registerAddress) . '  return ' . var_export($addresses_cache, true));
+        }
+        return $addresses_cache;
+    }
+
+    /**
+     * 检查群组id是否合法
+     *
+     * @param $group
+     * @return bool
+     */
+    protected static function isValidGroupId($group)
+    {
+        if (empty($group)) {
+            echo new \Exception('group('.var_export($group, true).') empty');
+            return false;
+        }
+        return true;
+    }
+}

+ 185 - 0
vendor/workerman/gatewayclient/GatewayProtocol.php

@@ -0,0 +1,185 @@
+<?php
+
+namespace GatewayClient;
+
+/**
+ * This file is part of workerman.
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the MIT-LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @author walkor<walkor@workerman.net>
+ * @copyright walkor<walkor@workerman.net>
+ * @link http://www.workerman.net/
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
+/**
+ * Gateway 与 Worker 间通讯的二进制协议
+ *
+ * struct GatewayProtocol
+ * {
+ *     unsigned int        pack_len,
+ *     unsigned char       cmd,//命令字
+ *     unsigned int        local_ip,
+ *     unsigned short      local_port,
+ *     unsigned int        client_ip,
+ *     unsigned short      client_port,
+ *     unsigned int        connection_id,
+ *     unsigned char       flag,
+ *     unsigned short      gateway_port,
+ *     unsigned int        ext_len,
+ *     char[ext_len]       ext_data,
+ *     char[pack_length-HEAD_LEN] body//包体
+ * }
+ * NCNnNnNCnN
+ */
+class GatewayProtocol
+{
+    // 发给worker,gateway有一个新的连接
+    const CMD_ON_CONNECT = 1;
+    // 发给worker的,客户端有消息
+    const CMD_ON_MESSAGE = 3;
+    // 发给worker上的关闭链接事件
+    const CMD_ON_CLOSE = 4;
+    // 发给gateway的向单个用户发送数据
+    const CMD_SEND_TO_ONE = 5;
+    // 发给gateway的向所有用户发送数据
+    const CMD_SEND_TO_ALL = 6;
+    // 发给gateway的踢出用户
+    // 1、如果有待发消息,将在发送完后立即销毁用户连接
+    // 2、如果无待发消息,将立即销毁用户连接
+    const CMD_KICK = 7;
+    // 发给gateway的立即销毁用户连接
+    const CMD_DESTROY = 8;
+    // 发给gateway,通知用户session更新
+    const CMD_UPDATE_SESSION = 9;
+    // 获取在线状态
+    const CMD_GET_ALL_CLIENT_SESSIONS = 10;
+    // 判断是否在线
+    const CMD_IS_ONLINE = 11;
+    // client_id绑定到uid
+    const CMD_BIND_UID = 12;
+    // 解绑
+    const CMD_UNBIND_UID = 13;
+    // 向uid发送数据
+    const CMD_SEND_TO_UID = 14;
+    // 根据uid获取绑定的clientid
+    const CMD_GET_CLIENT_ID_BY_UID = 15;
+    // 批量获取uid列表批量获取绑定的clientid
+    const CMD_BATCH_GET_CLIENT_ID_BY_UID = 16;
+    // 加入组
+    const CMD_JOIN_GROUP = 20;
+    // 离开组
+    const CMD_LEAVE_GROUP = 21;
+    // 向组成员发消息
+    const CMD_SEND_TO_GROUP = 22;
+    // 获取组成员
+    const CMD_GET_CLIENT_SESSIONS_BY_GROUP = 23;
+    // 获取组在线连接数
+    const CMD_GET_CLIENT_COUNT_BY_GROUP = 24;
+    // 按照条件查找
+    const CMD_SELECT = 25;
+    // 获取在线的群组ID
+    const CMD_GET_GROUP_ID_LIST = 26;
+    // 取消分组
+    const CMD_UNGROUP = 27;
+    // worker连接gateway事件
+    const CMD_WORKER_CONNECT = 200;
+    // 心跳
+    const CMD_PING = 201;
+    // GatewayClient连接gateway事件
+    const CMD_GATEWAY_CLIENT_CONNECT = 202;
+    // 根据client_id获取session
+    const CMD_GET_SESSION_BY_CLIENT_ID = 203;
+    // 发给gateway,覆盖session
+    const CMD_SET_SESSION = 204;
+    // 当websocket握手时触发,只有websocket协议支持此命令字
+    const CMD_ON_WEBSOCKET_CONNECT = 205;
+    // 包体是标量
+    const FLAG_BODY_IS_SCALAR = 0x01;
+    // 通知gateway在send时不调用协议encode方法,在广播组播时提升性能
+    const FLAG_NOT_CALL_ENCODE = 0x02;
+    /**
+     * 包头长度
+     *
+     * @var int
+     */
+    const HEAD_LEN = 28;
+    public static $empty = array(
+        'cmd'           => 0,
+        'local_ip'      => 0,
+        'local_port'    => 0,
+        'client_ip'     => 0,
+        'client_port'   => 0,
+        'connection_id' => 0,
+        'flag'          => 0,
+        'gateway_port'  => 0,
+        'ext_data'      => '',
+        'body'          => '',
+    );
+    /**
+     * 返回包长度
+     *
+     * @param string $buffer
+     * @return int return current package length
+     */
+    public static function input($buffer)
+    {
+        if (strlen($buffer) < self::HEAD_LEN) {
+            return 0;
+        }
+        $data = unpack("Npack_len", $buffer);
+        return $data['pack_len'];
+    }
+    /**
+     * 获取整个包的 buffer
+     *
+     * @param mixed $data
+     * @return string
+     */
+    public static function encode($data)
+    {
+        $flag = (int)is_scalar($data['body']);
+        if (!$flag) {
+            $data['body'] = serialize($data['body']);
+        }
+        $data['flag'] |= $flag;
+        $ext_len      = strlen($data['ext_data']);
+        $package_len  = self::HEAD_LEN + $ext_len + strlen($data['body']);
+        return pack("NCNnNnNCnN", $package_len,
+                $data['cmd'], $data['local_ip'],
+                $data['local_port'], $data['client_ip'],
+                $data['client_port'], $data['connection_id'],
+                $data['flag'], $data['gateway_port'],
+                $ext_len) . $data['ext_data'] . $data['body'];
+    }
+    /**
+     * 从二进制数据转换为数组
+     *
+     * @param string $buffer
+     * @return array
+     */
+    public static function decode($buffer)
+    {
+        $data = unpack("Npack_len/Ccmd/Nlocal_ip/nlocal_port/Nclient_ip/nclient_port/Nconnection_id/Cflag/ngateway_port/Next_len",
+            $buffer);
+        if ($data['ext_len'] > 0) {
+            $data['ext_data'] = substr($buffer, self::HEAD_LEN, $data['ext_len']);
+            if ($data['flag'] & self::FLAG_BODY_IS_SCALAR) {
+                $data['body'] = substr($buffer, self::HEAD_LEN + $data['ext_len']);
+            } else {
+                $data['body'] = unserialize(substr($buffer, self::HEAD_LEN + $data['ext_len']));
+            }
+        } else {
+            $data['ext_data'] = '';
+            if ($data['flag'] & self::FLAG_BODY_IS_SCALAR) {
+                $data['body'] = substr($buffer, self::HEAD_LEN);
+            } else {
+                $data['body'] = unserialize(substr($buffer, self::HEAD_LEN));
+            }
+        }
+        return $data;
+    }
+}

+ 21 - 0
vendor/workerman/gatewayclient/MIT-LICENSE.txt

@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2009-2015 walkor<walkor@workerman.net> and contributors (see https://github.com/walkor/workerman/contributors)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 91 - 0
vendor/workerman/gatewayclient/README.md

@@ -0,0 +1,91 @@
+# GatewayClient
+
+GatewayWorker1.0请使用[1.0版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/v1.0)
+
+GatewayWorker2.0.1-2.0.4请使用[2.0.4版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/2.0.4)
+
+GatewayWorker2.0.5-2.0.6版本请使用[2.0.6版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/2.0.6)
+
+GatewayWorker2.0.7版本请使用 [2.0.7版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/v2.0.7)
+
+GatewayWorker3.0.0-3.0.7版本请使用 [3.0.0版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/v3.0.0)<br>
+
+GatewayWorker3.0.8及以上版本请使用 [3.0.13版本的GatewayClient](https://github.com/walkor/GatewayClient/releases/tag/v3.0.13)<br>
+
+注意:GatewayClient3.0.0以后支持composer并加了命名空间```GatewayClient``` <br>
+
+[如何查看GatewayWorker版本请点击这里](http://doc2.workerman.net/get-gateway-version.html)
+
+## 安装
+**方法一**
+```
+composer require workerman/gatewayclient
+```
+使用时引入`vendor/autoload.php` 类似如下:
+```php
+use GatewayClient\Gateway;
+require_once '真实路径/vendor/autoload.php';
+```
+
+**方法二**
+下载源文件到任意目录,手动引入 `GatewayClient/Gateway.php`, 类似如下:
+```php
+use GatewayClient\Gateway;
+require_once '真实路径/GatewayClient/Gateway.php';
+```
+
+## 使用
+```php
+// GatewayClient 3.0.0版本以后加了命名空间
+use GatewayClient\Gateway;
+
+// composer安装
+require_once '真实路径/vendor/autoload.php';
+
+// 源文件引用
+//require_once '真实路径/GatewayClient/Gateway.php';
+
+/**
+ * === 指定registerAddress表明与哪个GatewayWorker(集群)通讯。===
+ * GatewayWorker里用Register服务来区分集群,即一个GatewayWorker(集群)只有一个Register服务,
+ * GatewayClient要与之通讯必须知道这个Register服务地址才能通讯,这个地址格式为 ip:端口 ,
+ * 其中ip为Register服务运行的ip(如果GatewayWorker是单机部署则ip就是运行GatewayWorker的服务器ip),
+ * 端口是对应ip的服务器上start_register.php文件中监听的端口,也就是GatewayWorker启动时看到的Register的端口。
+ * GatewayClient要想推送数据给客户端,必须知道客户端位于哪个GatewayWorker(集群),
+ * 然后去连这个GatewayWorker(集群)Register服务的 ip:端口,才能与对应GatewayWorker(集群)通讯。
+ * 这个 ip:端口 在GatewayClient一侧使用 Gateway::$registerAddress 来指定。
+ * 
+ * === 如果GatewayClient和GatewayWorker不在同一台服务器需要以下步骤 ===
+ * 1、需要设置start_gateway.php中的lanIp为实际的本机内网ip(如不在一个局域网也可以设置成外网ip),设置完后要重启GatewayWorker
+ * 2、GatewayClient这里的Gateway::$registerAddress的地址填写实际运行Register的服务器ip和端口
+ * 3、需要开启GatewayWorker所在服务器的防火墙,让以下端口可以被GatewayClient所在服务器访问,
+ *    端口包括Rgister服务的端口以及start_gateway.php中lanIp与startPort指定的几个端口
+ *
+ * === 如果GatewayClient和GatewayWorker在同一台服务器 ===
+ * GatewayClient和Register服务都在一台服务器上,ip填写127.0.0.1及即可,无需其它设置。
+ **/
+Gateway::$registerAddress = '127.0.0.1:1236';
+
+// GatewayClient支持GatewayWorker中的所有接口(Gateway::closeCurrentClient Gateway::sendToCurrentClient除外)
+Gateway::sendToAll($data);
+Gateway::sendToClient($client_id, $data);
+Gateway::closeClient($client_id);
+Gateway::isOnline($client_id);
+Gateway::bindUid($client_id, $uid);
+Gateway::isUidOnline($uid);
+Gateway::isUidsOnline($uids);
+Gateway::getClientIdByUid($uid);
+Gateway::unbindUid($client_id, $uid);
+Gateway::sendToUid($uid, $dat);
+Gateway::joinGroup($client_id, $group);
+Gateway::sendToGroup($group, $data);
+Gateway::leaveGroup($client_id, $group);
+Gateway::getClientCountByGroup($group);
+Gateway::getClientSessionsByGroup($group);
+Gateway::getAllClientCount();
+Gateway::getAllClientSessions();
+Gateway::setSession($client_id, $session);
+Gateway::updateSession($client_id, $session);
+Gateway::getSession($client_id);
+```
+

+ 11 - 0
vendor/workerman/gatewayclient/composer.json

@@ -0,0 +1,11 @@
+{
+    "name"  : "workerman/gatewayclient",
+    "type"  : "library",
+    "homepage": "http://www.workerman.net",
+    "license" : "MIT",
+    "autoload": {
+        "psr-4": {
+            "GatewayClient\\": "./"
+        }
+    }
+}

Some files were not shown because too many files changed in this diff