73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
namespace app\dict\system;
|
|
|
|
|
|
/**
|
|
* 计划任务属性
|
|
*/
|
|
class ScheduleDict
|
|
{
|
|
const default = 'default';
|
|
const url = 'url';
|
|
const cli = 'cli';
|
|
|
|
/**
|
|
* 计划任务类型
|
|
* @param $type
|
|
* @return string|string[]
|
|
*/
|
|
public static function getType($type = ''){
|
|
$list = [
|
|
self::default => '系统任务',
|
|
self::url => '接口启动',
|
|
self::cli => '命令启动',
|
|
];
|
|
if($type) return $list[$type] ?? '';
|
|
return $list;
|
|
}
|
|
|
|
/**
|
|
* 获取错误列表
|
|
* @param $code
|
|
* @return void
|
|
*/
|
|
public static function getError($code = ''){
|
|
$list = array(
|
|
self::default => [
|
|
'curl_ssl_error' => '',
|
|
],
|
|
self::url => [
|
|
|
|
],
|
|
self::cli => [
|
|
|
|
],
|
|
);
|
|
if($code) return $list[$code] ?? '';
|
|
return $list;
|
|
}
|
|
|
|
public static function getSuggestion(string $type) {
|
|
switch($type) {
|
|
case self::default:
|
|
return '请检查系统计划任务配置,确保 cron 进程正常运行,并检查网络连接和 SSL 证书设置。';
|
|
case self::url:
|
|
return '请检查网络连接、目标 URL 可访问性、HTTP 状态码和接口认证配置。可以使用 curl 命令手动测试接口。';
|
|
case self::cli:
|
|
return '请检查 cron 服务状态、命令执行权限、脚本路径和 PHP CLI 环境。建议使用 crontab -l 查看当前任务配置。';
|
|
default:
|
|
return '请检查计划任务配置文件和相关权限设置,确保所有依赖服务正常运行。';
|
|
}
|
|
}
|
|
}
|