改名
This commit is contained in:
@@ -81,16 +81,20 @@ class Annotation extends Component
|
||||
|
||||
/**
|
||||
* @param string $dir
|
||||
* @param string|null $outPath
|
||||
* @param string|array|null $outPath
|
||||
* @throws Exception
|
||||
*/
|
||||
public function runtime(string $dir, ?string $outPath = null)
|
||||
public function runtime(string $dir, string|array $outPath = null)
|
||||
{
|
||||
if ($outPath === null) {
|
||||
$outPath = [];
|
||||
} else if (!is_array($outPath)) {
|
||||
$outPath = [$outPath];
|
||||
}
|
||||
$this->_loader->loadByDirectory($dir, $outPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return mixed
|
||||
|
||||
@@ -224,10 +224,10 @@ class Loader extends BaseObject
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string|null $outPath
|
||||
* @param string|array $outPath
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadByDirectory(string $path, ?string $outPath = null)
|
||||
public function loadByDirectory(string $path, string|array $outPath = [])
|
||||
{
|
||||
try {
|
||||
$path = '/' . trim($path, '/');
|
||||
@@ -238,6 +238,7 @@ class Loader extends BaseObject
|
||||
if (!str_contains($key, $path)) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($key, $outPath)) continue;
|
||||
$this->execute($_path);
|
||||
}
|
||||
} catch (Throwable $exception) {
|
||||
|
||||
@@ -65,10 +65,12 @@ class OnWorkerStart extends Callback
|
||||
{
|
||||
putenv('environmental=' . Snowflake::TASK);
|
||||
|
||||
$annotation->runtime(MODEL_PATH);
|
||||
$annotation->runtime(CRONTAB_PATH);
|
||||
$annotation->runtime(CLIENT_PATH);
|
||||
|
||||
$annotation->runtime(directory('app'), [
|
||||
CONTROLLER_PATH,
|
||||
LISTENER_PATH,
|
||||
SOCKET_PATH,
|
||||
TASK_PATH,
|
||||
]);
|
||||
name($server->worker_pid, 'Task#' . $server->worker_id);
|
||||
|
||||
Snowflake::setTaskId($server->worker_pid);
|
||||
@@ -90,11 +92,7 @@ class OnWorkerStart extends Callback
|
||||
$time = microtime(true);
|
||||
$annotation->runtime(CONTROLLER_PATH);
|
||||
$this->debug('use time.' . microtime(true) - $time);
|
||||
$annotation->runtime(SOCKET_PATH);
|
||||
$annotation->runtime(MODEL_PATH);
|
||||
$annotation->runtime(CRONTAB_PATH);
|
||||
$annotation->runtime(CLIENT_PATH);
|
||||
$annotation->runtime(TASK_PATH);
|
||||
$annotation->runtime(directory('app'), CONTROLLER_PATH);
|
||||
|
||||
Snowflake::setWorkerId($server->worker_pid);
|
||||
putenv('environmental=' . Snowflake::WORKER);
|
||||
|
||||
@@ -64,10 +64,15 @@ class File
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getContent(): string
|
||||
{
|
||||
// $open = fopen($this->getTmpPath(), 'r');
|
||||
|
||||
@move_uploaded_file($this->tmp_name, storage($this->name));
|
||||
|
||||
|
||||
var_dump(file_get_contents($this->getTmpPath()));
|
||||
|
||||
return '';
|
||||
|
||||
@@ -28,6 +28,7 @@ defined('CONTROLLER_PATH') or define('CONTROLLER_PATH', APP_PATH . 'app/Http/Con
|
||||
defined('CRONTAB_PATH') or define('CRONTAB_PATH', APP_PATH . 'app/Crontab/');
|
||||
defined('CLIENT_PATH') or define('CLIENT_PATH', APP_PATH . 'app/Client/');
|
||||
defined('TASK_PATH') or define('TASK_PATH', APP_PATH . 'app/Async/');
|
||||
defined('LISTENER_PATH') or define('LISTENER_PATH', APP_PATH . 'app/Listener/');
|
||||
defined('KAFKA_PATH') or define('KAFKA_PATH', APP_PATH . 'app/Kafka/');
|
||||
defined('RPC_SERVICE_PATH') or define('RPC_SERVICE_PATH', APP_PATH . 'app/Http/Rpc/');
|
||||
defined('RPC_CLIENT_PATH') or define('RPC_CLIENT_PATH', APP_PATH . 'app/Client/Rpc/');
|
||||
|
||||
Reference in New Issue
Block a user