refactor(license): replace copyright endpoints with local system metadata
Made-with: Cursor
This commit is contained in:
49
pro_v3.5.1/app/services/system/LocalCopyrightService.php
Normal file
49
pro_v3.5.1/app/services/system/LocalCopyrightService.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ScottPan Team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\system;
|
||||
|
||||
use app\services\system\config\SystemConfigServices;
|
||||
use crmeb\services\SystemConfigService;
|
||||
|
||||
/**
|
||||
* 本项目自有版权信息服务,不表达 CRMEB 原厂授权状态。
|
||||
*/
|
||||
class LocalCopyrightService
|
||||
{
|
||||
public function getCopyright(): array
|
||||
{
|
||||
$config = SystemConfigService::more([
|
||||
['copyright', ''],
|
||||
['copyright_img', ''],
|
||||
]);
|
||||
|
||||
return [
|
||||
'copyrightContext' => $config['copyright'] ?? '',
|
||||
'copyrightImage' => $config['copyright_img'] ?? '',
|
||||
'version' => function_exists('get_crmeb_version') ? get_crmeb_version() : '',
|
||||
];
|
||||
}
|
||||
|
||||
public function saveCopyright(string $copyright = '', string $copyrightImg = ''): void
|
||||
{
|
||||
/** @var SystemConfigServices $services */
|
||||
$services = app()->make(SystemConfigServices::class);
|
||||
$services->update('copyright', ['value' => json_encode($copyright, JSON_UNESCAPED_UNICODE)], 'menu_name');
|
||||
$services->update('copyright_img', ['value' => json_encode($copyrightImg, JSON_UNESCAPED_UNICODE)], 'menu_name');
|
||||
|
||||
SystemConfigService::clear();
|
||||
}
|
||||
|
||||
public function getSystemLicenseInfo(): array
|
||||
{
|
||||
return [
|
||||
'edition' => 'custom',
|
||||
'license_source' => 'self-owned',
|
||||
'crm_pro_authorized' => false,
|
||||
'copyright' => $this->getCopyright(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user