mirror of
https://gitee.com/niucloud-team/niucloud
synced 2026-08-12 15:45:39 +08:00
update code
This commit is contained in:
@@ -15,6 +15,7 @@ use app\service\admin\site\SiteService;
|
||||
use app\service\core\sys\CoreConfigService;
|
||||
use app\service\core\sys\CoreSysConfigService;
|
||||
use core\base\BaseAdminService;
|
||||
use core\exception\AdminException;
|
||||
|
||||
/**
|
||||
* 配置服务层
|
||||
@@ -58,13 +59,12 @@ class ConfigService extends BaseAdminService
|
||||
'copyright_link' => $value['copyright_link'],
|
||||
'copyright_desc' => $value['copyright_desc']
|
||||
];
|
||||
$res = $this->core_config_service->setConfig(0,'COPYRIGHT', $data);
|
||||
return $res;
|
||||
return $this->core_config_service->setConfig(0,'COPYRIGHT', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取网站信息
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function getWebSite()
|
||||
{
|
||||
@@ -120,8 +120,7 @@ class ConfigService extends BaseAdminService
|
||||
"enterprise_wechat" => $value['enterprise_wechat'],
|
||||
"tel" => $value['tel']
|
||||
];
|
||||
$res = $this->core_config_service->setConfig(0,'SERVICE_INFO', $data);
|
||||
return $res;
|
||||
return $this->core_config_service->setConfig(0,'SERVICE_INFO', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,8 +133,7 @@ class ConfigService extends BaseAdminService
|
||||
$data = [
|
||||
'key' => $value['key'],
|
||||
];
|
||||
$res = $this->core_config_service->setConfig($this->site_id,'MAPKEY', $data);
|
||||
return $res;
|
||||
return $this->core_config_service->setConfig($this->site_id,'MAPKEY', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,9 +146,218 @@ class ConfigService extends BaseAdminService
|
||||
{
|
||||
$info = [];
|
||||
$info['value'] = [
|
||||
'key' => '',
|
||||
'key' => 'IZQBZ-3UHEU-WTCVD-2464U-I5N4V-ZFFU3',
|
||||
];
|
||||
}
|
||||
return $info['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点主页配置
|
||||
* @return mixed|string[]
|
||||
*/
|
||||
public function getSiteIndexConfig()
|
||||
{
|
||||
$config = (new CoreConfigService())->getConfig($this->site_id, "site_index");
|
||||
if(empty($config))
|
||||
{
|
||||
$config['value'] = [
|
||||
'view_path' => 'index/site_index'
|
||||
];
|
||||
}else{
|
||||
$result = event("SiteIndex");
|
||||
$index_list = [];
|
||||
foreach ($result as $v)
|
||||
{
|
||||
$index_list = empty($index_list) ? $v: array_merge($index_list, $v);
|
||||
}
|
||||
$tag = 0;
|
||||
$view_path = $config['value']['view_path'];
|
||||
foreach ($index_list as $v)
|
||||
{
|
||||
$v_view_path = $v['view_path'] ?? '';
|
||||
if($view_path == $v_view_path)
|
||||
{
|
||||
$tag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($tag == 0)
|
||||
{
|
||||
$config['value'] = [
|
||||
'view_path' => 'index/site_index'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
return $config['value']['view_path'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点主页配置
|
||||
* @param $data
|
||||
* @return true
|
||||
*/
|
||||
public function setSiteIndexConfig($data)
|
||||
{
|
||||
$config = [
|
||||
'view_path' => $data['view_path'] ,
|
||||
];
|
||||
//检测是否路劲一个异常
|
||||
$index_list = $this->getSiteIndexList();
|
||||
$check_tag = 0;
|
||||
foreach($index_list as $v)
|
||||
{
|
||||
if($v['view_path'] == $data['view_path'])
|
||||
{
|
||||
$check_tag = 1;
|
||||
}
|
||||
}
|
||||
if($check_tag == 0) throw new AdminException('SITE_INDEX_VIEW_PATH_NOT_EXIST');
|
||||
(new CoreConfigService())->setConfig($this->site_id, "site_index", $config);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点配置的首页列表
|
||||
* @return array
|
||||
*/
|
||||
public function getSiteIndexList()
|
||||
{
|
||||
$result = event("SiteIndex");
|
||||
$index_list = [];
|
||||
foreach ($result as $v)
|
||||
{
|
||||
$index_list = empty($index_list) ? $v: array_merge($index_list, $v);
|
||||
}
|
||||
$view_path = $this->getSiteIndexConfig();
|
||||
foreach ($index_list as $k => $v)
|
||||
{
|
||||
$v_view_path = $v['view_path'] ?? '';
|
||||
$index_list[$k]['is_use'] = ($v_view_path == $view_path) ? 1: 0;
|
||||
}
|
||||
return $index_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置站点快捷菜单
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
public function setShortcutMenu($data)
|
||||
{
|
||||
(new CoreConfigService())->setConfig($this->site_id, 'shortcut_menu', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点快捷菜单
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getShortcutMenu()
|
||||
{
|
||||
$config = (new CoreConfigService())->getConfig($this->site_id, 'shortcut_menu');
|
||||
$menu = $config['value'] ?? [];
|
||||
if(!empty($menu)){
|
||||
$menu_service = new MenuService();
|
||||
foreach($menu as $k => &$v){
|
||||
$menu_key = $v['menu_key'] ?? '';
|
||||
if($menu_key != ''){
|
||||
$item_router_path = $menu_service->getFullRouterPath($menu_key);
|
||||
if(empty($item_router_path)){
|
||||
unset($v[$k]);
|
||||
}else{
|
||||
$v['router_path'] = $item_router_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $menu;
|
||||
}
|
||||
/**
|
||||
* 获取平台主页配置
|
||||
* @return mixed|string[]
|
||||
*/
|
||||
public function getAdminIndexConfig()
|
||||
{
|
||||
$config = (new CoreConfigService())->getConfig($this->site_id, "admin_index");
|
||||
if(empty($config))
|
||||
{
|
||||
$config['value'] = [
|
||||
'view_path' => 'index/index'
|
||||
];
|
||||
}else{
|
||||
$result = event("AdminIndex");
|
||||
$index_list = [];
|
||||
foreach ($result as $v)
|
||||
{
|
||||
$index_list = empty($index_list) ? $v: array_merge($index_list, $v);
|
||||
}
|
||||
$tag = 0;
|
||||
$view_path = $config['value']['view_path'];
|
||||
foreach ($index_list as $v)
|
||||
{
|
||||
$v_view_path = $v['view_path'] ?? '';
|
||||
if($view_path == $v_view_path)
|
||||
{
|
||||
$tag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($tag == 0)
|
||||
{
|
||||
$config['value'] = [
|
||||
'view_path' => 'index/index'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
return $config['value']['view_path'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点主页配置
|
||||
* @param $data
|
||||
* @return true
|
||||
*/
|
||||
public function setAdminIndexConfig($data)
|
||||
{
|
||||
$config = [
|
||||
'view_path' => $data['view_path'] ,
|
||||
];
|
||||
//检测是否路劲一个异常
|
||||
$index_list = $this->getAdminIndexList();
|
||||
$check_tag = 0;
|
||||
foreach($index_list as $v)
|
||||
{
|
||||
if($v['view_path'] == $data['view_path'])
|
||||
{
|
||||
$check_tag = 1;
|
||||
}
|
||||
}
|
||||
if($check_tag == 0) throw new AdminException('ADMIN_INDEX_VIEW_PATH_NOT_EXIST');
|
||||
(new CoreConfigService())->setConfig($this->site_id, "admin_index", $config);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点配置的首页列表
|
||||
* @return array
|
||||
*/
|
||||
public function getAdminIndexList()
|
||||
{
|
||||
$result = event("AdminIndex");
|
||||
$index_list = [];
|
||||
foreach ($result as $v)
|
||||
{
|
||||
$index_list = empty($index_list) ? $v: array_merge($index_list, $v);
|
||||
}
|
||||
$view_path = $this->getAdminIndexConfig();
|
||||
foreach ($index_list as $k => $v)
|
||||
{
|
||||
$v_view_path = $v['view_path'] ?? '';
|
||||
$index_list[$k]['is_use'] = ($v_view_path == $view_path) ? 1: 0;
|
||||
}
|
||||
return $index_list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user