CRMEB/crmeb/app/services/system/SystemPemServices.php
2025-06-09 10:32:07 +08:00

38 lines
926 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\services\system;
use app\dao\system\SystemPemDao;
use app\services\BaseServices;
class SystemPemServices extends BaseServices
{
public function __construct(SystemPemDao $dao)
{
$this->dao = $dao;
}
public function savePem($data)
{
$this->dao->savePem($data);
return true;
}
public function getPemPath($name)
{
$path = '';
$info = $this->dao->get(['name' => $name]);
if ($info) {
$path = root_path('runtime/pem') . $info['path'] . '.pem';
if (!file_exists($path)) {
// 如果runtime/pem文件夹不存在创建文件夹
if (!file_exists(root_path('runtime/pem'))) {
mkdir(root_path('runtime/pem'), 0777, true);
}
file_put_contents($path, $info['content']);
}
}
return $path;
}
}