Files
shopxo/app/admin/controller/Themeadmin.php

139 lines
3.8 KiB
PHP
Raw Normal View History

2018-12-28 18:58:37 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2018-12-28 18:58:37 +08:00
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2018-12-28 18:58:37 +08:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\controller\Base;
use app\service\ApiService;
2024-04-15 10:25:01 +08:00
use app\service\ThemeAdminService;
2020-01-16 15:01:30 +08:00
use app\service\StoreService;
2018-12-28 18:58:37 +08:00
/**
* 主题管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
2024-04-15 10:25:01 +08:00
class ThemeAdmin extends Base
2018-12-28 18:58:37 +08:00
{
2020-11-21 16:42:35 +08:00
private $view_type;
2018-12-28 18:58:37 +08:00
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public function __construct()
{
// 调用父类前置方法
parent::__construct();
// 小导航
$this->view_type = empty($this->data_request['view_type']) ? 'index' : $this->data_request['view_type'];
2018-12-28 18:58:37 +08:00
}
/**
* 列表
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
*/
public function Index()
{
2024-04-15 10:25:01 +08:00
// 获取主题列表
$data_list = ThemeAdminService::ThemeAdminList();
2021-04-23 16:43:23 +08:00
2024-04-15 10:25:01 +08:00
// 插件更新信息
$upgrade = ThemeAdminService::ThemeAdminUpgradeInfo($data_list);
// 是否未绑定商店账号
if($upgrade['code'] == -300)
{
return $this->NotBindStoreAccountTips($upgrade['msg']);
}
2018-12-28 18:58:37 +08:00
2024-04-15 10:25:01 +08:00
// 模板数据
MyViewAssign([
// 导航参数
'view_type' => $this->view_type,
// 基础导航
'base_nav' => MyLang('theme.base_nav_list'),
// 默认主题
'theme' => ThemeAdminService::DefaultTheme(),
// 主题列表
'data_list' => $data_list,
// 主题数据管理url
'admin_url_data' => ThemeAdminService::ThemeAdminDataUrl(),
2021-04-23 16:43:23 +08:00
// 插件更新信息
2024-04-15 10:25:01 +08:00
'upgrade_info' => $upgrade['data'],
// 应用商店
'store_theme_url' => StoreService::StoreThemeUrl(),
]);
2021-07-18 23:42:10 +08:00
return MyView($this->view_type);
2018-12-28 18:58:37 +08:00
}
/**
2024-04-15 10:25:01 +08:00
* 切换保存
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-19T00:58:47+0800
*/
public function Save()
{
2024-04-15 10:25:01 +08:00
return ApiService::ApiDataReturn(ThemeAdminService::ThemeAdminSwitch($this->data_request));
2018-12-28 18:58:37 +08:00
}
/**
* 删除
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-09T21:13:47+0800
*/
public function Delete()
{
2024-04-15 10:25:01 +08:00
return ApiService::ApiDataReturn(ThemeAdminService::ThemeAdminDelete($this->data_request));
2018-12-28 18:58:37 +08:00
}
/**
2024-04-15 10:25:01 +08:00
* 上传安装
2018-12-28 18:58:37 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-05-10T16:27:09+0800
*/
public function Upload()
{
2024-04-15 10:25:01 +08:00
return ApiService::ApiDataReturn(ThemeAdminService::ThemeAdminUpload($this->data_request));
2018-12-28 18:58:37 +08:00
}
2019-06-16 16:22:43 +08:00
/**
2024-04-15 10:25:01 +08:00
* 打包下载
2019-06-16 16:22:43 +08:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-03-22
* @desc description
*/
public function Download()
{
2024-04-15 10:25:01 +08:00
$ret = ThemeAdminService::ThemeAdminDownload($this->data_request);
2019-06-16 16:22:43 +08:00
if(isset($ret['code']) && $ret['code'] != 0)
{
2021-07-18 23:42:10 +08:00
MyViewAssign('msg', $ret['msg']);
return MyView('public/tips_error');
2019-06-16 16:22:43 +08:00
}
}
2018-12-28 18:58:37 +08:00
}
?>