├── frameS ├── swowork_pid ├── vendor │ ├── lwphp │ │ └── swo-worker │ ├── autoload.php │ └── composer │ │ ├── autoload_classmap.php │ │ ├── autoload_namespaces.php │ │ ├── autoload_files.php │ │ ├── autoload_psr4.php │ │ ├── installed.php │ │ ├── installed.json │ │ ├── LICENSE │ │ ├── autoload_static.php │ │ └── autoload_real.php ├── route │ ├── websocket.php │ └── http.php ├── bin │ └── swoSworker ├── config │ ├── service.php │ ├── event.php │ ├── app.php │ ├── database.php │ ├── server.php │ └── consul.php ├── tests │ ├── corotine.php │ ├── rpcClien.php │ ├── pool.php │ └── process.php ├── app │ ├── Rpc │ │ ├── Client │ │ │ └── TestClient.php │ │ └── Service │ │ │ └── TestRpc.php │ ├── Listners │ │ ├── StopListner.php │ │ └── StartListner.php │ ├── Providers │ │ ├── RpcServiceProvider.php │ │ └── RouteServiceProvider.php │ └── Http │ │ └── Controller │ │ └── IndexController.php ├── test │ └── rpcClien.php ├── composer.json └── composer.lock ├── micro ├── goods │ ├── route │ │ ├── websocket.php │ │ └── http.php │ ├── vendor │ │ ├── lwphp │ │ │ └── swo-worker │ │ ├── autoload.php │ │ └── composer │ │ │ ├── autoload_classmap.php │ │ │ ├── autoload_namespaces.php │ │ │ ├── autoload_files.php │ │ │ ├── autoload_psr4.php │ │ │ ├── installed.php │ │ │ ├── installed.json │ │ │ ├── LICENSE │ │ │ ├── autoload_static.php │ │ │ └── autoload_real.php │ ├── bin │ │ └── swoSworker │ ├── config │ │ ├── service.php │ │ ├── event.php │ │ ├── app.php │ │ ├── consul.php │ │ └── server.php │ ├── app │ │ ├── Rpc │ │ │ ├── Client │ │ │ │ ├── OrderClient.php │ │ │ │ ├── TestClient.php │ │ │ │ └── ActivitiesClient.php │ │ │ └── Service │ │ │ │ └── TestRpc.php │ │ ├── Providers │ │ │ ├── RouteServiceProvider.php │ │ │ └── RpcServiceProvider.php │ │ ├── Listners │ │ │ ├── StopListner.php │ │ │ └── StartListner.php │ │ └── Http │ │ │ └── Controller │ │ │ ├── IndexController.php │ │ │ └── DetailController.php │ ├── test │ │ └── rpcClien.php │ ├── composer.json │ └── composer.lock ├── order │ ├── route │ │ ├── websocket.php │ │ └── http.php │ ├── vendor │ │ ├── lwphp │ │ │ └── swo-worker │ │ │ │ ├── vendor │ │ │ │ ├── composer │ │ │ │ │ ├── installed.json │ │ │ │ │ ├── autoload_namespaces.php │ │ │ │ │ ├── autoload_psr4.php │ │ │ │ │ ├── autoload_files.php │ │ │ │ │ ├── autoload_classmap.php │ │ │ │ │ ├── installed.php │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── autoload_static.php │ │ │ │ │ └── autoload_real.php │ │ │ │ └── autoload.php │ │ │ │ ├── src │ │ │ │ ├── Support │ │ │ │ │ ├── ServiceProvider.php │ │ │ │ │ └── Log.php │ │ │ │ ├── Event │ │ │ │ │ ├── Listner.php │ │ │ │ │ ├── EventServiceProvider.php │ │ │ │ │ └── Event.php │ │ │ │ ├── Message │ │ │ │ │ ├── Response.php │ │ │ │ │ └── Http │ │ │ │ │ │ └── Request.php │ │ │ │ ├── Bootstrap │ │ │ │ │ ├── LoadConfigProvider.php │ │ │ │ │ └── ServiceProvier.php │ │ │ │ ├── Rpc │ │ │ │ │ ├── RpcServiceProvider.php │ │ │ │ │ ├── Proxy.php │ │ │ │ │ ├── RpcClient.php │ │ │ │ │ └── RpcServer.php │ │ │ │ ├── Route │ │ │ │ │ ├── RouteServiceProvider.php │ │ │ │ │ └── Route.php │ │ │ │ ├── Helper │ │ │ │ │ └── functions.php │ │ │ │ ├── Server │ │ │ │ │ ├── WebSocket │ │ │ │ │ │ └── Server.php │ │ │ │ │ ├── Http │ │ │ │ │ │ └── Server.php │ │ │ │ │ └── ServerBase.php │ │ │ │ ├── Consul │ │ │ │ │ ├── Agent.php │ │ │ │ │ ├── ConsulServiceProvider.php │ │ │ │ │ └── Response.php │ │ │ │ ├── Config │ │ │ │ │ └── Config.php │ │ │ │ └── Container │ │ │ │ │ └── Container.php │ │ │ │ ├── composer.json │ │ │ │ └── composer.lock │ │ ├── autoload.php │ │ └── composer │ │ │ ├── autoload_namespaces.php │ │ │ ├── autoload_classmap.php │ │ │ ├── autoload_files.php │ │ │ ├── autoload_psr4.php │ │ │ ├── installed.php │ │ │ ├── LICENSE │ │ │ ├── installed.json │ │ │ ├── autoload_static.php │ │ │ └── autoload_real.php │ ├── bin │ │ └── swoSworker │ ├── config │ │ ├── service.php │ │ ├── event.php │ │ ├── app.php │ │ ├── server.php │ │ └── consul.php │ ├── app │ │ ├── Rpc │ │ │ ├── Service │ │ │ │ ├── OrderRpc.php │ │ │ │ └── TestRpc.php │ │ │ └── Client │ │ │ │ └── TestClient.php │ │ ├── Providers │ │ │ ├── RouteServiceProvider.php │ │ │ └── RpcServiceProvider.php │ │ ├── Listners │ │ │ ├── StopListner.php │ │ │ └── StartListner.php │ │ └── Http │ │ │ └── Controller │ │ │ └── IndexController.php │ ├── test │ │ └── rpcClien.php │ ├── composer.json │ └── composer.lock └── activities │ ├── route │ ├── websocket.php │ └── http.php │ ├── vendor │ ├── lwphp │ │ └── swo-worker │ │ │ ├── vendor │ │ │ ├── composer │ │ │ │ ├── installed.json │ │ │ │ ├── autoload_namespaces.php │ │ │ │ ├── autoload_psr4.php │ │ │ │ ├── autoload_files.php │ │ │ │ ├── autoload_classmap.php │ │ │ │ ├── installed.php │ │ │ │ ├── LICENSE │ │ │ │ ├── autoload_static.php │ │ │ │ └── autoload_real.php │ │ │ └── autoload.php │ │ │ ├── src │ │ │ ├── Support │ │ │ │ ├── ServiceProvider.php │ │ │ │ └── Log.php │ │ │ ├── Event │ │ │ │ ├── Listner.php │ │ │ │ ├── EventServiceProvider.php │ │ │ │ └── Event.php │ │ │ ├── Message │ │ │ │ ├── Response.php │ │ │ │ └── Http │ │ │ │ │ └── Request.php │ │ │ ├── Bootstrap │ │ │ │ ├── LoadConfigProvider.php │ │ │ │ └── ServiceProvier.php │ │ │ ├── Rpc │ │ │ │ ├── RpcServiceProvider.php │ │ │ │ ├── Proxy.php │ │ │ │ ├── RpcClient.php │ │ │ │ └── RpcServer.php │ │ │ ├── Route │ │ │ │ ├── RouteServiceProvider.php │ │ │ │ └── Route.php │ │ │ ├── Helper │ │ │ │ └── functions.php │ │ │ ├── Server │ │ │ │ ├── WebSocket │ │ │ │ │ └── Server.php │ │ │ │ ├── Http │ │ │ │ │ └── Server.php │ │ │ │ └── ServerBase.php │ │ │ ├── Consul │ │ │ │ ├── Agent.php │ │ │ │ ├── ConsulServiceProvider.php │ │ │ │ └── Response.php │ │ │ ├── Config │ │ │ │ └── Config.php │ │ │ └── Container │ │ │ │ └── Container.php │ │ │ ├── composer.json │ │ │ └── composer.lock │ ├── autoload.php │ └── composer │ │ ├── autoload_namespaces.php │ │ ├── autoload_classmap.php │ │ ├── autoload_files.php │ │ ├── autoload_psr4.php │ │ ├── installed.php │ │ ├── LICENSE │ │ ├── installed.json │ │ ├── autoload_static.php │ │ └── autoload_real.php │ ├── bin │ └── swoSworker │ ├── config │ ├── service.php │ ├── event.php │ ├── app.php │ ├── server.php │ └── consul.php │ ├── app │ ├── Rpc │ │ ├── Service │ │ │ ├── ActivitiesRpc.php │ │ │ └── TestRpc.php │ │ └── Client │ │ │ └── TestClient.php │ ├── Providers │ │ ├── RouteServiceProvider.php │ │ └── RpcServiceProvider.php │ ├── Listners │ │ ├── StopListner.php │ │ └── StartListner.php │ └── Http │ │ └── Controller │ │ └── IndexController.php │ ├── test │ └── rpcClien.php │ ├── composer.json │ └── composer.lock ├── images └── consul.jpg ├── swoWorker ├── vendor │ ├── composer │ │ ├── installed.json │ │ ├── autoload_namespaces.php │ │ ├── autoload_psr4.php │ │ ├── autoload_files.php │ │ ├── autoload_classmap.php │ │ ├── installed.php │ │ ├── LICENSE │ │ ├── autoload_static.php │ │ └── autoload_real.php │ └── autoload.php ├── src │ ├── Support │ │ ├── ServiceProvider.php │ │ └── Log.php │ ├── Event │ │ ├── Listner.php │ │ ├── EventServiceProvider.php │ │ └── Event.php │ ├── Message │ │ ├── Response.php │ │ └── Http │ │ │ └── Request.php │ ├── Bootstrap │ │ ├── LoadConfigProvider.php │ │ └── ServiceProvier.php │ ├── Rpc │ │ ├── RpcServiceProvider.php │ │ ├── Proxy.php │ │ ├── RpcClient.php │ │ └── RpcServer.php │ ├── Route │ │ ├── RouteServiceProvider.php │ │ └── Route.php │ ├── Database │ │ ├── DbServiceProvider.php │ │ ├── Pool.php │ │ ├── DB.php │ │ └── Driver │ │ │ ├── Mysql.php │ │ │ └── MysqlPool.php │ ├── Server │ │ ├── WebSocket │ │ │ └── Server.php │ │ └── Http │ │ │ └── Server.php │ ├── Helper │ │ └── functions.php │ ├── Consul │ │ ├── Agent.php │ │ ├── ConsulServiceProvider.php │ │ └── Response.php │ ├── Config │ │ └── Config.php │ └── Container │ │ └── Container.php ├── composer.json └── composer.lock └── README.md /frameS/swowork_pid: -------------------------------------------------------------------------------- 1 | 31370 -------------------------------------------------------------------------------- /micro/goods/route/websocket.php: -------------------------------------------------------------------------------- 1 | run($argv); 4 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [], 3 | "dev": true, 4 | "dev-package-names": [] 5 | } 6 | -------------------------------------------------------------------------------- /micro/goods/bin/swoSworker: -------------------------------------------------------------------------------- 1 | run($argv); 4 | -------------------------------------------------------------------------------- /micro/order/bin/swoSworker: -------------------------------------------------------------------------------- 1 | run($argv); 4 | -------------------------------------------------------------------------------- /micro/activities/bin/swoSworker: -------------------------------------------------------------------------------- 1 | run($argv); 4 | -------------------------------------------------------------------------------- /frameS/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | [ 11 | 'host' => '192.168.56.102', 12 | 'port' => 9901 13 | ] 14 | ]; -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | [ 11 | 'host' => '192.168.56.102', 12 | 'port' => 9901 13 | ] 14 | ]; -------------------------------------------------------------------------------- /micro/order/config/service.php: -------------------------------------------------------------------------------- 1 | [ 11 | 'host' => '192.168.56.102', 12 | 'port' => 9901 13 | ] 14 | ]; -------------------------------------------------------------------------------- /micro/activities/config/service.php: -------------------------------------------------------------------------------- 1 | [ 11 | 'host' => '192.168.56.102', 12 | 'port' => 9901 13 | ] 14 | ]; -------------------------------------------------------------------------------- /swoWorker/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/src'), 10 | ); 11 | -------------------------------------------------------------------------------- /frameS/config/event.php: -------------------------------------------------------------------------------- 1 | [ 11 | app\Listners\StartListner::class, 12 | app\Listners\StopListner::class 13 | ], 14 | ]; -------------------------------------------------------------------------------- /micro/goods/config/event.php: -------------------------------------------------------------------------------- 1 | [ 11 | app\Listners\StartListner::class, 12 | app\Listners\StopListner::class 13 | ], 14 | ]; -------------------------------------------------------------------------------- /micro/order/config/event.php: -------------------------------------------------------------------------------- 1 | [ 11 | app\Listners\StartListner::class, 12 | app\Listners\StopListner::class 13 | ], 14 | ]; -------------------------------------------------------------------------------- /micro/activities/config/event.php: -------------------------------------------------------------------------------- 1 | [ 11 | app\Listners\StartListner::class, 12 | app\Listners\StopListner::class 13 | ], 14 | ]; -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/src'), 10 | ); 11 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/src'), 10 | ); 11 | -------------------------------------------------------------------------------- /swoWorker/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $baseDir . '/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/order/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /swoWorker/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwoWorker 2 | swoole frameworker 3 | 4 | 5 | 基于swoole的php轻量级微服务框架 6 | 7 | 一.驱动 8 | 9 | 1.配置加载 10 | 11 | 2.服务提供者 12 | 13 | 二.服务组件 14 | 15 | 1.route 16 | 17 | 2.event 18 | 19 | 三.微服务支持 20 | 21 | 1.rpc 22 | 1.1 server 23 | 1.2 client 24 | 25 | 2.集成consul 26 | 27 | ![consul集成流程](./images/consul.jpg) 28 | -------------------------------------------------------------------------------- /frameS/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/lwphp/swo-worker/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/lwphp/swo-worker/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/order/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/lwphp/swo-worker/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /frameS/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/app'), 10 | 'SwoWorker\\' => array($vendorDir . '/lwphp/swo-worker/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/lwphp/swo-worker/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $baseDir . '/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $baseDir . '/src/Helper/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/app'), 10 | 'SwoWorker\\' => array($vendorDir . '/lwphp/swo-worker/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /micro/order/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/app'), 10 | 'SwoWorker\\' => array($vendorDir . '/lwphp/swo-worker/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($baseDir . '/app'), 10 | 'SwoWorker\\' => array($vendorDir . '/lwphp/swo-worker/src'), 11 | ); 12 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /swoWorker/src/Support/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app = $app; 10 | } 11 | 12 | abstract public function register(); 13 | abstract public function boot(); 14 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/composer/InstalledVersions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /micro/goods/config/app.php: -------------------------------------------------------------------------------- 1 | 'ooo', 4 | 'providers' => [ 5 | app\Providers\RouteServiceProvider::class, 6 | app\Providers\RpcServiceProvider::class, 7 | \SwoWorker\Consul\ConsulServiceProvider::class, 8 | \SwoWorker\Event\EventServiceProvider::class, 9 | 10 | 11 | ], 12 | 13 | ]; -------------------------------------------------------------------------------- /micro/order/config/app.php: -------------------------------------------------------------------------------- 1 | 'ooo', 4 | 'providers' => [ 5 | app\Providers\RouteServiceProvider::class, 6 | app\Providers\RpcServiceProvider::class, 7 | \SwoWorker\Consul\ConsulServiceProvider::class, 8 | \SwoWorker\Event\EventServiceProvider::class, 9 | 10 | 11 | ], 12 | 13 | ]; -------------------------------------------------------------------------------- /frameS/tests/corotine.php: -------------------------------------------------------------------------------- 1 | query("select count(*) from `thread`"); 14 | }); 15 | } -------------------------------------------------------------------------------- /micro/activities/config/app.php: -------------------------------------------------------------------------------- 1 | 'ooo', 4 | 'providers' => [ 5 | app\Providers\RouteServiceProvider::class, 6 | app\Providers\RpcServiceProvider::class, 7 | \SwoWorker\Consul\ConsulServiceProvider::class, 8 | \SwoWorker\Event\EventServiceProvider::class, 9 | 10 | 11 | ], 12 | 13 | ]; -------------------------------------------------------------------------------- /micro/order/app/Rpc/Service/OrderRpc.php: -------------------------------------------------------------------------------- 1 | "your order list"]; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /micro/activities/app/Rpc/Service/ActivitiesRpc.php: -------------------------------------------------------------------------------- 1 | "welcome"]; 17 | } 18 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Support/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app = $app; 10 | } 11 | 12 | abstract public function register(); 13 | abstract public function boot(); 14 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Support/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | app = $app; 10 | } 11 | 12 | abstract public function register(); 13 | abstract public function boot(); 14 | } -------------------------------------------------------------------------------- /swoWorker/src/Event/Listner.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | } -------------------------------------------------------------------------------- /frameS/app/Rpc/Client/TestClient.php: -------------------------------------------------------------------------------- 1 | "test rpc"]; 16 | } 17 | public function hello() 18 | { 19 | return ['msg'=>'hello']; 20 | } 21 | } -------------------------------------------------------------------------------- /frameS/config/app.php: -------------------------------------------------------------------------------- 1 | [ 4 | app\Providers\RouteServiceProvider::class, 5 | app\Providers\RpcServiceProvider::class, 6 | \SwoWorker\Consul\ConsulServiceProvider::class, 7 | \SwoWorker\Event\EventServiceProvider::class, 8 | \SwoWorker\Database\DbServiceProvider::class, 9 | ], 10 | 'file_path' => '/www', 11 | 12 | ]; -------------------------------------------------------------------------------- /micro/goods/app/Rpc/Client/OrderClient.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | } -------------------------------------------------------------------------------- /micro/activities/app/Rpc/Client/TestClient.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | } -------------------------------------------------------------------------------- /micro/goods/app/Rpc/Service/TestRpc.php: -------------------------------------------------------------------------------- 1 | "test rpc"]; 16 | } 17 | public function hello() 18 | { 19 | return ['msg'=>'hello']; 20 | } 21 | } -------------------------------------------------------------------------------- /micro/order/app/Rpc/Service/TestRpc.php: -------------------------------------------------------------------------------- 1 | "test rpc"]; 16 | } 17 | public function hello() 18 | { 19 | return ['msg'=>'hello']; 20 | } 21 | } -------------------------------------------------------------------------------- /micro/activities/app/Rpc/Service/TestRpc.php: -------------------------------------------------------------------------------- 1 | "test rpc"]; 16 | } 17 | public function hello() 18 | { 19 | return ['msg'=>'hello']; 20 | } 21 | } -------------------------------------------------------------------------------- /micro/goods/app/Rpc/Client/ActivitiesClient.php: -------------------------------------------------------------------------------- 1 | bind('config', (new Config($app->getConfigPath()))); 19 | } 20 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Message/Response.php: -------------------------------------------------------------------------------- 1 | 'mysql', 11 | 'mysql' => [ 12 | 'host' => '127.0.0.1', 13 | 'port' => 3306, 14 | 'username' => 'mymovie', 15 | 'password' => 'Ww@3613040', 16 | 'dbname' => 'test', 17 | 'charset' => 'utf8', 18 | 'pool' => [ 19 | 'size' => 50 20 | ] 21 | ], 22 | ]; -------------------------------------------------------------------------------- /frameS/test/rpcClien.php: -------------------------------------------------------------------------------- 1 | connect('192.168.56.102', 9800); 12 | 13 | $data = [ 14 | 'method' => 'app\Rpc\Service\TestRpc::test', 15 | // 'method' => 'app\Http\Controller\IndexController::rpc', 16 | 'params' => [] 17 | ]; 18 | $client->send(json_encode($data)); 19 | echo $client->recv(); 20 | 21 | $client->close(); -------------------------------------------------------------------------------- /frameS/tests/rpcClien.php: -------------------------------------------------------------------------------- 1 | connect('192.168.56.102', 9800); 12 | 13 | $data = [ 14 | 'method' => 'app\Rpc\Service\TestRpc::test', 15 | // 'method' => 'app\Http\Controller\IndexController::rpc', 16 | 'params' => [] 17 | ]; 18 | $client->send(json_encode($data)); 19 | echo $client->recv(); 20 | 21 | $client->close(); -------------------------------------------------------------------------------- /micro/goods/config/consul.php: -------------------------------------------------------------------------------- 1 | bind('config', (new Config($app->getConfigPath()))); 19 | } 20 | } -------------------------------------------------------------------------------- /frameS/route/http.php: -------------------------------------------------------------------------------- 1 | on("WorkerStart", function ($pool, $workerId) { 12 | echo "Worker#{$workerId} is started\n"; 13 | while (true){ 14 | 15 | } 16 | }); 17 | 18 | $pool->on("WorkerStop", function ($pool, $workerId) { 19 | echo "Worker#{$workerId} is stopped\n"; 20 | }); 21 | 22 | $pool->start(); -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Bootstrap/LoadConfigProvider.php: -------------------------------------------------------------------------------- 1 | bind('config', (new Config($app->getConfigPath()))); 19 | } 20 | } -------------------------------------------------------------------------------- /micro/goods/test/rpcClien.php: -------------------------------------------------------------------------------- 1 | connect('192.168.56.102', 9800); 12 | 13 | $data = [ 14 | 'method' => 'app\Rpc\Service\TestRpc::test', 15 | // 'method' => 'app\Http\Controller\IndexController::rpc', 16 | 'params' => [] 17 | ]; 18 | $client->send(json_encode($data)); 19 | echo $client->recv(); 20 | 21 | $client->close(); -------------------------------------------------------------------------------- /micro/order/test/rpcClien.php: -------------------------------------------------------------------------------- 1 | connect('192.168.56.102', 9800); 12 | 13 | $data = [ 14 | 'method' => 'app\Rpc\Service\TestRpc::test', 15 | // 'method' => 'app\Http\Controller\IndexController::rpc', 16 | 'params' => [] 17 | ]; 18 | $client->send(json_encode($data)); 19 | echo $client->recv(); 20 | 21 | $client->close(); -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/swo-worker", 3 | "description": "swoole worker", 4 | "license": "MIT", 5 | "authors": [ 6 | { 7 | "name": "liwei", 8 | "email": "liweiphp@163.com" 9 | } 10 | ], 11 | "autoload": { 12 | "psr-4": { 13 | "SwoWorker\\": "./src/" 14 | }, 15 | "files": [ 16 | "src/Helper/functions.php" 17 | ] 18 | }, 19 | "require": {} 20 | } -------------------------------------------------------------------------------- /micro/activities/test/rpcClien.php: -------------------------------------------------------------------------------- 1 | connect('192.168.56.102', 9800); 12 | 13 | $data = [ 14 | 'method' => 'app\Rpc\Service\TestRpc::test', 15 | // 'method' => 'app\Http\Controller\IndexController::rpc', 16 | 'params' => [] 17 | ]; 18 | $client->send(json_encode($data)); 19 | echo $client->recv(); 20 | 21 | $client->close(); -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/swo-worker", 3 | "description": "swoole worker", 4 | "license": "MIT", 5 | "authors": [ 6 | { 7 | "name": "liwei", 8 | "email": "liweiphp@163.com" 9 | } 10 | ], 11 | "autoload": { 12 | "psr-4": { 13 | "SwoWorker\\": "./src/" 14 | }, 15 | "files": [ 16 | "src/Helper/functions.php" 17 | ] 18 | }, 19 | "require": {} 20 | } -------------------------------------------------------------------------------- /micro/goods/route/http.php: -------------------------------------------------------------------------------- 1 | make('config')->get('app.providers'); 18 | foreach ($providers as $provider){ 19 | $app->register(new $provider($app)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Bootstrap/ServiceProvier.php: -------------------------------------------------------------------------------- 1 | make('config')->get('app.providers'); 18 | foreach ($providers as $provider){ 19 | $app->register(new $provider($app)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Bootstrap/ServiceProvier.php: -------------------------------------------------------------------------------- 1 | make('config')->get('app.providers'); 18 | foreach ($providers as $provider){ 19 | $app->register(new $provider($app)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /frameS/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/frame-s", 3 | "description": "swoole framework", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Wei Li", 9 | "email": "liwei16@xin.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "app\\": "./app/" 15 | } 16 | }, 17 | "require": { 18 | "lwphp/swo-worker": "master-dev" 19 | }, 20 | "repositories": { 21 | "lwphp": { 22 | "type": "path", 23 | "url": "../swoWorker" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /micro/goods/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/frame-s", 3 | "description": "swoole framework", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Wei Li", 9 | "email": "liwei16@xin.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "app\\": "./app/" 15 | } 16 | }, 17 | "require": { 18 | "lwphp/swo-worker": "master-dev" 19 | }, 20 | "repositories": { 21 | "lwphp": { 22 | "type": "path", 23 | "url": "../swoWorker" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /micro/order/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/frame-s", 3 | "description": "swoole framework", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Wei Li", 9 | "email": "liwei16@xin.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "app\\": "./app/" 15 | } 16 | }, 17 | "require": { 18 | "lwphp/swo-worker": "master-dev" 19 | }, 20 | "repositories": { 21 | "lwphp": { 22 | "type": "path", 23 | "url": "../swoWorker" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /micro/activities/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lwphp/frame-s", 3 | "description": "swoole framework", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Wei Li", 9 | "email": "liwei16@xin.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "app\\": "./app/" 15 | } 16 | }, 17 | "require": { 18 | "lwphp/swo-worker": "master-dev" 19 | }, 20 | "repositories": { 21 | "lwphp": { 22 | "type": "path", 23 | "url": "../swoWorker" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /swoWorker/src/Rpc/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = $this->app->make('config')->get('service'); 19 | 20 | } 21 | public function boot() 22 | { 23 | // TODO: Implement boot() method. 24 | $this->app->bind('rpc_proxy', new Proxy($this->services)); 25 | } 26 | } -------------------------------------------------------------------------------- /micro/goods/config/server.php: -------------------------------------------------------------------------------- 1 | [ 10 | 'host' => '192.168.56.102', 11 | 'port' => 9900 12 | ], 13 | 14 | 'rpc' => [ 15 | 'enable' => true, 16 | 'server' => [ 17 | 'host' => '192.168.56.102', 18 | 'port' => 9901, 19 | 'type' => SWOOLE_SOCK_TCP 20 | ], 21 | 'swoole' => [ 22 | 23 | ], 24 | ], 25 | 26 | 'consul' => [ 27 | 'host' => '192.168.56.102', 28 | 'port' => 8500 29 | ], 30 | 31 | 32 | ]; -------------------------------------------------------------------------------- /micro/order/config/server.php: -------------------------------------------------------------------------------- 1 | [ 10 | 'host' => '192.168.56.102', 11 | 'port' => 9800 12 | ], 13 | 14 | 'rpc' => [ 15 | 'enable' => true, 16 | 'server' => [ 17 | 'host' => '192.168.56.102', 18 | 'port' => 9801, 19 | 'type' => SWOOLE_SOCK_TCP 20 | ], 21 | 'swoole' => [ 22 | 23 | ], 24 | ], 25 | 26 | 'consul' => [ 27 | 'host' => '192.168.56.102', 28 | 'port' => 8500 29 | ], 30 | 31 | 32 | ]; -------------------------------------------------------------------------------- /swoWorker/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => 'dev-master', 5 | 'version' => 'dev-master', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => '2077c8e7086e02f4aef4a69074545b72fd3697d9', 10 | 'name' => 'lwphp/swo-worker', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/swo-worker' => 15 | array ( 16 | 'pretty_version' => 'dev-master', 17 | 'version' => 'dev-master', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => '2077c8e7086e02f4aef4a69074545b72fd3697d9', 22 | ), 23 | ), 24 | ); 25 | -------------------------------------------------------------------------------- /micro/activities/config/server.php: -------------------------------------------------------------------------------- 1 | [ 10 | 'host' => '192.168.56.102', 11 | 'port' => 9700 12 | ], 13 | 14 | 'rpc' => [ 15 | 'enable' => true, 16 | 'server' => [ 17 | 'host' => '192.168.56.102', 18 | 'port' => 9701, 19 | 'type' => SWOOLE_SOCK_TCP 20 | ], 21 | 'swoole' => [ 22 | 23 | ], 24 | ], 25 | 26 | 'consul' => [ 27 | 'host' => '192.168.56.102', 28 | 'port' => 8500 29 | ], 30 | 31 | 32 | ]; -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Rpc/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = $this->app->make('config')->get('service'); 19 | 20 | } 21 | public function boot() 22 | { 23 | // TODO: Implement boot() method. 24 | $this->app->bind('rpc_proxy', new Proxy($this->services)); 25 | } 26 | } -------------------------------------------------------------------------------- /swoWorker/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "96edc5499fec437fe4a915ff92488544", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": [], 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": [], 16 | "platform-dev": [], 17 | "plugin-api-version": "2.0.0" 18 | } 19 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Rpc/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = $this->app->make('config')->get('service'); 19 | 20 | } 21 | public function boot() 22 | { 23 | // TODO: Implement boot() method. 24 | $this->app->bind('rpc_proxy', new Proxy($this->services)); 25 | } 26 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => 'dev-master', 5 | 'version' => 'dev-master', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => '550b4ca6ca9d91a214a28dd33f10b4232e17f433', 10 | 'name' => 'lwphp/swo-worker', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/swo-worker' => 15 | array ( 16 | 'pretty_version' => 'dev-master', 17 | 'version' => 'dev-master', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => '550b4ca6ca9d91a214a28dd33f10b4232e17f433', 22 | ), 23 | ), 24 | ); 25 | -------------------------------------------------------------------------------- /swoWorker/src/Route/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Route', Route::getInstance()); 20 | 21 | } 22 | public function boot() 23 | { 24 | // TODO: Implement boot() method. 25 | $this->app->make('Route')->registerRoute($this->map); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => 'dev-master', 5 | 'version' => 'dev-master', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => '550b4ca6ca9d91a214a28dd33f10b4232e17f433', 10 | 'name' => 'lwphp/swo-worker', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/swo-worker' => 15 | array ( 16 | 'pretty_version' => 'dev-master', 17 | 'version' => 'dev-master', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => '550b4ca6ca9d91a214a28dd33f10b4232e17f433', 22 | ), 23 | ), 24 | ); 25 | -------------------------------------------------------------------------------- /swoWorker/src/Event/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('event', new Event()); 17 | } 18 | public function boot() 19 | { 20 | // TODO: Implement boot() method. 21 | $events = $this->app->make('config')->get('event'); 22 | $this->app->make('event')->registerEvents($events); 23 | } 24 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "96edc5499fec437fe4a915ff92488544", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": [], 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": [], 16 | "platform-dev": [], 17 | "plugin-api-version": "2.0.0" 18 | } 19 | -------------------------------------------------------------------------------- /frameS/config/server.php: -------------------------------------------------------------------------------- 1 | [ 10 | 'host' => '192.168.56.102', 11 | 'port' => 9900, 12 | 'pid_file' => file_path("swowork_pid") 13 | ], 14 | 15 | 'rpc' => [ 16 | 'enable' => true, 17 | 'server' => [ 18 | 'host' => '0.0.0.0', 19 | 'port' => 9800, 20 | 'type' => SWOOLE_SOCK_TCP 21 | ], 22 | 'swoole' => [ 23 | 24 | ], 25 | ], 26 | 27 | 'consul' => [ 28 | 'host' => '192.168.56.102', 29 | 'port' => 8500 30 | ], 31 | 32 | 33 | ]; -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "96edc5499fec437fe4a915ff92488544", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": [], 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": [], 16 | "platform-dev": [], 17 | "plugin-api-version": "2.0.0" 18 | } 19 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Route/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Route', Route::getInstance()); 20 | 21 | } 22 | public function boot() 23 | { 24 | // TODO: Implement boot() method. 25 | $this->app->make('Route')->registerRoute($this->map); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Route/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Route', Route::getInstance()); 20 | 21 | } 22 | public function boot() 23 | { 24 | // TODO: Implement boot() method. 25 | $this->app->make('Route')->registerRoute($this->map); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Event/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('event', new Event()); 17 | } 18 | public function boot() 19 | { 20 | // TODO: Implement boot() method. 21 | $events = $this->app->make('config')->get('event'); 22 | $this->app->make('event')->registerEvents($events); 23 | } 24 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Event/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('event', new Event()); 17 | } 18 | public function boot() 19 | { 20 | // TODO: Implement boot() method. 21 | $events = $this->app->make('config')->get('event'); 22 | $this->app->make('event')->registerEvents($events); 23 | } 24 | } -------------------------------------------------------------------------------- /swoWorker/src/Message/Http/Request.php: -------------------------------------------------------------------------------- 1 | method = $swooleRequest->server['request_method']; 17 | $this->uri = trim($swooleRequest->server['path_info'], '\/'); 18 | return $this; 19 | } 20 | 21 | public static function getInstance() 22 | { 23 | if (!self::$reuqest){ 24 | self::$reuqest = new static(); 25 | } 26 | return self::$reuqest; 27 | } 28 | } -------------------------------------------------------------------------------- /micro/goods/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | setHttpRoute(); 17 | parent::register(); // TODO: Change the autogenerated stub 18 | } 19 | 20 | public function setHttpRoute() 21 | { 22 | $this->map['http'] = [ 23 | 'namespace' => 'app\Http\Controller', 24 | 'path' => $this->app->getBasePath().'/route/http.php' 25 | ]; 26 | } 27 | } -------------------------------------------------------------------------------- /micro/order/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | setHttpRoute(); 17 | parent::register(); // TODO: Change the autogenerated stub 18 | } 19 | 20 | public function setHttpRoute() 21 | { 22 | $this->map['http'] = [ 23 | 'namespace' => 'app\Http\Controller', 24 | 'path' => $this->app->getBasePath().'/route/http.php' 25 | ]; 26 | } 27 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Message/Http/Request.php: -------------------------------------------------------------------------------- 1 | method = $swooleRequest->server['request_method']; 17 | $this->uri = trim($swooleRequest->server['path_info'], '\/'); 18 | return $this; 19 | } 20 | 21 | public static function getInstance() 22 | { 23 | if (!self::$reuqest){ 24 | self::$reuqest = new static(); 25 | } 26 | return self::$reuqest; 27 | } 28 | } -------------------------------------------------------------------------------- /micro/activities/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | setHttpRoute(); 17 | parent::register(); // TODO: Change the autogenerated stub 18 | } 19 | 20 | public function setHttpRoute() 21 | { 22 | $this->map['http'] = [ 23 | 'namespace' => 'app\Http\Controller', 24 | 'path' => $this->app->getBasePath().'/route/http.php' 25 | ]; 26 | } 27 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Message/Http/Request.php: -------------------------------------------------------------------------------- 1 | method = $swooleRequest->server['request_method']; 17 | $this->uri = trim($swooleRequest->server['path_info'], '\/'); 18 | return $this; 19 | } 20 | 21 | public static function getInstance() 22 | { 23 | if (!self::$reuqest){ 24 | self::$reuqest = new static(); 25 | } 26 | return self::$reuqest; 27 | } 28 | } -------------------------------------------------------------------------------- /swoWorker/src/Support/Log.php: -------------------------------------------------------------------------------- 1 | ".$description." start<=====\n"; 14 | if ($type){ 15 | var_dump($message); 16 | } elseif (\is_array($message)) { 17 | echo \var_export($message, true); 18 | } else if (\is_string($message)) { 19 | echo $message."\n"; 20 | } else { 21 | var_dump($message); 22 | } 23 | echo "=======> ".$description." end <=======\n"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frameS/tests/process.php: -------------------------------------------------------------------------------- 1 | start(); 22 | } 23 | for ($n = 3; $n--;) { 24 | $status = Process::wait(true); 25 | echo "Recycled #{$status['pid']}, code={$status['code']}, signal={$status['signal']}" . PHP_EOL; 26 | } 27 | echo 'Parent #' . getmypid() . ' exit' . PHP_EOL; -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Support/Log.php: -------------------------------------------------------------------------------- 1 | ".$description." start<=====\n"; 14 | if ($type){ 15 | var_dump($message); 16 | } elseif (\is_array($message)) { 17 | echo \var_export($message, true); 18 | } else if (\is_string($message)) { 19 | echo $message."\n"; 20 | } else { 21 | var_dump($message); 22 | } 23 | echo "=======> ".$description." end <=======\n"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frameS/app/Listners/StopListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //销毁服务 24 | Coroutine::create([app('consul_agent'), 'deregisterService'], $serviceNode['ID']); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Support/Log.php: -------------------------------------------------------------------------------- 1 | ".$description." start<=====\n"; 14 | if ($type){ 15 | var_dump($message); 16 | } elseif (\is_array($message)) { 17 | echo \var_export($message, true); 18 | } else if (\is_string($message)) { 19 | echo $message."\n"; 20 | } else { 21 | var_dump($message); 22 | } 23 | echo "=======> ".$description." end <=======\n"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /frameS/app/Listners/StartListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //注册服务 24 | Coroutine::create([app('consul_agent'), 'registerService'], $serviceNode); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/goods/app/Listners/StopListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //销毁服务 24 | Coroutine::create([app('consul_agent'), 'deregisterService'], $serviceNode['ID']); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/order/app/Listners/StopListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //销毁服务 24 | Coroutine::create([app('consul_agent'), 'deregisterService'], $serviceNode['ID']); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/activities/app/Listners/StopListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //销毁服务 24 | Coroutine::create([app('consul_agent'), 'deregisterService'], $serviceNode['ID']); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/goods/app/Listners/StartListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //注册服务 24 | Coroutine::create([app('consul_agent'), 'registerService'], $serviceNode); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /micro/order/app/Listners/StartListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //注册服务 24 | Coroutine::create([app('consul_agent'), 'registerService'], $serviceNode); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /swoWorker/src/Database/DbServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->make('config')->get('database'); 20 | $dbConfig = $config[$config['driver']]; 21 | $this->app->bind('db', new MysqlPool((new Pool($dbConfig))->getPool())); 22 | 23 | } 24 | 25 | public function boot() 26 | { 27 | // TODO: Implement boot() method. 28 | } 29 | } -------------------------------------------------------------------------------- /micro/activities/app/Listners/StartListner.php: -------------------------------------------------------------------------------- 1 | get('consul'); 21 | foreach ($services as $service) { 22 | array_map(function ($serviceNode){ 23 | //注册服务 24 | Coroutine::create([app('consul_agent'), 'registerService'], $serviceNode); 25 | }, $service); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /frameS/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => '1.0.0+no-version-set', 5 | 'version' => '1.0.0.0', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => NULL, 10 | 'name' => 'lwphp/frame-s', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/frame-s' => 15 | array ( 16 | 'pretty_version' => '1.0.0+no-version-set', 17 | 'version' => '1.0.0.0', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => NULL, 22 | ), 23 | 'lwphp/swo-worker' => 24 | array ( 25 | 'pretty_version' => 'dev-master', 26 | 'version' => 'dev-master', 27 | 'aliases' => 28 | array ( 29 | ), 30 | 'reference' => 'e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6', 31 | ), 32 | ), 33 | ); 34 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Helper/functions.php: -------------------------------------------------------------------------------- 1 | make($a); 22 | } 23 | } 24 | if (!function_exists('p')) { 25 | /** 26 | * @param [type] $a [description] 27 | * @return Application 28 | */ 29 | function p($message, $description = null) 30 | { 31 | Log::p($message, $description); 32 | } 33 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Helper/functions.php: -------------------------------------------------------------------------------- 1 | make($a); 22 | } 23 | } 24 | if (!function_exists('p')) { 25 | /** 26 | * @param [type] $a [description] 27 | * @return Application 28 | */ 29 | function p($message, $description = null) 30 | { 31 | Log::p($message, $description); 32 | } 33 | } -------------------------------------------------------------------------------- /micro/order/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => '1.0.0+no-version-set', 5 | 'version' => '1.0.0.0', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => NULL, 10 | 'name' => 'lwphp/frame-s', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/frame-s' => 15 | array ( 16 | 'pretty_version' => '1.0.0+no-version-set', 17 | 'version' => '1.0.0.0', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => NULL, 22 | ), 23 | 'lwphp/swo-worker' => 24 | array ( 25 | 'pretty_version' => 'dev-master', 26 | 'version' => 'dev-master', 27 | 'aliases' => 28 | array ( 29 | ), 30 | 'reference' => 'e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6', 31 | ), 32 | ), 33 | ); 34 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => '1.0.0+no-version-set', 5 | 'version' => '1.0.0.0', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => NULL, 10 | 'name' => 'lwphp/frame-s', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/frame-s' => 15 | array ( 16 | 'pretty_version' => '1.0.0+no-version-set', 17 | 'version' => '1.0.0.0', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => NULL, 22 | ), 23 | 'lwphp/swo-worker' => 24 | array ( 25 | 'pretty_version' => 'dev-master', 26 | 'version' => 'dev-master', 27 | 'aliases' => 28 | array ( 29 | ), 30 | 'reference' => 'e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6', 31 | ), 32 | ), 33 | ); 34 | -------------------------------------------------------------------------------- /swoWorker/src/Server/WebSocket/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Websocket\Server($this->host, $this->port); 17 | } 18 | protected function initEvents() 19 | { 20 | $this->serverEvents['sub'] = [ 21 | 'message' => 'onMessage' 22 | ]; 23 | } 24 | protected function initConfig() 25 | { 26 | 27 | } 28 | 29 | public function onMessage(Swoole\WebSocket\Server $server, $frame) 30 | { 31 | p($this->app->make("config")->get("app"),"config info"); 32 | 33 | $server->send('success'); 34 | } 35 | } -------------------------------------------------------------------------------- /micro/goods/app/Http/Controller/IndexController.php: -------------------------------------------------------------------------------- 1 | test(); 22 | p($result, "rpc return"); 23 | return $result; 24 | } 25 | 26 | public function rpcClient2() 27 | { 28 | $result = (new TestClient())->hello(); 29 | return $result; 30 | } 31 | 32 | public function getService() 33 | { 34 | $agent = app('consul_agent')->getService('order'); 35 | p($agent, '服务返回结果'); 36 | return $agent; 37 | } 38 | } -------------------------------------------------------------------------------- /micro/order/app/Http/Controller/IndexController.php: -------------------------------------------------------------------------------- 1 | test(); 22 | p($result, "rpc return"); 23 | return $result; 24 | } 25 | 26 | public function rpcClient2() 27 | { 28 | $result = (new TestClient())->hello(); 29 | return $result; 30 | } 31 | 32 | public function getService() 33 | { 34 | $agent = app('consul_agent')->getService('order'); 35 | p($agent, '服务返回结果'); 36 | return $agent; 37 | } 38 | } -------------------------------------------------------------------------------- /swoWorker/src/Database/Pool.php: -------------------------------------------------------------------------------- 1 | pool = new PDOPool((new PDOConfig) 20 | ->withHost($config['host']) 21 | ->withPort($config['port']) 22 | ->withDbName($config['dbname']) 23 | ->withCharset($config['charset']) 24 | ->withUsername($config['username']) 25 | ->withPassword($config['password']), 26 | $config['pool']['size'] 27 | ); 28 | } 29 | 30 | public function getPool() 31 | { 32 | return $this->pool; 33 | } 34 | } -------------------------------------------------------------------------------- /micro/activities/app/Http/Controller/IndexController.php: -------------------------------------------------------------------------------- 1 | test(); 22 | p($result, "rpc return"); 23 | return $result; 24 | } 25 | 26 | public function rpcClient2() 27 | { 28 | $result = (new TestClient())->hello(); 29 | return $result; 30 | } 31 | 32 | public function getService() 33 | { 34 | $agent = app('consul_agent')->getService('order'); 35 | p($agent, '服务返回结果'); 36 | return $agent; 37 | } 38 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Server/WebSocket/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Websocket\Server($this->host, $this->port); 17 | } 18 | protected function initEvents() 19 | { 20 | $this->serverEvents['sub'] = [ 21 | 'message' => 'onMessage' 22 | ]; 23 | } 24 | protected function initConfig() 25 | { 26 | 27 | } 28 | 29 | public function onMessage(Swoole\WebSocket\Server $server, $frame) 30 | { 31 | p($this->app->make("config")->get("app"),"config info"); 32 | 33 | $server->send('success'); 34 | } 35 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Server/WebSocket/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Websocket\Server($this->host, $this->port); 17 | } 18 | protected function initEvents() 19 | { 20 | $this->serverEvents['sub'] = [ 21 | 'message' => 'onMessage' 22 | ]; 23 | } 24 | protected function initConfig() 25 | { 26 | 27 | } 28 | 29 | public function onMessage(Swoole\WebSocket\Server $server, $frame) 30 | { 31 | p($this->app->make("config")->get("app"),"config info"); 32 | 33 | $server->send('success'); 34 | } 35 | } -------------------------------------------------------------------------------- /micro/goods/vendor/composer/installed.php: -------------------------------------------------------------------------------- 1 | 3 | array ( 4 | 'pretty_version' => 'dev-master', 5 | 'version' => 'dev-master', 6 | 'aliases' => 7 | array ( 8 | ), 9 | 'reference' => '2077c8e7086e02f4aef4a69074545b72fd3697d9', 10 | 'name' => 'lwphp/frame-s', 11 | ), 12 | 'versions' => 13 | array ( 14 | 'lwphp/frame-s' => 15 | array ( 16 | 'pretty_version' => 'dev-master', 17 | 'version' => 'dev-master', 18 | 'aliases' => 19 | array ( 20 | ), 21 | 'reference' => '2077c8e7086e02f4aef4a69074545b72fd3697d9', 22 | ), 23 | 'lwphp/swo-worker' => 24 | array ( 25 | 'pretty_version' => 'dev-master', 26 | 'version' => 'dev-master', 27 | 'aliases' => 28 | array ( 29 | ), 30 | 'reference' => 'e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6', 31 | ), 32 | ), 33 | ); 34 | -------------------------------------------------------------------------------- /swoWorker/src/Rpc/Proxy.php: -------------------------------------------------------------------------------- 1 | services = $services; 16 | } 17 | 18 | public function getServiceList($service) 19 | { 20 | if (is_array($this->services)) { 21 | return $this->services[$service]; 22 | } elseif ($this->services instanceof \Closure) { 23 | return ($this->services)($service); 24 | } else { 25 | return app('config')->get('service.'.$service); 26 | } 27 | } 28 | 29 | public function selectService($myservice) 30 | { 31 | $serviceList = $this->getServiceList($myservice); 32 | return $serviceList[array_rand($serviceList, 1)]; 33 | } 34 | } -------------------------------------------------------------------------------- /frameS/app/Providers/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = function ($service) { 21 | $serviceList = $this->app->make('consul_agent')->getService($service)->getResult(); 22 | $services = []; 23 | foreach ($serviceList as $service) { 24 | $services[] = [ 25 | 'host' => $service['Service']['Address'], 26 | 'port' => $service['Service']['Port'], 27 | ]; 28 | } 29 | 30 | return $services; 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /micro/order/app/Providers/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = function ($service) { 21 | $serviceList = $this->app->make('consul_agent')->getService($service)->getResult(); 22 | $services = []; 23 | foreach ($serviceList as $service) { 24 | $services[] = [ 25 | 'host' => $service['Service']['Address'], 26 | 'port' => $service['Service']['Port'], 27 | ]; 28 | } 29 | 30 | return $services; 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Rpc/Proxy.php: -------------------------------------------------------------------------------- 1 | services = $services; 16 | } 17 | 18 | public function getServiceList($service) 19 | { 20 | if (is_array($this->services)) { 21 | return $this->services[$service]; 22 | } elseif ($this->services instanceof \Closure) { 23 | return ($this->services)($service); 24 | } else { 25 | return app('config')->get('service.'.$service); 26 | } 27 | } 28 | 29 | public function selectService($myservice) 30 | { 31 | $serviceList = $this->getServiceList($myservice); 32 | return $serviceList[array_rand($serviceList, 1)]; 33 | } 34 | } -------------------------------------------------------------------------------- /micro/activities/app/Providers/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = function ($service) { 21 | $serviceList = $this->app->make('consul_agent')->getService($service)->getResult(); 22 | $services = []; 23 | foreach ($serviceList as $service) { 24 | $services[] = [ 25 | 'host' => $service['Service']['Address'], 26 | 'port' => $service['Service']['Port'], 27 | ]; 28 | } 29 | 30 | return $services; 31 | }; 32 | } 33 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Rpc/Proxy.php: -------------------------------------------------------------------------------- 1 | services = $services; 16 | } 17 | 18 | public function getServiceList($service) 19 | { 20 | if (is_array($this->services)) { 21 | return $this->services[$service]; 22 | } elseif ($this->services instanceof \Closure) { 23 | return ($this->services)($service); 24 | } else { 25 | return app('config')->get('service.'.$service); 26 | } 27 | } 28 | 29 | public function selectService($myservice) 30 | { 31 | $serviceList = $this->getServiceList($myservice); 32 | return $serviceList[array_rand($serviceList, 1)]; 33 | } 34 | } -------------------------------------------------------------------------------- /frameS/app/Http/Controller/IndexController.php: -------------------------------------------------------------------------------- 1 | test(); 24 | p($result, "rpc return"); 25 | return $result; 26 | } 27 | 28 | public function rpcClient2() 29 | { 30 | $result = (new TestClient())->hello(); 31 | return $result; 32 | } 33 | 34 | public function getService() 35 | { 36 | $agent = app('consul_agent')->getService('order'); 37 | p($agent, '服务返回结果'); 38 | return $agent; 39 | } 40 | } -------------------------------------------------------------------------------- /swoWorker/src/Database/DB.php: -------------------------------------------------------------------------------- 1 | get('database'); 28 | // $dbConfig = $config[$config['driver']]; 29 | // $db = new Mysql($dbConfig); 30 | $result = $db->{$method}(...$args); 31 | $chan->push($result); 32 | }); 33 | return $chan->pop(); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /micro/order/config/consul.php: -------------------------------------------------------------------------------- 1 | [ 27 | [ 28 | 'ID' => 'order_1', 29 | 'Name' => 'order', 30 | 'Tags' => ['xdp-\/core.order'], 31 | 'Address' => '192.168.56.102', 32 | 'Port' => 9801, 33 | 'Check' => [ 34 | 'name' => 'order_1.check', 35 | 'tcp' => '192.168.56.102:9801', 36 | 'interval' => '10s', 37 | 'timeout' => '2s' 38 | ] 39 | ], 40 | ], 41 | ]; -------------------------------------------------------------------------------- /micro/goods/app/Providers/RpcServiceProvider.php: -------------------------------------------------------------------------------- 1 | services = function ($service) { 21 | $serviceList = $this->app->make('consul_agent')->getService($service)->getResult(); 22 | $services = []; 23 | p($serviceList, "发现服务".$service); 24 | foreach ($serviceList as $service) { 25 | $services[] = [ 26 | 'host' => $service['Service']['Address'], 27 | 'port' => $service['Service']['Port'], 28 | ]; 29 | } 30 | 31 | return $services; 32 | }; 33 | } 34 | } -------------------------------------------------------------------------------- /micro/activities/config/consul.php: -------------------------------------------------------------------------------- 1 | [ 27 | [ 28 | 'ID' => 'activities_1', 29 | 'Name' => 'activities', 30 | 'Tags' => ['xdp-\/core.order'], 31 | 'Address' => '192.168.56.102', 32 | 'Port' => 9701, 33 | 'Check' => [ 34 | 'name' => 'activities_1.check', 35 | 'tcp' => '192.168.56.102:9701', 36 | 'interval' => '10s', 37 | 'timeout' => '2s' 38 | ] 39 | ], 40 | ], 41 | ]; -------------------------------------------------------------------------------- /frameS/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | setHttpRoute(); 17 | parent::register(); // TODO: Change the autogenerated stub 18 | } 19 | 20 | public function setHttpRoute() 21 | { 22 | $this->map['http'] = [ 23 | 'namespace' => 'app\Http\Controller', 24 | 'path' => $this->app->getBasePath().'/route/http.php' 25 | ]; 26 | } 27 | 28 | public function setWebsocketRoute() 29 | { 30 | $this->map["websocket"] = [ 31 | 'namespace' => 'app\WebSocket\Controller', 32 | 'path' => $this->app->getBasePath().'/route/websocket.php' 33 | ]; 34 | } 35 | } -------------------------------------------------------------------------------- /frameS/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "lwphp/swo-worker", 4 | "version": "dev-master", 5 | "version_normalized": "9999999-dev", 6 | "dist": { 7 | "type": "path", 8 | "url": "../swoWorker", 9 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 10 | }, 11 | "type": "library", 12 | "installation-source": "dist", 13 | "autoload": { 14 | "psr-4": { 15 | "SwoWorker\\": "./src/" 16 | }, 17 | "files": [ 18 | "src/Helper/functions.php" 19 | ] 20 | }, 21 | "license": [ 22 | "MIT" 23 | ], 24 | "authors": [ 25 | { 26 | "name": "liwei", 27 | "email": "liweiphp@163.com" 28 | } 29 | ], 30 | "description": "swoole worker", 31 | "transport-options": { 32 | "relative": true 33 | } 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "lwphp/swo-worker", 4 | "version": "dev-master", 5 | "version_normalized": "9999999-dev", 6 | "dist": { 7 | "type": "path", 8 | "url": "../swoWorker", 9 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 10 | }, 11 | "type": "library", 12 | "installation-source": "dist", 13 | "autoload": { 14 | "psr-4": { 15 | "SwoWorker\\": "./src/" 16 | }, 17 | "files": [ 18 | "src/Helper/functions.php" 19 | ] 20 | }, 21 | "license": [ 22 | "MIT" 23 | ], 24 | "authors": [ 25 | { 26 | "name": "liwei", 27 | "email": "liweiphp@163.com" 28 | } 29 | ], 30 | "description": "swoole worker", 31 | "transport-options": { 32 | "relative": true 33 | } 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /swoWorker/src/Helper/functions.php: -------------------------------------------------------------------------------- 1 | make($a); 22 | } 23 | } 24 | if (!function_exists('p')) { 25 | /** 26 | * @param [type] $a [description] 27 | * @return Application 28 | */ 29 | function p($message, $description = null) 30 | { 31 | Log::p($message, $description); 32 | } 33 | } 34 | 35 | if (!function_exists('base_path')) { 36 | /** 37 | * 返回工作目录 38 | */ 39 | function file_path($path) 40 | { 41 | return app()->getBasePath().($path ? DIRECTORY_SEPARATOR.$path : $path); 42 | } 43 | } -------------------------------------------------------------------------------- /swoWorker/src/Consul/Agent.php: -------------------------------------------------------------------------------- 1 | consul = $consul; 19 | } 20 | 21 | 22 | public function getService($service) 23 | { 24 | p("发现服务"); 25 | $services = $this->consul->get('/v1/health/service/'.$service.'?passing=true'); 26 | return $services; 27 | } 28 | 29 | /** 30 | * @param array $service 31 | */ 32 | public function registerService(array $service) 33 | { 34 | return $this->consul->put('/v1/agent/service/register', $service); 35 | } 36 | 37 | /** 38 | * @param string $serviceId 39 | 40 | */ 41 | public function deregisterService(string $serviceId) 42 | { 43 | return $this->consul->put('/v1/agent/service/deregister/' . $serviceId); 44 | } 45 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Consul/Agent.php: -------------------------------------------------------------------------------- 1 | consul = $consul; 19 | } 20 | 21 | 22 | public function getService($service) 23 | { 24 | p("发现服务"); 25 | $services = $this->consul->get('/v1/health/service/'.$service.'?passing=true'); 26 | return $services; 27 | } 28 | 29 | /** 30 | * @param array $service 31 | */ 32 | public function registerService(array $service) 33 | { 34 | return $this->consul->put('/v1/agent/service/register', $service); 35 | } 36 | 37 | /** 38 | * @param string $serviceId 39 | 40 | */ 41 | public function deregisterService(string $serviceId) 42 | { 43 | return $this->consul->put('/v1/agent/service/deregister/' . $serviceId); 44 | } 45 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Consul/Agent.php: -------------------------------------------------------------------------------- 1 | consul = $consul; 19 | } 20 | 21 | 22 | public function getService($service) 23 | { 24 | p("发现服务"); 25 | $services = $this->consul->get('/v1/health/service/'.$service.'?passing=true'); 26 | return $services; 27 | } 28 | 29 | /** 30 | * @param array $service 31 | */ 32 | public function registerService(array $service) 33 | { 34 | return $this->consul->put('/v1/agent/service/register', $service); 35 | } 36 | 37 | /** 38 | * @param string $serviceId 39 | 40 | */ 41 | public function deregisterService(string $serviceId) 42 | { 43 | return $this->consul->put('/v1/agent/service/deregister/' . $serviceId); 44 | } 45 | } -------------------------------------------------------------------------------- /swoWorker/src/Consul/ConsulServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->make('config')->get('server.consul'); 19 | $this->app->bind('consul_agent', new Agent(new Consul($config))); 20 | $this->app->bind('consul_response', new Response()); 21 | } 22 | 23 | public function boot() 24 | { 25 | // TODO: Implement boot() method. 26 | // $config = $this->app->make('config')->get('consul'); 27 | // $agent = $this->app->make('consul_agent'); 28 | // array_map(function ($services) use ($agent){ 29 | // foreach ($services as $service) { 30 | // Coroutine::create([$agent, 'registerService'], $service); 31 | // } 32 | // }, $config); 33 | } 34 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Consul/ConsulServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->make('config')->get('server.consul'); 19 | $this->app->bind('consul_agent', new Agent(new Consul($config))); 20 | $this->app->bind('consul_response', new Response()); 21 | } 22 | 23 | public function boot() 24 | { 25 | // TODO: Implement boot() method. 26 | // $config = $this->app->make('config')->get('consul'); 27 | // $agent = $this->app->make('consul_agent'); 28 | // array_map(function ($services) use ($agent){ 29 | // foreach ($services as $service) { 30 | // Coroutine::create([$agent, 'registerService'], $service); 31 | // } 32 | // }, $config); 33 | } 34 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Consul/ConsulServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->make('config')->get('server.consul'); 19 | $this->app->bind('consul_agent', new Agent(new Consul($config))); 20 | $this->app->bind('consul_response', new Response()); 21 | } 22 | 23 | public function boot() 24 | { 25 | // TODO: Implement boot() method. 26 | // $config = $this->app->make('config')->get('consul'); 27 | // $agent = $this->app->make('consul_agent'); 28 | // array_map(function ($services) use ($agent){ 29 | // foreach ($services as $service) { 30 | // Coroutine::create([$agent, 'registerService'], $service); 31 | // } 32 | // }, $config); 33 | } 34 | } -------------------------------------------------------------------------------- /frameS/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /micro/order/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /swoWorker/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /swoWorker/src/Event/Event.php: -------------------------------------------------------------------------------- 1 | $event) { 18 | if ($flag=='Listner') { 19 | foreach ($event as $key=>$class) { 20 | $listener = new $class(); 21 | $this->register($listener->getName(), [$listener, 'handle']); 22 | } 23 | } 24 | 25 | } 26 | 27 | } 28 | protected function register($key, $callback) 29 | { 30 | $this->events[$key] = [ 31 | 'callback' => $callback 32 | ]; 33 | } 34 | public function trigger($key, $params=null) 35 | { 36 | if (isset($this->events[$key])) { 37 | ($this->events[$key]['callback'])($params); 38 | } else { 39 | p("事件不存在"); 40 | } 41 | return true; 42 | } 43 | 44 | public function getEvents() 45 | { 46 | return $this->events; 47 | } 48 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Event/Event.php: -------------------------------------------------------------------------------- 1 | $event) { 18 | if ($flag=='Listner') { 19 | foreach ($event as $key=>$class) { 20 | $listener = new $class(); 21 | $this->register($listener->getName(), [$listener, 'handle']); 22 | } 23 | } 24 | 25 | } 26 | 27 | } 28 | protected function register($key, $callback) 29 | { 30 | $this->events[$key] = [ 31 | 'callback' => $callback 32 | ]; 33 | } 34 | public function trigger($key, $params=null) 35 | { 36 | if (isset($this->events[$key])) { 37 | ($this->events[$key]['callback'])($params); 38 | } else { 39 | p("事件不存在"); 40 | } 41 | return true; 42 | } 43 | 44 | public function getEvents() 45 | { 46 | return $this->events; 47 | } 48 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Event/Event.php: -------------------------------------------------------------------------------- 1 | $event) { 18 | if ($flag=='Listner') { 19 | foreach ($event as $key=>$class) { 20 | $listener = new $class(); 21 | $this->register($listener->getName(), [$listener, 'handle']); 22 | } 23 | } 24 | 25 | } 26 | 27 | } 28 | protected function register($key, $callback) 29 | { 30 | $this->events[$key] = [ 31 | 'callback' => $callback 32 | ]; 33 | } 34 | public function trigger($key, $params=null) 35 | { 36 | if (isset($this->events[$key])) { 37 | ($this->events[$key]['callback'])($params); 38 | } else { 39 | p("事件不存在"); 40 | } 41 | return true; 42 | } 43 | 44 | public function getEvents() 45 | { 46 | return $this->events; 47 | } 48 | } -------------------------------------------------------------------------------- /swoWorker/src/Rpc/RpcClient.php: -------------------------------------------------------------------------------- 1 | $this->class."::".$method, 22 | 'params' => $params 23 | ]; 24 | $client = new Client(SWOOLE_SOCK_TCP); 25 | // $config = app('config')->get('service.'.$this->service); 26 | $proxy = app('rpc_proxy')->selectService($this->service); 27 | p($proxy, "获取proxy"); 28 | if (!$client->connect($proxy['host'], $proxy['port'], 0.5)) 29 | { 30 | return false; 31 | } 32 | $client->send(Response::send($data)); 33 | $result = $client->recv(5); 34 | $client->close(); 35 | return $result; 36 | } 37 | 38 | public function __call($method, $params) 39 | { 40 | // TODO: Implement __call() method. 41 | return $this->proxy($method, $params); 42 | 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Rpc/RpcClient.php: -------------------------------------------------------------------------------- 1 | $this->class."::".$method, 22 | 'params' => $params 23 | ]; 24 | $client = new Client(SWOOLE_SOCK_TCP); 25 | // $config = app('config')->get('service.'.$this->service); 26 | $proxy = app('rpc_proxy')->selectService($this->service); 27 | p($proxy, "获取proxy"); 28 | if (!$client->connect($proxy['host'], $proxy['port'], 0.5)) 29 | { 30 | return false; 31 | } 32 | $client->send(Response::send($data)); 33 | $result = $client->recv(); 34 | $client->close(); 35 | return $result; 36 | } 37 | 38 | public function __call($method, $params) 39 | { 40 | // TODO: Implement __call() method. 41 | return $this->proxy($method, $params); 42 | 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Rpc/RpcClient.php: -------------------------------------------------------------------------------- 1 | $this->class."::".$method, 22 | 'params' => $params 23 | ]; 24 | $client = new Client(SWOOLE_SOCK_TCP); 25 | // $config = app('config')->get('service.'.$this->service); 26 | $proxy = app('rpc_proxy')->selectService($this->service); 27 | p($proxy, "获取proxy"); 28 | if (!$client->connect($proxy['host'], $proxy['port'], 0.5)) 29 | { 30 | return false; 31 | } 32 | $client->send(Response::send($data)); 33 | $result = $client->recv(); 34 | $client->close(); 35 | return $result; 36 | } 37 | 38 | public function __call($method, $params) 39 | { 40 | // TODO: Implement __call() method. 41 | return $this->proxy($method, $params); 42 | 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /micro/order/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "name": "lwphp/swo-worker", 5 | "version": "dev-master", 6 | "version_normalized": "dev-master", 7 | "dist": { 8 | "type": "path", 9 | "url": "../swoWorker", 10 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 11 | }, 12 | "type": "library", 13 | "installation-source": "dist", 14 | "autoload": { 15 | "psr-4": { 16 | "SwoWorker\\": "./src/" 17 | }, 18 | "files": [ 19 | "src/Helper/functions.php" 20 | ] 21 | }, 22 | "license": [ 23 | "MIT" 24 | ], 25 | "authors": [ 26 | { 27 | "name": "liwei", 28 | "email": "liweiphp@163.com" 29 | } 30 | ], 31 | "description": "swoole worker", 32 | "transport-options": { 33 | "relative": true 34 | }, 35 | "install-path": "../lwphp/swo-worker" 36 | } 37 | ], 38 | "dev": true, 39 | "dev-package-names": [] 40 | } 41 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/installed.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "name": "lwphp/swo-worker", 5 | "version": "dev-master", 6 | "version_normalized": "dev-master", 7 | "dist": { 8 | "type": "path", 9 | "url": "../swoWorker", 10 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 11 | }, 12 | "type": "library", 13 | "installation-source": "dist", 14 | "autoload": { 15 | "psr-4": { 16 | "SwoWorker\\": "./src/" 17 | }, 18 | "files": [ 19 | "src/Helper/functions.php" 20 | ] 21 | }, 22 | "license": [ 23 | "MIT" 24 | ], 25 | "authors": [ 26 | { 27 | "name": "liwei", 28 | "email": "liweiphp@163.com" 29 | } 30 | ], 31 | "description": "swoole worker", 32 | "transport-options": { 33 | "relative": true 34 | }, 35 | "install-path": "../lwphp/swo-worker" 36 | } 37 | ], 38 | "dev": true, 39 | "dev-package-names": [] 40 | } 41 | -------------------------------------------------------------------------------- /swoWorker/src/Config/Config.php: -------------------------------------------------------------------------------- 1 | itmes = $this->phpParser($path); 21 | } 22 | /** 23 | * 读取PHP文件类型的配置文件 24 | */ 25 | protected function phpParser($path) 26 | { 27 | // 1. 找到文件 28 | // 此处跳过多级的情况 29 | $files = scandir($path); 30 | $data = null; 31 | // 2. 读取文件信息 32 | foreach ($files as $key => $file) { 33 | if ($file === '.' || $file === '..') { 34 | continue; 35 | } 36 | // 2.1 获取文件名 37 | $filename = \stristr($file, ".php", true); 38 | // 2.2 读取文件信息 39 | $data[$filename] = include $path."/".$file; 40 | } 41 | // 3. 返回 42 | return $data; 43 | } 44 | // key.key2.key3 45 | /** 46 | * 获取配置 47 | */ 48 | public function get($keys) 49 | { 50 | $data = $this->itmes; 51 | foreach (\explode('.', $keys) as $key => $value) { 52 | $data = $data[$value]; 53 | } 54 | return $data; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /frameS/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/lwphp/swo-worker/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'a' => 15 | array ( 16 | 'app\\' => 4, 17 | ), 18 | 'S' => 19 | array ( 20 | 'SwoWorker\\' => 10, 21 | ), 22 | ); 23 | 24 | public static $prefixDirsPsr4 = array ( 25 | 'app\\' => 26 | array ( 27 | 0 => __DIR__ . '/../..' . '/app', 28 | ), 29 | 'SwoWorker\\' => 30 | array ( 31 | 0 => __DIR__ . '/..' . '/lwphp/swo-worker/src', 32 | ), 33 | ); 34 | 35 | public static function getInitializer(ClassLoader $loader) 36 | { 37 | return \Closure::bind(function () use ($loader) { 38 | $loader->prefixLengthsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixLengthsPsr4; 39 | $loader->prefixDirsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixDirsPsr4; 40 | 41 | }, null, ClassLoader::class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/lwphp/swo-worker/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'a' => 15 | array ( 16 | 'app\\' => 4, 17 | ), 18 | 'S' => 19 | array ( 20 | 'SwoWorker\\' => 10, 21 | ), 22 | ); 23 | 24 | public static $prefixDirsPsr4 = array ( 25 | 'app\\' => 26 | array ( 27 | 0 => __DIR__ . '/../..' . '/app', 28 | ), 29 | 'SwoWorker\\' => 30 | array ( 31 | 0 => __DIR__ . '/..' . '/lwphp/swo-worker/src', 32 | ), 33 | ); 34 | 35 | public static function getInitializer(ClassLoader $loader) 36 | { 37 | return \Closure::bind(function () use ($loader) { 38 | $loader->prefixLengthsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixLengthsPsr4; 39 | $loader->prefixDirsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixDirsPsr4; 40 | 41 | }, null, ClassLoader::class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Config/Config.php: -------------------------------------------------------------------------------- 1 | itmes = $this->phpParser($path); 21 | } 22 | /** 23 | * 读取PHP文件类型的配置文件 24 | */ 25 | protected function phpParser($path) 26 | { 27 | // 1. 找到文件 28 | // 此处跳过多级的情况 29 | $files = scandir($path); 30 | $data = null; 31 | // 2. 读取文件信息 32 | foreach ($files as $key => $file) { 33 | if ($file === '.' || $file === '..') { 34 | continue; 35 | } 36 | // 2.1 获取文件名 37 | $filename = \stristr($file, ".php", true); 38 | // 2.2 读取文件信息 39 | $data[$filename] = include $path."/".$file; 40 | } 41 | // 3. 返回 42 | return $data; 43 | } 44 | // key.key2.key3 45 | /** 46 | * 获取配置 47 | */ 48 | public function get($keys) 49 | { 50 | $data = $this->itmes; 51 | foreach (\explode('.', $keys) as $key => $value) { 52 | $data = $data[$value]; 53 | } 54 | return $data; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Config/Config.php: -------------------------------------------------------------------------------- 1 | itmes = $this->phpParser($path); 21 | } 22 | /** 23 | * 读取PHP文件类型的配置文件 24 | */ 25 | protected function phpParser($path) 26 | { 27 | // 1. 找到文件 28 | // 此处跳过多级的情况 29 | $files = scandir($path); 30 | $data = null; 31 | // 2. 读取文件信息 32 | foreach ($files as $key => $file) { 33 | if ($file === '.' || $file === '..') { 34 | continue; 35 | } 36 | // 2.1 获取文件名 37 | $filename = \stristr($file, ".php", true); 38 | // 2.2 读取文件信息 39 | $data[$filename] = include $path."/".$file; 40 | } 41 | // 3. 返回 42 | return $data; 43 | } 44 | // key.key2.key3 45 | /** 46 | * 获取配置 47 | */ 48 | public function get($keys) 49 | { 50 | $data = $this->itmes; 51 | foreach (\explode('.', $keys) as $key => $value) { 52 | $data = $data[$value]; 53 | } 54 | return $data; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /swoWorker/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../..' . '/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'S' => 15 | array ( 16 | 'SwoWorker\\' => 10, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'SwoWorker\\' => 22 | array ( 23 | 0 => __DIR__ . '/../..' . '/src', 24 | ), 25 | ); 26 | 27 | public static $classMap = array ( 28 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixDirsPsr4; 36 | $loader->classMap = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$classMap; 37 | 38 | }, null, ClassLoader::class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /micro/goods/app/Http/Controller/DetailController.php: -------------------------------------------------------------------------------- 1 | 'our goods info' 23 | ]; 24 | // $chan = new Channel(2); 25 | // $wg = new \Swoole\Coroutine\WaitGroup(); 26 | $barrier = Barrier::make(); 27 | // $wg->add(); 28 | go(function() use ($barrier, &$result) { 29 | $result += json_decode((new OrderClient())->getInfo(), true); 30 | // $wg->done(); 31 | }); 32 | // $wg->add(); 33 | go(function() use ($barrier, &$result) { 34 | $result += json_decode((new ActivitiesClient())->getInfo(), true); 35 | // $wg->done(); 36 | }); 37 | 38 | // for ($i = 0; $i < 2; $i++) 39 | // { 40 | // $result += $chan->pop(); 41 | // } 42 | // $wg->wait(); 43 | Barrier::wait($barrier); 44 | $end = time(); 45 | $result['takeTime'] = $end-$start; 46 | return $result; 47 | } 48 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../..' . '/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'S' => 15 | array ( 16 | 'SwoWorker\\' => 10, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'SwoWorker\\' => 22 | array ( 23 | 0 => __DIR__ . '/../..' . '/src', 24 | ), 25 | ); 26 | 27 | public static $classMap = array ( 28 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixDirsPsr4; 36 | $loader->classMap = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$classMap; 37 | 38 | }, null, ClassLoader::class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/../..' . '/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'S' => 15 | array ( 16 | 'SwoWorker\\' => 10, 17 | ), 18 | ); 19 | 20 | public static $prefixDirsPsr4 = array ( 21 | 'SwoWorker\\' => 22 | array ( 23 | 0 => __DIR__ . '/../..' . '/src', 24 | ), 25 | ); 26 | 27 | public static $classMap = array ( 28 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 29 | ); 30 | 31 | public static function getInitializer(ClassLoader $loader) 32 | { 33 | return \Closure::bind(function () use ($loader) { 34 | $loader->prefixLengthsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixLengthsPsr4; 35 | $loader->prefixDirsPsr4 = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$prefixDirsPsr4; 36 | $loader->classMap = ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$classMap; 37 | 38 | }, null, ClassLoader::class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /swoWorker/src/Server/Http/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Http\Server($this->host, $this->port); 20 | } 21 | protected function initEvents() 22 | { 23 | $this->serverEvents['sub'] = [ 24 | 'request' => 'onRequest' 25 | ]; 26 | } 27 | protected function initConfig() 28 | { 29 | 30 | } 31 | 32 | /** 33 | * request回调事件 34 | * @param \Swoole\Http\Request $request 35 | * @param \Swoole\Http\Response $response 36 | * @throws \Exception 37 | */ 38 | public function onRequest(\Swoole\Http\Request $request, \Swoole\Http\Response $response) 39 | { 40 | 41 | //请求ico文件时候 直接返回空 42 | if ($request->server['path_info'] == '/favicon.ico' || $request->server['request_uri'] == '/favicon.ico'){ 43 | $response->end(); 44 | return ; 45 | } 46 | 47 | $httpRequest = Request::getInstance()->init($request); 48 | $data = Route::getInstance()->match('http', $httpRequest); 49 | $response->end(Response::send($data)); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Server/Http/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Http\Server($this->host, $this->port); 19 | } 20 | protected function initEvents() 21 | { 22 | $this->serverEvents['sub'] = [ 23 | 'request' => 'onRequest' 24 | ]; 25 | } 26 | protected function initConfig() 27 | { 28 | 29 | } 30 | 31 | /** 32 | * request回调事件 33 | * @param \Swoole\Http\Request $request 34 | * @param \Swoole\Http\Response $response 35 | * @throws \Exception 36 | */ 37 | public function onRequest(\Swoole\Http\Request $request, \Swoole\Http\Response $response) 38 | { 39 | 40 | //请求ico文件时候 直接返回空 41 | if ($request->server['path_info'] == '/favicon.ico' || $request->server['request_uri'] == '/favicon.ico'){ 42 | $response->end(); 43 | return ; 44 | } 45 | 46 | $httpRequest = Request::getInstance()->init($request); 47 | $data = Route::getInstance()->match('http', $httpRequest); 48 | 49 | p($this->app->make("config")->get("app"),"config info"); 50 | $response->end($data); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Server/Http/Server.php: -------------------------------------------------------------------------------- 1 | swooleServer = new \Swoole\Http\Server($this->host, $this->port); 19 | } 20 | protected function initEvents() 21 | { 22 | $this->serverEvents['sub'] = [ 23 | 'request' => 'onRequest' 24 | ]; 25 | } 26 | protected function initConfig() 27 | { 28 | 29 | } 30 | 31 | /** 32 | * request回调事件 33 | * @param \Swoole\Http\Request $request 34 | * @param \Swoole\Http\Response $response 35 | * @throws \Exception 36 | */ 37 | public function onRequest(\Swoole\Http\Request $request, \Swoole\Http\Response $response) 38 | { 39 | 40 | //请求ico文件时候 直接返回空 41 | if ($request->server['path_info'] == '/favicon.ico' || $request->server['request_uri'] == '/favicon.ico'){ 42 | $response->end(); 43 | return ; 44 | } 45 | 46 | $httpRequest = Request::getInstance()->init($request); 47 | $data = Route::getInstance()->match('http', $httpRequest); 48 | 49 | p($this->app->make("config")->get("app"),"config info"); 50 | $response->end($data); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /micro/order/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/lwphp/swo-worker/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'a' => 15 | array ( 16 | 'app\\' => 4, 17 | ), 18 | 'S' => 19 | array ( 20 | 'SwoWorker\\' => 10, 21 | ), 22 | ); 23 | 24 | public static $prefixDirsPsr4 = array ( 25 | 'app\\' => 26 | array ( 27 | 0 => __DIR__ . '/../..' . '/app', 28 | ), 29 | 'SwoWorker\\' => 30 | array ( 31 | 0 => __DIR__ . '/..' . '/lwphp/swo-worker/src', 32 | ), 33 | ); 34 | 35 | public static $classMap = array ( 36 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 37 | ); 38 | 39 | public static function getInitializer(ClassLoader $loader) 40 | { 41 | return \Closure::bind(function () use ($loader) { 42 | $loader->prefixLengthsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixLengthsPsr4; 43 | $loader->prefixDirsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixDirsPsr4; 44 | $loader->classMap = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$classMap; 45 | 46 | }, null, ClassLoader::class); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/lwphp/swo-worker/src/Helper/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'a' => 15 | array ( 16 | 'app\\' => 4, 17 | ), 18 | 'S' => 19 | array ( 20 | 'SwoWorker\\' => 10, 21 | ), 22 | ); 23 | 24 | public static $prefixDirsPsr4 = array ( 25 | 'app\\' => 26 | array ( 27 | 0 => __DIR__ . '/../..' . '/app', 28 | ), 29 | 'SwoWorker\\' => 30 | array ( 31 | 0 => __DIR__ . '/..' . '/lwphp/swo-worker/src', 32 | ), 33 | ); 34 | 35 | public static $classMap = array ( 36 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 37 | ); 38 | 39 | public static function getInitializer(ClassLoader $loader) 40 | { 41 | return \Closure::bind(function () use ($loader) { 42 | $loader->prefixLengthsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixLengthsPsr4; 43 | $loader->prefixDirsPsr4 = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$prefixDirsPsr4; 44 | $loader->classMap = ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$classMap; 45 | 46 | }, null, ClassLoader::class); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /swoWorker/src/Container/Container.php: -------------------------------------------------------------------------------- 1 | bindings[$abstract] = $object; 17 | 18 | } 19 | 20 | public function make($abstract, $parameters = []) 21 | { 22 | if (isset($this->instances[$abstract])) { 23 | return $this->instances[$abstract]; 24 | } 25 | 26 | if (!$this->has($abstract)) { 27 | throw new \Exception('没有找到这个容器对象'.$abstract, 500); 28 | } 29 | 30 | $object = $this->bindings[$abstract]; 31 | // 在这个容器中是否存在 32 | // 1. 判断是否一个为对象 33 | // 2. 闭包的方式 34 | if ($object instanceof \Closure) { 35 | return $object(); 36 | } 37 | 38 | // 3. 类对象的字符串 (类的地址) 39 | return $this->instances[$abstract] = (is_object($object)) ? $object : new $object(...$parameters) ; 40 | } 41 | 42 | public function has($abstract) 43 | { 44 | return isset($this->bindings[$abstract]); 45 | } 46 | /** 47 | * 单例 48 | */ 49 | public static function getInstance() 50 | { 51 | if (is_null(static::$instance)) { 52 | static::$instance = new static; 53 | } 54 | 55 | return static::$instance; 56 | } 57 | 58 | public static function setInstance($container = null) 59 | { 60 | return static::$instance = $container; 61 | } 62 | } -------------------------------------------------------------------------------- /swoWorker/src/Consul/Response.php: -------------------------------------------------------------------------------- 1 | body = $body; 40 | $self->status = $status; 41 | $self->headers = $headers; 42 | 43 | return $self; 44 | } 45 | 46 | /** 47 | * @return array 48 | */ 49 | public function getHeaders(): array 50 | { 51 | return $this->headers; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getBody(): string 58 | { 59 | return $this->body; 60 | } 61 | 62 | /** 63 | * @return int 64 | */ 65 | public function getStatusCode(): int 66 | { 67 | return $this->status; 68 | } 69 | 70 | /** 71 | * @return array|mixed 72 | */ 73 | public function getResult() 74 | { 75 | if (empty($this->body)) { 76 | return $this->body; 77 | } 78 | 79 | return json_decode($this->body, true); 80 | } 81 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Container/Container.php: -------------------------------------------------------------------------------- 1 | bindings[$abstract] = $object; 17 | 18 | } 19 | 20 | public function make($abstract, $parameters = []) 21 | { 22 | if (isset($this->instances[$abstract])) { 23 | return $this->instances[$abstract]; 24 | } 25 | 26 | if (!$this->has($abstract)) { 27 | throw new \Exception('没有找到这个容器对象'.$abstract, 500); 28 | } 29 | 30 | $object = $this->bindings[$abstract]; 31 | // 在这个容器中是否存在 32 | // 1. 判断是否一个为对象 33 | // 2. 闭包的方式 34 | if ($object instanceof \Closure) { 35 | return $object(); 36 | } 37 | 38 | // 3. 类对象的字符串 (类的地址) 39 | return $this->instances[$abstract] = (is_object($object)) ? $object : new $object(...$parameters) ; 40 | } 41 | 42 | public function has($abstract) 43 | { 44 | return isset($this->bindings[$abstract]); 45 | } 46 | /** 47 | * 单例 48 | */ 49 | public static function getInstance() 50 | { 51 | if (is_null(static::$instance)) { 52 | static::$instance = new static; 53 | } 54 | 55 | return static::$instance; 56 | } 57 | 58 | public static function setInstance($container = null) 59 | { 60 | return static::$instance = $container; 61 | } 62 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Container/Container.php: -------------------------------------------------------------------------------- 1 | bindings[$abstract] = $object; 17 | 18 | } 19 | 20 | public function make($abstract, $parameters = []) 21 | { 22 | if (isset($this->instances[$abstract])) { 23 | return $this->instances[$abstract]; 24 | } 25 | 26 | if (!$this->has($abstract)) { 27 | throw new \Exception('没有找到这个容器对象'.$abstract, 500); 28 | } 29 | 30 | $object = $this->bindings[$abstract]; 31 | // 在这个容器中是否存在 32 | // 1. 判断是否一个为对象 33 | // 2. 闭包的方式 34 | if ($object instanceof \Closure) { 35 | return $object(); 36 | } 37 | 38 | // 3. 类对象的字符串 (类的地址) 39 | return $this->instances[$abstract] = (is_object($object)) ? $object : new $object(...$parameters) ; 40 | } 41 | 42 | public function has($abstract) 43 | { 44 | return isset($this->bindings[$abstract]); 45 | } 46 | /** 47 | * 单例 48 | */ 49 | public static function getInstance() 50 | { 51 | if (is_null(static::$instance)) { 52 | static::$instance = new static; 53 | } 54 | 55 | return static::$instance; 56 | } 57 | 58 | public static function setInstance($container = null) 59 | { 60 | return static::$instance = $container; 61 | } 62 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Consul/Response.php: -------------------------------------------------------------------------------- 1 | body = $body; 40 | $self->status = $status; 41 | $self->headers = $headers; 42 | 43 | return $self; 44 | } 45 | 46 | /** 47 | * @return array 48 | */ 49 | public function getHeaders(): array 50 | { 51 | return $this->headers; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getBody(): string 58 | { 59 | return $this->body; 60 | } 61 | 62 | /** 63 | * @return int 64 | */ 65 | public function getStatusCode(): int 66 | { 67 | return $this->status; 68 | } 69 | 70 | /** 71 | * @return array|mixed 72 | */ 73 | public function getResult() 74 | { 75 | if (empty($this->body)) { 76 | return $this->body; 77 | } 78 | 79 | return json_decode($this->body, true); 80 | } 81 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Consul/Response.php: -------------------------------------------------------------------------------- 1 | body = $body; 40 | $self->status = $status; 41 | $self->headers = $headers; 42 | 43 | return $self; 44 | } 45 | 46 | /** 47 | * @return array 48 | */ 49 | public function getHeaders(): array 50 | { 51 | return $this->headers; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getBody(): string 58 | { 59 | return $this->body; 60 | } 61 | 62 | /** 63 | * @return int 64 | */ 65 | public function getStatusCode(): int 66 | { 67 | return $this->status; 68 | } 69 | 70 | /** 71 | * @return array|mixed 72 | */ 73 | public function getResult() 74 | { 75 | if (empty($this->body)) { 76 | return $this->body; 77 | } 78 | 79 | return json_decode($this->body, true); 80 | } 81 | } -------------------------------------------------------------------------------- /frameS/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "ed7ba8654fc750ac3d069c79ed8b8e59", 8 | "packages": [ 9 | { 10 | "name": "lwphp/swo-worker", 11 | "version": "dev-master", 12 | "dist": { 13 | "type": "path", 14 | "url": "../swoWorker", 15 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 16 | }, 17 | "type": "library", 18 | "autoload": { 19 | "psr-4": { 20 | "SwoWorker\\": "./src/" 21 | }, 22 | "files": [ 23 | "src/Helper/functions.php" 24 | ] 25 | }, 26 | "license": [ 27 | "MIT" 28 | ], 29 | "authors": [ 30 | { 31 | "name": "liwei", 32 | "email": "liweiphp@163.com" 33 | } 34 | ], 35 | "description": "swoole worker", 36 | "transport-options": { 37 | "relative": true 38 | } 39 | } 40 | ], 41 | "packages-dev": [], 42 | "aliases": [], 43 | "minimum-stability": "stable", 44 | "stability-flags": { 45 | "lwphp/swo-worker": 20 46 | }, 47 | "prefer-stable": false, 48 | "prefer-lowest": false, 49 | "platform": [], 50 | "platform-dev": [], 51 | "plugin-api-version": "2.0.0" 52 | } 53 | -------------------------------------------------------------------------------- /micro/goods/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "ed7ba8654fc750ac3d069c79ed8b8e59", 8 | "packages": [ 9 | { 10 | "name": "lwphp/swo-worker", 11 | "version": "dev-master", 12 | "dist": { 13 | "type": "path", 14 | "url": "../swoWorker", 15 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 16 | }, 17 | "type": "library", 18 | "autoload": { 19 | "psr-4": { 20 | "SwoWorker\\": "./src/" 21 | }, 22 | "files": [ 23 | "src/Helper/functions.php" 24 | ] 25 | }, 26 | "license": [ 27 | "MIT" 28 | ], 29 | "authors": [ 30 | { 31 | "name": "liwei", 32 | "email": "liweiphp@163.com" 33 | } 34 | ], 35 | "description": "swoole worker", 36 | "transport-options": { 37 | "relative": true 38 | } 39 | } 40 | ], 41 | "packages-dev": [], 42 | "aliases": [], 43 | "minimum-stability": "stable", 44 | "stability-flags": { 45 | "lwphp/swo-worker": 20 46 | }, 47 | "prefer-stable": false, 48 | "prefer-lowest": false, 49 | "platform": [], 50 | "platform-dev": [], 51 | "plugin-api-version": "1.1.0" 52 | } 53 | -------------------------------------------------------------------------------- /micro/order/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "ed7ba8654fc750ac3d069c79ed8b8e59", 8 | "packages": [ 9 | { 10 | "name": "lwphp/swo-worker", 11 | "version": "dev-master", 12 | "dist": { 13 | "type": "path", 14 | "url": "../swoWorker", 15 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 16 | }, 17 | "type": "library", 18 | "autoload": { 19 | "psr-4": { 20 | "SwoWorker\\": "./src/" 21 | }, 22 | "files": [ 23 | "src/Helper/functions.php" 24 | ] 25 | }, 26 | "license": [ 27 | "MIT" 28 | ], 29 | "authors": [ 30 | { 31 | "name": "liwei", 32 | "email": "liweiphp@163.com" 33 | } 34 | ], 35 | "description": "swoole worker", 36 | "transport-options": { 37 | "relative": true 38 | } 39 | } 40 | ], 41 | "packages-dev": [], 42 | "aliases": [], 43 | "minimum-stability": "stable", 44 | "stability-flags": { 45 | "lwphp/swo-worker": 20 46 | }, 47 | "prefer-stable": false, 48 | "prefer-lowest": false, 49 | "platform": [], 50 | "platform-dev": [], 51 | "plugin-api-version": "2.0.0" 52 | } 53 | -------------------------------------------------------------------------------- /micro/activities/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "ed7ba8654fc750ac3d069c79ed8b8e59", 8 | "packages": [ 9 | { 10 | "name": "lwphp/swo-worker", 11 | "version": "dev-master", 12 | "dist": { 13 | "type": "path", 14 | "url": "../swoWorker", 15 | "reference": "e03d98c9aa79b8c18457f1c9d5d69ffdbc1cb5a6" 16 | }, 17 | "type": "library", 18 | "autoload": { 19 | "psr-4": { 20 | "SwoWorker\\": "./src/" 21 | }, 22 | "files": [ 23 | "src/Helper/functions.php" 24 | ] 25 | }, 26 | "license": [ 27 | "MIT" 28 | ], 29 | "authors": [ 30 | { 31 | "name": "liwei", 32 | "email": "liweiphp@163.com" 33 | } 34 | ], 35 | "description": "swoole worker", 36 | "transport-options": { 37 | "relative": true 38 | } 39 | } 40 | ], 41 | "packages-dev": [], 42 | "aliases": [], 43 | "minimum-stability": "stable", 44 | "stability-flags": { 45 | "lwphp/swo-worker": 20 46 | }, 47 | "prefer-stable": false, 48 | "prefer-lowest": false, 49 | "platform": [], 50 | "platform-dev": [], 51 | "plugin-api-version": "2.0.0" 52 | } 53 | -------------------------------------------------------------------------------- /swoWorker/src/Rpc/RpcServer.php: -------------------------------------------------------------------------------- 1 | app = $app; 21 | $this->server = $server; 22 | } 23 | public function run(){ 24 | $config = $this->app->make('config')->get('server.rpc'); 25 | p($config['server']['host'].':'.$config['server']['port'], '启动rpc'); 26 | $this->listener = $this->server->listen($config['server']['host'], $config['server']['port'], $config['server']['type']); 27 | $this->initEvent(); 28 | $this->listener->set($config['swoole']); 29 | } 30 | 31 | /** 32 | * [ 33 | * method=> class::action 34 | * params=>[] 35 | * ] 36 | * @param Swoole\Server $server 37 | * @param int $fd 38 | * @param int $reactorId 39 | * @param string $data 40 | */ 41 | public function onReceive($server, $fd, $reactorId, $data) 42 | { 43 | p($data, 'rpc请求'); 44 | $data = json_decode($data, true); 45 | list($class, $action) = explode('::', $data['method']); 46 | p($class, "rpc请求class"); 47 | $result = (new $class())->$action(...$data['params']); 48 | p($result, "rpc 返回结果"); 49 | $server->send($fd, Response::send($result)); 50 | } 51 | 52 | 53 | 54 | 55 | public function onConnect($server, $fd, $reactorId) 56 | { 57 | p('listener connect'); 58 | } 59 | public function onClose($server, $fd, $reactorId) 60 | { 61 | p('listener close'); 62 | } 63 | public function initEvent() 64 | { 65 | $this->listener->on('receive', [$this, 'onReceive']); 66 | $this->listener->on('connect', [$this, 'onConnect']); 67 | $this->listener->on('close', [$this, 'onClose']); 68 | } 69 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Rpc/RpcServer.php: -------------------------------------------------------------------------------- 1 | app = $app; 21 | $this->server = $server; 22 | } 23 | public function run(){ 24 | $config = $this->app->make('config')->get('server.rpc'); 25 | p($config['server']['host'].':'.$config['server']['port'], '启动rpc'); 26 | $this->listener = $this->server->listen($config['server']['host'], $config['server']['port'], $config['server']['type']); 27 | $this->initEvent(); 28 | $this->listener->set($config['swoole']); 29 | } 30 | 31 | /** 32 | * [ 33 | * method=> class::action 34 | * params=>[] 35 | * ] 36 | * @param Swoole\Server $server 37 | * @param int $fd 38 | * @param int $reactorId 39 | * @param string $data 40 | */ 41 | public function onReceive($server, $fd, $reactorId, $data) 42 | { 43 | p($data, 'rpc请求'); 44 | $data = json_decode($data, true); 45 | list($class, $action) = explode('::', $data['method']); 46 | p($class, "rpc请求class"); 47 | $result = (new $class())->$action(...$data['params']); 48 | p($result, "rpc 返回结果"); 49 | $server->send($fd, Response::send($result)); 50 | } 51 | 52 | 53 | 54 | 55 | public function onConnect($server, $fd, $reactorId) 56 | { 57 | p('listener connect'); 58 | } 59 | public function onClose($server, $fd, $reactorId) 60 | { 61 | p('listener close'); 62 | } 63 | public function initEvent() 64 | { 65 | $this->listener->on('receive', [$this, 'onReceive']); 66 | $this->listener->on('connect', [$this, 'onConnect']); 67 | $this->listener->on('close', [$this, 'onClose']); 68 | } 69 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Rpc/RpcServer.php: -------------------------------------------------------------------------------- 1 | app = $app; 21 | $this->server = $server; 22 | } 23 | public function run(){ 24 | $config = $this->app->make('config')->get('server.rpc'); 25 | p($config['server']['host'].':'.$config['server']['port'], '启动rpc'); 26 | $this->listener = $this->server->listen($config['server']['host'], $config['server']['port'], $config['server']['type']); 27 | $this->initEvent(); 28 | $this->listener->set($config['swoole']); 29 | } 30 | 31 | /** 32 | * [ 33 | * method=> class::action 34 | * params=>[] 35 | * ] 36 | * @param Swoole\Server $server 37 | * @param int $fd 38 | * @param int $reactorId 39 | * @param string $data 40 | */ 41 | public function onReceive($server, $fd, $reactorId, $data) 42 | { 43 | p($data, 'rpc请求'); 44 | $data = json_decode($data, true); 45 | list($class, $action) = explode('::', $data['method']); 46 | p($class, "rpc请求class"); 47 | $result = (new $class())->$action(...$data['params']); 48 | p($result, "rpc 返回结果"); 49 | $server->send($fd, Response::send($result)); 50 | } 51 | 52 | 53 | 54 | 55 | public function onConnect($server, $fd, $reactorId) 56 | { 57 | p('listener connect'); 58 | } 59 | public function onClose($server, $fd, $reactorId) 60 | { 61 | p('listener close'); 62 | } 63 | public function initEvent() 64 | { 65 | $this->listener->on('receive', [$this, 'onReceive']); 66 | $this->listener->on('connect', [$this, 'onConnect']); 67 | $this->listener->on('close', [$this, 'onClose']); 68 | } 69 | } -------------------------------------------------------------------------------- /frameS/config/consul.php: -------------------------------------------------------------------------------- 1 | [ 27 | [ 28 | 'ID' => 'order_1', 29 | 'Name' => 'order', 30 | 'Tags' => ['xdp-\/core.order'], 31 | 'Address' => '192.168.56.102', 32 | 'Port' => 9901, 33 | 'Check' => [ 34 | 'name' => 'order_1.check', 35 | 'tcp' => '192.168.56.102:9900', 36 | 'interval' => '10s', 37 | 'timeout' => '2s' 38 | ] 39 | ], 40 | [ 41 | 'ID' => 'order_2', 42 | 'Name' => 'order', 43 | 'Tags' => ['xdp-\/core.order'], 44 | 'Address' => '192.168.56.102', 45 | 'Port' => 9901, 46 | 'Check' => [ 47 | 'name' => 'order_1.check', 48 | 'tcp' => '192.168.56.102:9900', 49 | 'interval' => '10s', 50 | 'timeout' => '2s' 51 | ] 52 | ] 53 | 54 | ], 55 | 'goods' => [ 56 | [ 57 | 'ID' => 'goods_1', 58 | 'Name' => 'goods', 59 | 'Tags' => ['xdp-\/core.goods'], 60 | 'Address' => '192.168.56.102', 61 | 'Port' => 9901, 62 | 'Check' => [ 63 | 'name' => 'order_1.check', 64 | 'tcp' => '192.168.56.102:9900', 65 | 'interval' => '10s', 66 | 'timeout' => '2s' 67 | ] 68 | ], 69 | [ 70 | 'ID' => 'goods_2', 71 | 'Name' => 'goods', 72 | 'Tags' => ['xdp-\/core.goods'], 73 | 'Address' => '192.168.56.102', 74 | 'Port' => 9901, 75 | 'Check' => [ 76 | 'name' => 'order_1.check', 77 | 'tcp' => '192.168.56.102:9900', 78 | 'interval' => '10s', 79 | 'timeout' => '2s' 80 | ] 81 | ] 82 | 83 | ], 84 | ]; -------------------------------------------------------------------------------- /swoWorker/src/Route/Route.php: -------------------------------------------------------------------------------- 1 | addRoute('GET', $uri, $action); 38 | } 39 | public function post($uri, $action) 40 | { 41 | $uri = trim($uri, '\/'); 42 | $this->addRoute('POST', $uri, $action); 43 | } 44 | public function registerRoute($map) 45 | { 46 | 47 | // 2. 读取文件信息 48 | foreach ($map as $flag => $item) { 49 | $this->namespace[$flag] = $item['namespace']; 50 | $this->flag = $flag; 51 | require_once $item['path']; 52 | } 53 | } 54 | /** 55 | * 添加路由映射 56 | * @param $method 57 | * @param $uri 58 | * @param $action 59 | */ 60 | protected function addRoute($method, $uri, $action) 61 | { 62 | if (in_array($method, $this->verbs)) { 63 | if ($action instanceof \Closure) { 64 | $this->routes[$this->flag][$method][$uri] = $action; 65 | } else { 66 | $this->routes[$this->flag][$method][$uri] = $this->namespace[$this->flag].'\\'.$action; 67 | } 68 | } 69 | p($this->routes, "启动路由"); 70 | } 71 | 72 | public function match($flag, $request) 73 | { 74 | p($request, "request对象"); 75 | if ($action = $this->routes[$flag][$request->method][$request->uri]) { 76 | return $this->runAction($action, $flag); 77 | } 78 | p("方法不存在"); 79 | return "404"; 80 | } 81 | public function runAction($action, $flag) 82 | { 83 | if ($action instanceof \Closure) { 84 | return call_user_func($action); 85 | } else { 86 | list($class, $method) = explode("@", $action); 87 | return (new $class())->$method(); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Route/Route.php: -------------------------------------------------------------------------------- 1 | addRoute('GET', $uri, $action); 38 | } 39 | public function post($uri, $action) 40 | { 41 | $uri = trim($uri, '\/'); 42 | $this->addRoute('POST', $uri, $action); 43 | } 44 | public function registerRoute($map) 45 | { 46 | 47 | // 2. 读取文件信息 48 | foreach ($map as $flag => $item) { 49 | $this->namespace[$flag] = $item['namespace']; 50 | $this->flag = $flag; 51 | require_once $item['path']; 52 | } 53 | } 54 | /** 55 | * 添加路由映射 56 | * @param $method 57 | * @param $uri 58 | * @param $action 59 | */ 60 | protected function addRoute($method, $uri, $action) 61 | { 62 | if (in_array($method, $this->verbs)) { 63 | if ($action instanceof \Closure) { 64 | $this->routes[$this->flag][$method][$uri] = $action; 65 | } else { 66 | $this->routes[$this->flag][$method][$uri] = $this->namespace[$this->flag].'\\'.$action; 67 | } 68 | } 69 | p($this->routes, "启动路由"); 70 | } 71 | 72 | public function match($flag, $request) 73 | { 74 | p($request, "request对象"); 75 | if ($action = $this->routes[$flag][$request->method][$request->uri]) { 76 | return $this->runAction($action, $flag); 77 | } 78 | p("方法不存在"); 79 | return "404"; 80 | } 81 | public function runAction($action, $flag) 82 | { 83 | if ($action instanceof \Closure) { 84 | return call_user_func($action); 85 | } else { 86 | list($class, $method) = explode("@", $action); 87 | return (new $class())->$method(); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Route/Route.php: -------------------------------------------------------------------------------- 1 | addRoute('GET', $uri, $action); 38 | } 39 | public function post($uri, $action) 40 | { 41 | $uri = trim($uri, '\/'); 42 | $this->addRoute('POST', $uri, $action); 43 | } 44 | public function registerRoute($map) 45 | { 46 | 47 | // 2. 读取文件信息 48 | foreach ($map as $flag => $item) { 49 | $this->namespace[$flag] = $item['namespace']; 50 | $this->flag = $flag; 51 | require_once $item['path']; 52 | } 53 | } 54 | /** 55 | * 添加路由映射 56 | * @param $method 57 | * @param $uri 58 | * @param $action 59 | */ 60 | protected function addRoute($method, $uri, $action) 61 | { 62 | if (in_array($method, $this->verbs)) { 63 | if ($action instanceof \Closure) { 64 | $this->routes[$this->flag][$method][$uri] = $action; 65 | } else { 66 | $this->routes[$this->flag][$method][$uri] = $this->namespace[$this->flag].'\\'.$action; 67 | } 68 | } 69 | p($this->routes, "启动路由"); 70 | } 71 | 72 | public function match($flag, $request) 73 | { 74 | p($request, "request对象"); 75 | if ($action = $this->routes[$flag][$request->method][$request->uri]) { 76 | return $this->runAction($action, $flag); 77 | } 78 | p("方法不存在"); 79 | return "404"; 80 | } 81 | public function runAction($action, $flag) 82 | { 83 | if ($action instanceof \Closure) { 84 | return call_user_func($action); 85 | } else { 86 | list($class, $method) = explode("@", $action); 87 | return (new $class())->$method(); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/src/Server/ServerBase.php: -------------------------------------------------------------------------------- 1 | 1, 23 | 'task_worker_num' => 0 24 | ]; 25 | protected $serverEvents = [ 26 | 'server' => [ 27 | 'start' => 'onStart', 28 | 'shutdown' => 'onShutdown' 29 | ], 30 | 'sub' => [], 31 | 'ext' => [] 32 | ]; 33 | public function __construct(Application $app, $host, $port) 34 | { 35 | $this->host = $host; 36 | $this->port = $port; 37 | $this->app = $app; 38 | $this->initConfig(); 39 | $this->createServer(); 40 | $this->initEvents(); 41 | $this->setEvents(); 42 | } 43 | abstract protected function createServer(); 44 | //server 自己的方法 45 | abstract protected function initEvents(); 46 | 47 | /** 48 | * 设置swoole配置 49 | */ 50 | protected function initConfig() 51 | { 52 | //队列方式task 可以设置message_key 53 | // Config:: 54 | } 55 | 56 | /** 57 | * 启动server 58 | */ 59 | public function start() 60 | { 61 | $this->swooleServer->set($this->serverConfig); 62 | $this->swooleServer->start(); 63 | } 64 | 65 | /** 66 | * start事件 67 | * @throws \Exception 68 | */ 69 | public function onStart() 70 | { 71 | $this->app->make('event')->trigger('swoole_start'); 72 | Log::p($this->host.":".$this->port, "服务启动"); 73 | } 74 | 75 | /** 76 | * shutdown事件 77 | * @throws \Exception 78 | */ 79 | public function onShutdown() 80 | { 81 | $this->app->make('event')->trigger('swoole_stop'); 82 | Log::p($this->host.":".$this->port, "服务关闭"); 83 | 84 | } 85 | 86 | /** 87 | * 返回swoole server 88 | * @return mixed 89 | */ 90 | public function getSwooleServer() 91 | { 92 | return $this->swooleServer; 93 | } 94 | 95 | /** 96 | * 设置事件为对象方式 97 | */ 98 | protected function setEvents() 99 | { 100 | foreach ($this->serverEvents as $events){ 101 | foreach ($events as $evnet => $func){ 102 | $this->swooleServer->on($evnet, [$this, $func]); 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/src/Server/ServerBase.php: -------------------------------------------------------------------------------- 1 | 1, 23 | 'task_worker_num' => 0 24 | ]; 25 | protected $serverEvents = [ 26 | 'server' => [ 27 | 'start' => 'onStart', 28 | 'shutdown' => 'onShutdown' 29 | ], 30 | 'sub' => [], 31 | 'ext' => [] 32 | ]; 33 | public function __construct(Application $app, $host, $port) 34 | { 35 | $this->host = $host; 36 | $this->port = $port; 37 | $this->app = $app; 38 | $this->initConfig(); 39 | $this->createServer(); 40 | $this->initEvents(); 41 | $this->setEvents(); 42 | } 43 | abstract protected function createServer(); 44 | //server 自己的方法 45 | abstract protected function initEvents(); 46 | 47 | /** 48 | * 设置swoole配置 49 | */ 50 | protected function initConfig() 51 | { 52 | //队列方式task 可以设置message_key 53 | // Config:: 54 | } 55 | 56 | /** 57 | * 启动server 58 | */ 59 | public function start() 60 | { 61 | $this->swooleServer->set($this->serverConfig); 62 | $this->swooleServer->start(); 63 | } 64 | 65 | /** 66 | * start事件 67 | * @throws \Exception 68 | */ 69 | public function onStart() 70 | { 71 | $this->app->make('event')->trigger('swoole_start'); 72 | Log::p($this->host.":".$this->port, "服务启动"); 73 | } 74 | 75 | /** 76 | * shutdown事件 77 | * @throws \Exception 78 | */ 79 | public function onShutdown() 80 | { 81 | $this->app->make('event')->trigger('swoole_stop'); 82 | Log::p($this->host.":".$this->port, "服务关闭"); 83 | 84 | } 85 | 86 | /** 87 | * 返回swoole server 88 | * @return mixed 89 | */ 90 | public function getSwooleServer() 91 | { 92 | return $this->swooleServer; 93 | } 94 | 95 | /** 96 | * 设置事件为对象方式 97 | */ 98 | protected function setEvents() 99 | { 100 | foreach ($this->serverEvents as $events){ 101 | foreach ($events as $evnet => $func){ 102 | $this->swooleServer->on($evnet, [$this, $func]); 103 | } 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /frameS/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require_once __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /micro/order/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /swoWorker/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /micro/activities/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /micro/goods/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require_once __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInit1ae62cd4abd5223cc8380eef12d3339c::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequire1ae62cd4abd5223cc8380eef12d3339c($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /micro/order/vendor/lwphp/swo-worker/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /micro/activities/vendor/lwphp/swo-worker/vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 | if ($useStaticLoader) { 31 | require __DIR__ . '/autoload_static.php'; 32 | 33 | call_user_func(\Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::getInitializer($loader)); 34 | } else { 35 | $map = require __DIR__ . '/autoload_namespaces.php'; 36 | foreach ($map as $namespace => $path) { 37 | $loader->set($namespace, $path); 38 | } 39 | 40 | $map = require __DIR__ . '/autoload_psr4.php'; 41 | foreach ($map as $namespace => $path) { 42 | $loader->setPsr4($namespace, $path); 43 | } 44 | 45 | $classMap = require __DIR__ . '/autoload_classmap.php'; 46 | if ($classMap) { 47 | $loader->addClassMap($classMap); 48 | } 49 | } 50 | 51 | $loader->register(true); 52 | 53 | if ($useStaticLoader) { 54 | $includeFiles = Composer\Autoload\ComposerStaticInitb58cf0adb58dd3a22a1e5b7b9cf1496d::$files; 55 | } else { 56 | $includeFiles = require __DIR__ . '/autoload_files.php'; 57 | } 58 | foreach ($includeFiles as $fileIdentifier => $file) { 59 | composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file); 60 | } 61 | 62 | return $loader; 63 | } 64 | } 65 | 66 | function composerRequireb58cf0adb58dd3a22a1e5b7b9cf1496d($fileIdentifier, $file) 67 | { 68 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 69 | require $file; 70 | 71 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /swoWorker/src/Database/Driver/Mysql.php: -------------------------------------------------------------------------------- 1 | host; 52 | $dbName = $config['dbName'] ?? $this->dbName; 53 | $username = $config['username'] ?? $this->username; 54 | $password = $config['password'] ?? $this->password; 55 | $this->pdo = new PDO("mysql:host=".$host.";dbname=".$dbName.";", $username, $password); 56 | $this->pdo->query('SET NAMES UTF8'); 57 | $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 58 | } catch (PDOException $e) { 59 | // throw new \Exception($e->getMessage(), 500); 60 | return $e->getMessage(); 61 | } 62 | } 63 | 64 | /** 65 | * 读操作 -->> 查询 66 | * @param string $sql 查询sql 67 | * @return array 执行结果 68 | */ 69 | public function query($sql) 70 | { 71 | try { 72 | $result = $this->pdo->query($sql); 73 | $data = []; 74 | foreach($result as $key => $value){ 75 | $data[] = $value; 76 | } 77 | return $data; 78 | } catch (PDOException $e) { 79 | return $e->getMessage(); 80 | } 81 | } 82 | 83 | public function call($sql, $select_param = null) 84 | { 85 | $stmt = $this->pdo->prepare($sql); 86 | if ($stmt->execute()) { 87 | if (isset($select_param)) { 88 | return $this->pdo->query($select_param)->fetchAll(); 89 | } 90 | return true; 91 | } else { 92 | return false; 93 | } 94 | } 95 | /** 96 | * 写操作 -->> 增删改 97 | * @param string $sql 查询sql 98 | * @return array 执行结果 99 | */ 100 | public function execute($sql) 101 | { 102 | try { 103 | return $this->pdo->exec($sql); 104 | } catch (PDOException $e) { 105 | return $e->getMessage(); 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /swoWorker/src/Database/Driver/MysqlPool.php: -------------------------------------------------------------------------------- 1 | pool = $pool; 57 | } catch (PDOException $e) { 58 | // throw new \Exception($e->getMessage(), 500); 59 | return $e->getMessage(); 60 | } 61 | } 62 | 63 | /** 64 | * 读操作 -->> 查询 65 | * @param string $sql 查询sql 66 | * @return array 执行结果 67 | */ 68 | public function query($sql) 69 | { 70 | try { 71 | $pdo = $this->pool->get(); 72 | $result = $pdo->query($sql)->fetchall(); 73 | $this->pool->put($pdo); 74 | return $result; 75 | } catch (PDOException $e) { 76 | $this->pool->put(null); 77 | return $e->getMessage(); 78 | } 79 | } 80 | 81 | public function call($sql, $select_param = null) 82 | { 83 | $pdo = $this->pool->get(); 84 | $stmt = $pdo->prepare($sql); 85 | if ($stmt->execute()) { 86 | if (isset($select_param)) { 87 | $result = $pdo->query($select_param)->fetchAll(); 88 | $this->pool->put($pdo); 89 | return $result; 90 | } 91 | $this->pool->put($pdo); 92 | return true; 93 | } else { 94 | $this->pool->put($pdo); 95 | return false; 96 | } 97 | } 98 | /** 99 | * 写操作 -->> 增删改 100 | * @param string $sql 查询sql 101 | * @return array 执行结果 102 | */ 103 | public function execute($sql) 104 | { 105 | try { 106 | $pdo = $this->pool->get(); 107 | $result = $pdo->exec($sql); 108 | $this->pool->put($pdo); 109 | return $result; 110 | } catch (PDOException $e) { 111 | $this->pool->put(null); 112 | return $e->getMessage(); 113 | } 114 | } 115 | } --------------------------------------------------------------------------------