bitget earn
This commit is contained in:
parent
ffdb74d841
commit
042197db0d
95
.env
95
.env
@ -1,49 +1,54 @@
|
||||
[WEBSERVER]
|
||||
BIND = 0.0.0.0
|
||||
PORT = 22455
|
||||
COUNTCOEFFICIENT = 4
|
||||
ENABLE = 'true'
|
||||
[webserver]
|
||||
bind = 0.0.0.0
|
||||
port = 22455
|
||||
countCoefficient = 4
|
||||
#开启的进程数量的系数,数值X为几倍CPU核心数量,即最终开启进程数量为:cpu逻辑核数量*X,推荐为4,默认为1
|
||||
enable = 'true'
|
||||
#改为'false'可关闭Web服务器
|
||||
|
||||
[MONITOR]
|
||||
ENABLE = 'true'
|
||||
[monitor]
|
||||
enable = 'true'
|
||||
#改为'false'可关闭代码更改自动重启监控,对于systemctl下运行较好
|
||||
|
||||
[DATABASE]
|
||||
DRIVER = mysql
|
||||
[database]
|
||||
driver = 'postgre'
|
||||
#数据库类型,可选postgre、sqlite、mysql、sqlserver,并填写下方对应配置。默认mysql
|
||||
[database.mysql]
|
||||
host = '127.0.0.1'
|
||||
port = 3306
|
||||
database = 'webman'
|
||||
username = 'webman'
|
||||
password = ''
|
||||
charset = 'utf8'
|
||||
collation = 'utf8_unicode_ci'
|
||||
prefix = ''
|
||||
[database.sqlite]
|
||||
database = '/sqlite.db'
|
||||
#sqlite二进制db文件的路径,相对于代码存储目录。以/开头。
|
||||
prefix = ''
|
||||
[database.sqlserver]
|
||||
host = '127.0.0.1'
|
||||
port = 1433
|
||||
database = 'webman'
|
||||
username = 'webman'
|
||||
password = ''
|
||||
charset = 'utf8'
|
||||
prefix = ''
|
||||
[database.postgre]
|
||||
host = 'layfi.postgres.database.azure.com'
|
||||
port = 5432
|
||||
database = 'postgres'
|
||||
username = 'enoch'
|
||||
password = 'Qi2005112!'
|
||||
charset = 'utf8'
|
||||
prefix = ''
|
||||
schema = 'layfi'
|
||||
sslmode = 'prefer'
|
||||
#ssl模式,可选disable、allow、prefer、require、verify-ca、verify-full。一般而言,默认的perfer即可。详见https://learn.microsoft.com/zh-cn/azure/postgresql/flexible-server/concepts-networking-ssl-tls#configure-ssl-on-the-client
|
||||
|
||||
[DATABASE.MYSQL]
|
||||
HOST = 127.0.0.1
|
||||
PORT = 3306
|
||||
DATABASE = webman
|
||||
USERNAME = webman
|
||||
PASSWORD =
|
||||
CHARSET = utf8
|
||||
COLLATION = utf8_unicode_ci
|
||||
PREFIX =
|
||||
[getcoin.bitget]
|
||||
enable = 'true'
|
||||
#改为'false'可关闭bitget api定时器
|
||||
time = '*/5 * * * * *'
|
||||
#执行时间,参见https://www.workerman.net/doc/webman/components/crontab.html
|
||||
|
||||
[DATABASE.SQLITE]
|
||||
DATABASE = /sqlite.db
|
||||
PREFIX =
|
||||
|
||||
[DATABASE.SQLSERVER]
|
||||
HOST = 127.0.0.1
|
||||
PORT = 1433
|
||||
DATABASE = webman
|
||||
USERNAME = webman
|
||||
PASSWORD =
|
||||
CHARSET = utf8
|
||||
PREFIX =
|
||||
|
||||
[DATABASE.POSTGRE]
|
||||
HOST = 127.0.0.1
|
||||
PORT = 5432
|
||||
DATABASE = webman
|
||||
USERNAME = webman
|
||||
PASSWORD =
|
||||
CHARSET = utf8
|
||||
PREFIX =
|
||||
SCHEMA = public
|
||||
SSLMODE = prefer
|
||||
|
||||
[GETCOIN.BITGET]
|
||||
ENABLE = 'true'
|
||||
TIME = 0 */30 * * * *
|
@ -7,20 +7,37 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use support\Db;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
|
||||
class GetcoinBitget extends Command
|
||||
{
|
||||
protected $source = 'bitget';
|
||||
protected static $defaultName = 'getcoin:bitget';
|
||||
protected static $defaultDescription = 'getcoin bitget';
|
||||
|
||||
private string $apiKey;
|
||||
private string $secretKey;
|
||||
private string $passphrase;
|
||||
private string $baseUrl;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$config=Db::table('apisetting')->where('source', $this->source)->first();
|
||||
$this->apiKey = $config->api;
|
||||
$this->secretKey = $config->apikey;
|
||||
$this->passphrase = $config->passphrase;
|
||||
$this->baseUrl = 'https://'.$config->domain;
|
||||
$this->addArgument('name', InputArgument::OPTIONAL, 'Name description');
|
||||
}
|
||||
protected function config()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
@ -29,9 +46,121 @@ class GetcoinBitget extends Command
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$name = $input->getArgument('name');
|
||||
$output->writeln('Hello getcoin:bitget');
|
||||
$output->writeln($this->source.' Getcoin Now Running');
|
||||
|
||||
|
||||
$response = $this->sendRequest('GET', '/api/v2/earn/savings/product', [
|
||||
'filter' => 'available',
|
||||
]);
|
||||
if(isset($response)&&isset($response->code)&&$response->code=='00000'&&isset($response->data)){
|
||||
$bakdata = [];
|
||||
foreach($response->data as $data){
|
||||
if($data->periodType!='flexible' || $data->productLevel!='normal'){
|
||||
continue;
|
||||
}
|
||||
$apyValues = array_map(function($item) {
|
||||
return floatval($item->currentApy);
|
||||
}, $data->apyList);
|
||||
if($data->status=='in_progress'){
|
||||
$available=1;
|
||||
}else{
|
||||
$available=0;
|
||||
}
|
||||
$bakdata[]=[
|
||||
'token'=>strtoupper($data->coin),
|
||||
'type'=>'earn',
|
||||
'subtype'=>'flexible',
|
||||
'source'=>'bitget',
|
||||
'rate'=>max($apyValues),
|
||||
'min_rate'=>min($apyValues),
|
||||
'update'=>date('Y-m-d H:i:s'),
|
||||
'available' => $available,
|
||||
];
|
||||
}
|
||||
Db::table('coininfo')->upsert(
|
||||
$bakdata, // 插入的数据
|
||||
['token', 'type','subtype','source'], // 复合唯一标识列(user_id 和 product_id 组合)
|
||||
['rate','min_rate','update','available'] // 如果记录存在,更新的字段
|
||||
);
|
||||
}else{
|
||||
$output->writeln('<error>Request API Error</error>');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
$output->writeln('OK');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
private function generateSignature($timestamp, $method, $requestPath, $queryString = '', $body = null)
|
||||
{
|
||||
$method = strtoupper($method);
|
||||
|
||||
$preHash = $timestamp . $method . $requestPath;
|
||||
if ($queryString) {
|
||||
$preHash .= '?' . $queryString;
|
||||
}
|
||||
if($body){
|
||||
$preHash .= $body;
|
||||
}
|
||||
return base64_encode(hash_hmac('sha256', $preHash, $this->secretKey, true));
|
||||
}
|
||||
private function sendRequest($method, $requestPath, $queryParams = null, $bodyParams = null)
|
||||
{
|
||||
$timestamp = (int)microtime(true) * 1000;
|
||||
|
||||
|
||||
|
||||
$queryString = http_build_query($queryParams);
|
||||
$body = !empty($bodyParams) ? json_encode($bodyParams) : '';
|
||||
|
||||
$signature = $this->generateSignature($timestamp, $method, $requestPath, $queryString, $body);
|
||||
// 构建请求头
|
||||
$headers = [
|
||||
'access-key' => $this->apiKey,
|
||||
'access-sign' => $signature,
|
||||
'access-timestamp' => $timestamp,
|
||||
'access-passphrase' => $this->passphrase,
|
||||
'content-type' => 'application/json',
|
||||
'locale' => 'zh-CN',
|
||||
];
|
||||
/**
|
||||
$headers = array(
|
||||
'ACCESS-KEY: '.$this->apiKey,
|
||||
'ACCESS-SIGN: '.$signature,
|
||||
'ACCESS-TIMESTAMP: '.$timestamp,
|
||||
'ACCESS-PASSPHRASE: '.$this->passphrase,
|
||||
'Content-type: application/json',
|
||||
'locale: zh-CN',
|
||||
);*/
|
||||
// 构建完整 URL
|
||||
$url = $this->baseUrl . $requestPath;
|
||||
|
||||
if ($queryString) {
|
||||
$url .= '?' . $queryString;
|
||||
}
|
||||
|
||||
$client = new Client();
|
||||
// 发送同步请求
|
||||
$response = $client->request($method, $this->baseUrl . $requestPath, [
|
||||
'headers' => $headers,
|
||||
'query' => $queryParams, // 用于 GET 请求的查询参数
|
||||
'json' => $bodyParams, // 用于 POST 请求的 JSON 数据
|
||||
]);
|
||||
|
||||
|
||||
return json_decode($response->getBody()); // 解析响应
|
||||
/**
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
curl_setopt($ch, CURLOPT_STDERR, fopen('php://stderr', 'w'));
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $output;*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Bitget
|
||||
echo date('[Y-m-d H:i:s]')."Getcoin:".__CLASS__." Now Running: \n";
|
||||
$command = new GetcoinBitget();
|
||||
$input = new ArrayInput([
|
||||
'name' => 'Alice', // 命令的参数
|
||||
'name' => 'Alice',
|
||||
]);
|
||||
$output = new ConsoleOutput();
|
||||
$command->run($input, $output);
|
||||
|
@ -25,4 +25,5 @@ env_set([
|
||||
'getcoin.bitget.time'=>'0 */30 * * * *',
|
||||
|
||||
|
||||
]);
|
||||
]);
|
||||
echo "OJBK!"
|
@ -33,10 +33,13 @@
|
||||
"symfony/var-dumper": "^7.2",
|
||||
"laravel/serializable-closure": "^2.0",
|
||||
"webman/event": "^1.0",
|
||||
"webman/console": "^1.3",
|
||||
"workerman/crontab": "^1.0",
|
||||
"yzh52521/easyhttp": "^1.1",
|
||||
"zhqing/webman-env": "^1.0"
|
||||
"zhqing/webman-env": "^1.0",
|
||||
"webman/console": "^1.3",
|
||||
"workerman/http-client": "^2.2",
|
||||
"revolt/event-loop": "^1.0",
|
||||
"guzzlehttp/guzzle": "^7.9"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-event": "For better performance. "
|
||||
|
172
composer.lock
generated
172
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "27344636cc95278cd20b1498d2ccc682",
|
||||
"content-hash": "9cc231c6d77dcb77b9437f46db8db8b6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -1875,6 +1875,78 @@
|
||||
},
|
||||
"time": "2019-03-08T08:55:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "revolt/event-loop",
|
||||
"version": "v1.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/revoltphp/event-loop.git",
|
||||
"reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/revoltphp/event-loop/zipball/25de49af7223ba039f64da4ae9a28ec2d10d0254",
|
||||
"reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"jetbrains/phpstorm-stubs": "^2019.3",
|
||||
"phpunit/phpunit": "^9",
|
||||
"psalm/phar": "^5.15"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Revolt\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aaron Piotrowski",
|
||||
"email": "aaron@trowski.com"
|
||||
},
|
||||
{
|
||||
"name": "Cees-Jan Kiewiet",
|
||||
"email": "ceesjank@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering"
|
||||
},
|
||||
{
|
||||
"name": "Niklas Keller",
|
||||
"email": "me@kelunik.com"
|
||||
}
|
||||
],
|
||||
"description": "Rock-solid event loop for concurrent PHP applications.",
|
||||
"keywords": [
|
||||
"async",
|
||||
"asynchronous",
|
||||
"concurrency",
|
||||
"event",
|
||||
"event-loop",
|
||||
"non-blocking",
|
||||
"scheduler"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/revoltphp/event-loop/issues",
|
||||
"source": "https://github.com/revoltphp/event-loop/tree/v1.0.6"
|
||||
},
|
||||
"time": "2023-11-30T05:34:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.2.0",
|
||||
@ -3137,6 +3209,104 @@
|
||||
},
|
||||
"time": "2025-01-15T07:20:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "workerman/http-client",
|
||||
"version": "v2.2.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/workerman-php/http-client.git",
|
||||
"reference": "d26b4b16feb8089df132ce6befce28cb7ff467b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/workerman-php/http-client/zipball/d26b4b16feb8089df132ce6befce28cb7ff467b6",
|
||||
"reference": "d26b4b16feb8089df132ce6befce28cb7ff467b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"workerman/psr7": ">=1.4.3",
|
||||
"workerman/workerman": "^4.1.0||^5.0.0||dev-master"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Workerman\\Http\\": "./src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"homepage": "http://www.workerman.net",
|
||||
"support": {
|
||||
"issues": "https://github.com/workerman-php/http-client/issues",
|
||||
"source": "https://github.com/workerman-php/http-client/tree/v2.2.9"
|
||||
},
|
||||
"time": "2025-01-19T12:22:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "workerman/psr7",
|
||||
"version": "v2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/walkor/psr7.git",
|
||||
"reference": "3b1a32d8219a504f1b092ab84e2e9a3811a45ce2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/walkor/psr7/zipball/3b1a32d8219a504f1b092ab84e2e9a3811a45ce2",
|
||||
"reference": "3b1a32d8219a504f1b092ab84e2e9a3811a45ce2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0",
|
||||
"psr/http-message": "~2.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Workerman\\Psr7\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/walkor/psr7/tree/v2.0.1"
|
||||
},
|
||||
"time": "2024-05-18T09:07:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "workerman/webman-framework",
|
||||
"version": "v1.6.14",
|
||||
|
@ -39,7 +39,7 @@
|
||||
'prefix' => env_get('database.sqlite.prefix',''),
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'postgre' => [
|
||||
'driver' => 'pgsql',
|
||||
'host' => env_get('database.postgre.host','127.0.0.1'),
|
||||
'port' => env_get('database.postgre.port',5432),
|
||||
@ -52,7 +52,7 @@
|
||||
'sslmode' => env_get('database.postgre.sslmode','prefer'),
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'sqlserver' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'host' => env_get('database.sqlserver.host','127.0.0.1'),
|
||||
'port' => env_get('database.sqlserver.port',1433),
|
||||
|
24
config/plugin/webman/console/app.php
Normal file
24
config/plugin/webman/console/app.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
return [
|
||||
'enable' => true,
|
||||
|
||||
'build_dir' => BASE_PATH . DIRECTORY_SEPARATOR . 'build',
|
||||
|
||||
'phar_filename' => 'webman.phar',
|
||||
|
||||
'bin_filename' => 'webman.bin',
|
||||
|
||||
'signature_algorithm'=> Phar::SHA256, //set the signature algorithm for a phar and apply it. The signature algorithm must be one of Phar::MD5, Phar::SHA1, Phar::SHA256, Phar::SHA512, or Phar::OPENSSL.
|
||||
|
||||
'private_key_file' => '', // The file path for certificate or OpenSSL private key file.
|
||||
|
||||
'exclude_pattern' => '#^(?!.*(composer.json|/.github/|/.idea/|/.git/|/.setting/|/runtime/|/vendor-bin/|/build/|/vendor/webman/admin/))(.*)$#',
|
||||
|
||||
'exclude_files' => [
|
||||
'.env', 'LICENSE', 'composer.json', 'composer.lock', 'start.php', 'webman.phar', 'webman.bin'
|
||||
],
|
||||
|
||||
'custom_ini' => '
|
||||
memory_limit = 256M
|
||||
',
|
||||
];
|
5
dbtest.php
Normal file
5
dbtest.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once __DIR__ . '/support/bootstrap.php';
|
||||
use support\Db;
|
||||
Db::table('coininfo')->where('token', 'usdt')->dump();
|
1
vendor/composer/autoload_files.php
vendored
1
vendor/composer/autoload_files.php
vendored
@ -22,6 +22,7 @@ return array(
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php',
|
||||
'f88f8987adfe3f7cf9978fa9a9d148bc' => $vendorDir . '/workerman/psr7/src/functions_include.php',
|
||||
'ef65a1626449d89d0811cf9befce46f0' => $vendorDir . '/illuminate/events/functions.php',
|
||||
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'd2136ff22b54ac75cd96a40e0022218e' => $vendorDir . '/workerman/webman-framework/src/support/helpers.php',
|
||||
|
5
vendor/composer/autoload_psr4.php
vendored
5
vendor/composer/autoload_psr4.php
vendored
@ -12,6 +12,8 @@ return array(
|
||||
'support\\' => array($vendorDir . '/workerman/webman-framework/src/support'),
|
||||
'app\\View\\Components\\' => array($baseDir . '/app/view/components'),
|
||||
'app\\' => array($baseDir . '/app'),
|
||||
'Workerman\\Psr7\\' => array($vendorDir . '/workerman/psr7/src'),
|
||||
'Workerman\\Http\\' => array($vendorDir . '/workerman/http-client/src'),
|
||||
'Workerman\\Crontab\\' => array($vendorDir . '/workerman/crontab/src'),
|
||||
'Workerman\\' => array($vendorDir . '/workerman/workerman/src'),
|
||||
'Webman\\Event\\' => array($vendorDir . '/webman/event/src'),
|
||||
@ -33,9 +35,10 @@ return array(
|
||||
'Support\\Exception\\' => array($vendorDir . '/workerman/webman-framework/src/support/exception'),
|
||||
'Support\\Bootstrap\\' => array($vendorDir . '/workerman/webman-framework/src/support/bootstrap'),
|
||||
'Support\\' => array($vendorDir . '/workerman/webman-framework/src/support'),
|
||||
'Revolt\\' => array($vendorDir . '/revolt/event-loop/src'),
|
||||
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
|
||||
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
|
||||
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
|
||||
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
||||
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'),
|
||||
|
23
vendor/composer/autoload_static.php
vendored
23
vendor/composer/autoload_static.php
vendored
@ -23,6 +23,7 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||
'253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php',
|
||||
'f88f8987adfe3f7cf9978fa9a9d148bc' => __DIR__ . '/..' . '/workerman/psr7/src/functions_include.php',
|
||||
'ef65a1626449d89d0811cf9befce46f0' => __DIR__ . '/..' . '/illuminate/events/functions.php',
|
||||
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||
'd2136ff22b54ac75cd96a40e0022218e' => __DIR__ . '/..' . '/workerman/webman-framework/src/support/helpers.php',
|
||||
@ -53,6 +54,8 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
),
|
||||
'W' =>
|
||||
array (
|
||||
'Workerman\\Psr7\\' => 15,
|
||||
'Workerman\\Http\\' => 15,
|
||||
'Workerman\\Crontab\\' => 18,
|
||||
'Workerman\\' => 10,
|
||||
'Webman\\Event\\' => 13,
|
||||
@ -78,6 +81,10 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
'Support\\Bootstrap\\' => 18,
|
||||
'Support\\' => 8,
|
||||
),
|
||||
'R' =>
|
||||
array (
|
||||
'Revolt\\' => 7,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'Psr\\SimpleCache\\' => 16,
|
||||
@ -160,6 +167,14 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/app',
|
||||
),
|
||||
'Workerman\\Psr7\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/workerman/psr7/src',
|
||||
),
|
||||
'Workerman\\Http\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/workerman/http-client/src',
|
||||
),
|
||||
'Workerman\\Crontab\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/workerman/crontab/src',
|
||||
@ -244,6 +259,10 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/workerman/webman-framework/src/support',
|
||||
),
|
||||
'Revolt\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/revolt/event-loop/src',
|
||||
),
|
||||
'Psr\\SimpleCache\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/simple-cache/src',
|
||||
@ -254,8 +273,8 @@ class ComposerStaticInit6e6023f44041e2f811fec6345b255443
|
||||
),
|
||||
'Psr\\Http\\Message\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
||||
1 => __DIR__ . '/..' . '/psr/http-factory/src',
|
||||
0 => __DIR__ . '/..' . '/psr/http-factory/src',
|
||||
1 => __DIR__ . '/..' . '/psr/http-message/src',
|
||||
),
|
||||
'Psr\\Http\\Client\\' =>
|
||||
array (
|
||||
|
179
vendor/composer/installed.json
vendored
179
vendor/composer/installed.json
vendored
@ -1956,6 +1956,81 @@
|
||||
},
|
||||
"install-path": "../ralouphie/getallheaders"
|
||||
},
|
||||
{
|
||||
"name": "revolt/event-loop",
|
||||
"version": "v1.0.6",
|
||||
"version_normalized": "1.0.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/revoltphp/event-loop.git",
|
||||
"reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/revoltphp/event-loop/zipball/25de49af7223ba039f64da4ae9a28ec2d10d0254",
|
||||
"reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"jetbrains/phpstorm-stubs": "^2019.3",
|
||||
"phpunit/phpunit": "^9",
|
||||
"psalm/phar": "^5.15"
|
||||
},
|
||||
"time": "2023-11-30T05:34:44+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Revolt\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aaron Piotrowski",
|
||||
"email": "aaron@trowski.com"
|
||||
},
|
||||
{
|
||||
"name": "Cees-Jan Kiewiet",
|
||||
"email": "ceesjank@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering"
|
||||
},
|
||||
{
|
||||
"name": "Niklas Keller",
|
||||
"email": "me@kelunik.com"
|
||||
}
|
||||
],
|
||||
"description": "Rock-solid event loop for concurrent PHP applications.",
|
||||
"keywords": [
|
||||
"async",
|
||||
"asynchronous",
|
||||
"concurrency",
|
||||
"event",
|
||||
"event-loop",
|
||||
"non-blocking",
|
||||
"scheduler"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/revoltphp/event-loop/issues",
|
||||
"source": "https://github.com/revoltphp/event-loop/tree/v1.0.6"
|
||||
},
|
||||
"install-path": "../revolt/event-loop"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.2.0",
|
||||
@ -3269,6 +3344,110 @@
|
||||
},
|
||||
"install-path": "../workerman/crontab"
|
||||
},
|
||||
{
|
||||
"name": "workerman/http-client",
|
||||
"version": "v2.2.9",
|
||||
"version_normalized": "2.2.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/workerman-php/http-client.git",
|
||||
"reference": "d26b4b16feb8089df132ce6befce28cb7ff467b6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/workerman-php/http-client/zipball/d26b4b16feb8089df132ce6befce28cb7ff467b6",
|
||||
"reference": "d26b4b16feb8089df132ce6befce28cb7ff467b6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"workerman/psr7": ">=1.4.3",
|
||||
"workerman/workerman": "^4.1.0||^5.0.0||dev-master"
|
||||
},
|
||||
"time": "2025-01-19T12:22:04+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Workerman\\Http\\": "./src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"homepage": "http://www.workerman.net",
|
||||
"support": {
|
||||
"issues": "https://github.com/workerman-php/http-client/issues",
|
||||
"source": "https://github.com/workerman-php/http-client/tree/v2.2.9"
|
||||
},
|
||||
"install-path": "../workerman/http-client"
|
||||
},
|
||||
{
|
||||
"name": "workerman/psr7",
|
||||
"version": "v2.0.1",
|
||||
"version_normalized": "2.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/walkor/psr7.git",
|
||||
"reference": "3b1a32d8219a504f1b092ab84e2e9a3811a45ce2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/walkor/psr7/zipball/3b1a32d8219a504f1b092ab84e2e9a3811a45ce2",
|
||||
"reference": "3b1a32d8219a504f1b092ab84e2e9a3811a45ce2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0",
|
||||
"psr/http-message": "~2.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"time": "2024-05-18T09:07:57+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Workerman\\Psr7\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/walkor/psr7/tree/v2.0.1"
|
||||
},
|
||||
"install-path": "../workerman/psr7"
|
||||
},
|
||||
{
|
||||
"name": "workerman/webman-framework",
|
||||
"version": "v1.6.14",
|
||||
|
39
vendor/composer/installed.php
vendored
39
vendor/composer/installed.php
vendored
@ -1,9 +1,9 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'workerman/webman',
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'reference' => null,
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'ffdb74d841f539df912099e04f352c080fe66b11',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@ -308,6 +308,15 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'revolt/event-loop' => array(
|
||||
'pretty_version' => 'v1.0.6',
|
||||
'version' => '1.0.6.0',
|
||||
'reference' => '25de49af7223ba039f64da4ae9a28ec2d10d0254',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../revolt/event-loop',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'spatie/once' => array(
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
@ -473,10 +482,28 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'workerman/http-client' => array(
|
||||
'pretty_version' => 'v2.2.9',
|
||||
'version' => '2.2.9.0',
|
||||
'reference' => 'd26b4b16feb8089df132ce6befce28cb7ff467b6',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../workerman/http-client',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'workerman/psr7' => array(
|
||||
'pretty_version' => 'v2.0.1',
|
||||
'version' => '2.0.1.0',
|
||||
'reference' => '3b1a32d8219a504f1b092ab84e2e9a3811a45ce2',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../workerman/psr7',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'workerman/webman' => array(
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'reference' => null,
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'reference' => 'ffdb74d841f539df912099e04f352c080fe66b11',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
73
webman
Executable file
73
webman
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Webman\Config;
|
||||
use Webman\Console\Command;
|
||||
use Webman\Console\Util;
|
||||
use support\Container;
|
||||
if (!Phar::running()) {
|
||||
chdir(__DIR__);
|
||||
}
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
if (!$appConfigFile = config_path('app.php')) {
|
||||
throw new RuntimeException('Config file not found: app.php');
|
||||
}
|
||||
$appConfig = require $appConfigFile;
|
||||
if ($timezone = $appConfig['default_timezone'] ?? '') {
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
if ($errorReporting = $appConfig['error_reporting'] ?? '') {
|
||||
error_reporting($errorReporting);
|
||||
}
|
||||
|
||||
if (!in_array($argv[1] ?? '', ['start', 'restart', 'stop', 'status', 'reload', 'connections'])) {
|
||||
require_once __DIR__ . '/support/bootstrap.php';
|
||||
} else {
|
||||
if (class_exists('Support\App')) {
|
||||
Support\App::loadAllConfig(['route']);
|
||||
} else {
|
||||
Config::reload(config_path(), ['route', 'container']);
|
||||
}
|
||||
}
|
||||
|
||||
$cli = new Command();
|
||||
$cli->setName('webman cli');
|
||||
$cli->installInternalCommands();
|
||||
if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) {
|
||||
$cli->installCommands($command_path);
|
||||
}
|
||||
|
||||
foreach (config('plugin', []) as $firm => $projects) {
|
||||
if (isset($projects['app'])) {
|
||||
foreach (['', '/app'] as $app) {
|
||||
if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) {
|
||||
$command_path = base_path() . "/plugin/$firm{$app}/$command_str";
|
||||
$cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str");
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($projects as $name => $project) {
|
||||
if (!is_array($project)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($project['command'] ?? [] as $class_name) {
|
||||
$reflection = new \ReflectionClass($class_name);
|
||||
if ($reflection->isAbstract()) {
|
||||
continue;
|
||||
}
|
||||
$properties = $reflection->getStaticProperties();
|
||||
$name = $properties['defaultName'];
|
||||
if (!$name) {
|
||||
throw new RuntimeException("Command {$class_name} has no defaultName");
|
||||
}
|
||||
$description = $properties['defaultDescription'] ?? '';
|
||||
$command = Container::get($class_name);
|
||||
$command->setName($name)->setDescription($description);
|
||||
$cli->add($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cli->run();
|
8
webman/.gitignore
vendored
8
webman/.gitignore
vendored
@ -1,8 +0,0 @@
|
||||
/runtime
|
||||
/.idea
|
||||
/.vscode
|
||||
/vendor
|
||||
*.log
|
||||
.env
|
||||
/tests/tmp
|
||||
/tests/.phpunit.result.cache
|
Loading…
Reference in New Issue
Block a user