完整版V1 加入爬虫功能
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 工单云控同步相关系统配置读取
|
||||
*/
|
||||
class SplitSyncConfigService
|
||||
{
|
||||
private const DEFAULT_NODE_HOST = 'http://127.0.0.1:3001';
|
||||
|
||||
/**
|
||||
* Node Headless 服务根地址
|
||||
*/
|
||||
public static function getNodeHost(): string
|
||||
{
|
||||
$value = self::getConfigValue('split_scrm_node_host');
|
||||
$value = trim($value);
|
||||
return $value !== '' ? rtrim($value, '/') : self::DEFAULT_NODE_HOST;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定工单类型的自动同步周期(分钟),0 表示不自动同步
|
||||
*/
|
||||
public static function getIntervalMinutes(string $ticketType): int
|
||||
{
|
||||
$ticketType = trim($ticketType);
|
||||
if ($ticketType === '') {
|
||||
return 0;
|
||||
}
|
||||
$key = 'split_sync_interval_' . $ticketType;
|
||||
$value = self::getConfigValue($key);
|
||||
return max(0, (int) $value);
|
||||
}
|
||||
|
||||
private static function getConfigValue(string $name): string
|
||||
{
|
||||
$site = Config::get('site.' . $name);
|
||||
if ($site !== null && $site !== '') {
|
||||
return (string) $site;
|
||||
}
|
||||
$db = Db::name('config')->where('name', $name)->value('value');
|
||||
return $db !== null ? (string) $db : '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user