-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
1,293 additions
and
518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
defined('APP_PATH') or define('APP_PATH', dirname(__DIR__)); | ||
defined('LOG_PATH') or define('LOG_PATH', APP_PATH.'/Storage/Logs'); | ||
defined('CONFIG_PATH') or define('CONFIG_PATH', APP_PATH.'/Config'); | ||
defined('CONFIG_COMPONENT_PATH') or define('CONFIG_COMPONENT_PATH', CONFIG_PATH.'/component'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,8 @@ | |
|
||
class GeneratePg extends GenerateMysql | ||
{ | ||
|
||
/** | ||
* @var string | ||
*/ | ||
const command = "gen:pgsql:schema"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Test\Scripts; | ||
|
||
class Kernel | ||
{ | ||
public static $commands = [ | ||
GenerateMysql::command => [GenerateMysql::class, 'generate'], | ||
GeneratePg::command => [GeneratePg::class, 'generate'], | ||
User\FixedUser::command => [User\FixedUser::class, 'fixName'] | ||
]; | ||
|
||
/** | ||
* 任务调度配置 | ||
* | ||
* @var array[] | ||
*/ | ||
public static $schedule = [ | ||
// [ | ||
// 'command' => User\FixedUser::command, | ||
// //'cron_expression' => 10, // 10s执行一次 | ||
// 'cron_expression' => '*/1 * * * *', // 每分钟执行一次 | ||
// 'desc' => '', | ||
// ], | ||
[ | ||
'command' => User\FixedUser::command, | ||
'cron_expression' => 3600, // 10s执行一次 | ||
//'cron_expression' => '*/1 * * * *', // 每分钟执行一次 | ||
'desc' => '', | ||
], | ||
]; | ||
|
||
|
||
/** | ||
* 配置化调度 | ||
* | ||
* @return array | ||
*/ | ||
public static function buildScheduleTaskList() | ||
{ | ||
$appName = $_SERVER['argv'][2]; | ||
$scheduleList = []; | ||
foreach (self::$schedule as $item) { | ||
$item['cron_name'] = $item['command'].'-'.$item['cron_expression']; | ||
$item['exec_bin_file'] = defined('PHP_BIN_FILE') ? PHP_BIN_FILE : '/usr/bin/php'; | ||
$item['fork_type'] = \Swoolefy\Worker\Cron\CronForkProcess::FORK_TYPE_PROC_OPEN; | ||
$item['exec_script'] = "script.php start {$appName} --c={$item['command']} --daemon=1"; | ||
$item['params'] = []; | ||
$scheduleList[] = $item; | ||
} | ||
return $scheduleList; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.