初始化本地仓库

This commit is contained in:
2026-08-31 11:33:59 +08:00
commit 663f74b633
2390 changed files with 402918 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\scheduler\event;
use app\enum\system\OperationResult;
use core\scheduler\event\EventBootstrap;
class EvalTask implements EventBootstrap
{
/**
* @param $crontab
*
* @return array
*/
public static function parse($crontab): array
{
$code = OperationResult::SUCCESS->value;
try {
$log = eval($crontab['target']);
} catch (\Throwable $throwable) {
$code = OperationResult::FAILURE->value;
$log = $throwable->getMessage();
}
return ['log'=> $log, 'code' => $code];
}
}
@@ -0,0 +1,23 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\scheduler\event;
/**
* 解析任务
*
* @author Mr.April
* @since 1.0
*/
interface EventBootstrap
{
public static function parse($crontab): mixed;
}
@@ -0,0 +1,43 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\scheduler\event;
use app\enum\system\OperationResult;
use core\scheduler\event\EventBootstrap;
class SchedulingTask implements EventBootstrap
{
/**
* @param $crontab
*
* @return array
*/
public static function parse($crontab): array
{
$code = OperationResult::SUCCESS->value;
try {
$className = $crontab['target'];
$bizId = $crontab['biz_id'];
// 创建类的实例
$instance = new $className();
// 使用反射动态调用非静态方法
$reflectionMethod = new \ReflectionMethod($className, 'run');
$log = $reflectionMethod->invokeArgs($instance, [$bizId]);
} catch (\Throwable $throwable) {
$code = OperationResult::FAILURE->value;
$log = $throwable->getMessage();
}
return ['log' => $log, 'code' => $code];
}
}
@@ -0,0 +1,27 @@
<?php
namespace core\scheduler\event;
use app\enum\system\OperationResult;
use core\scheduler\event\EventBootstrap;
class ShellTask implements EventBootstrap
{
/**
* @param $crontab
*
* @return array
*/
public static function parse($crontab): array
{
$code = OperationResult::SUCCESS->value;
try {
$log = shell_exec($crontab['target']);
} catch (\Throwable $e) {
$code = OperationResult::FAILURE->value;
$log = $e->getMessage();
}
return ['code' => $code, 'log' => $log];
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\scheduler\event;
use app\enum\system\OperationResult;
use core\scheduler\event\EventBootstrap;
class UrlTask implements EventBootstrap
{
/**
* @param $crontab
*
* @return array
*/
public static function parse($crontab): array
{
$url = trim($crontab['target'] ?? '');
$code = OperationResult::SUCCESS->value;
try {
$client = new \GuzzleHttp\Client();
$response = $client->get($url);
$log = strip_tags($response->getBody()->getContents());
} catch (\Throwable $throwable) {
$code = OperationResult::FAILURE->value;
$log = $throwable->getMessage();
}
return ['code' => $code, 'log' => $log];
}
}