提交 589b5f9e 编写于 作者: G gongfuxiang

应用配置信息优化

上级 a4a04d00
......@@ -80,7 +80,7 @@ class Plugins extends Common
);
$data = PluginsService::PluginsList($data_params);
$this->assign('data_list', $data['data']);
return $this->fetch();
}
......
......@@ -123,23 +123,24 @@ class Commontopmaxpicture extends Controller
{
// 基础信息
$base = [
'author' => 'Devil',
'blog' => 'http://gong.gg',
'name' => '顶部广告',
'author' => 'Devil',
'author_url' => 'https://shopxo.net/',
'version' => '1.0.0',
'desc' => '顶部大图广告,突破视觉',
'apply_terminal'=> ['pc'],
'apply_version' => ['1.3.0'],
'sales_amount' => 0,
];
// 控制器钩子
$control_hook = [
'plugins_control_hook' => [
'plugins_common_top' => ['app\\plugins\\commontopmaxpicture\\CommonTopMaxPicture'],
],
// 钩子
$hook = [
'plugins_common_top' => ['app\\plugins\\commontopmaxpicture\\Commontopmaxpicture'],
];
return [
'base' => $base,
'control_hook' => $control_hook,
'base' => $base,
'hook' => $hook,
];
}
......
......@@ -55,21 +55,36 @@ class PluginsService
*/
private static function PluginsDataHandle($data)
{
$result = [];
if(!empty($data))
{
foreach($data as &$v)
foreach($data as $v)
{
// 基础数据
$v['logo_old'] = $v['logo'];
$v['logo'] = ResourcesService::AttachmentPathViewHandle($v['logo']);
$v['apply_terminal'] = empty($v['apply_terminal']) ? '' : json_decode($v['apply_terminal'], true);
// 时间
$v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']);
$v['add_time_date'] = date('Y-m-d', $v['add_time']);
$config = self::GetPluginsConfig($v['plugins']);
if($config !== false)
{
$base = $config['base'];
$result[] = [
'id' => $v['id'],
'plugins' => $v['plugins'],
'logo_old' => $v['logo'],
'logo' => ResourcesService::AttachmentPathViewHandle($v['logo']),
'is_enable' => $v['is_enable'],
'name' => isset($base['name']) ? $base['name'] : '',
'author' => isset($base['author']) ? $base['author'] : '',
'author_url' => isset($base['author_url']) ? $base['author_url'] : '',
'version' => isset($base['version']) ? $base['version'] : '',
'desc' => isset($base['desc']) ? $base['desc'] : '',
'apply_version' => isset($base['apply_version']) ? $base['apply_version'] : [],
'apply_terminal'=> isset($base['apply_terminal']) ? $base['apply_terminal'] : [],
'add_time_time' => date('Y-m-d H:i:s', $v['add_time']),
'add_time_date' => date('Y-m-d', $v['add_time']),
];
}
}
}
return $data;
return $result;
}
/**
......@@ -234,5 +249,28 @@ class PluginsService
return DataReturn('删除失败或资源不存在', -100);
}
/**
* 获取应用配置信息
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-17
* @desc description
* @param [string] $plugins [应用名称]
*/
private static function GetPluginsConfig($plugins)
{
$plugins = '\app\plugins\\'.$plugins.'\\'.ucfirst($plugins);
if(class_exists($plugins))
{
$obj = new $plugins();
if(method_exists($obj, 'config'))
{
return $obj->config();
}
}
return false;
}
}
?>
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// | Author: Devil
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
......@@ -27,6 +27,6 @@ return [
'app_end' => [],
// 钩子测试
'plugins_common_top' => ['app\\plugins\\commontopmaxpicture\\CommonTopMaxPicture'],
'plugins_common_top' => ['app\\plugins\\commontopmaxpicture\\Commontopmaxpicture'],
];
?>
\ No newline at end of file
......@@ -9,7 +9,7 @@
Target Server Version : 50716
File Encoding : utf-8
Date: 02/09/2019 14:49:20 PM
Date: 02/11/2019 23:08:30 PM
*/
SET NAMES utf8;
......@@ -808,16 +808,9 @@ CREATE TABLE `s_payment` (
DROP TABLE IF EXISTS `s_plugins`;
CREATE TABLE `s_plugins` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
`name` char(30) NOT NULL COMMENT '名称',
`plugins` char(60) NOT NULL DEFAULT '' COMMENT '唯一标记',
`logo` char(255) NOT NULL DEFAULT '' COMMENT 'logo',
`version` char(255) NOT NULL DEFAULT '' COMMENT '版本',
`apply_version` char(255) NOT NULL DEFAULT '' COMMENT '适用系统版本',
`desc` char(255) NOT NULL DEFAULT '' COMMENT '描述',
`author` char(255) NOT NULL DEFAULT '' COMMENT '作者',
`author_url` char(255) NOT NULL DEFAULT '' COMMENT '作者主页',
`data` text COMMENT '应用数据',
`apply_terminal` char(255) NOT NULL COMMENT '适用终端 php一维数组json字符串存储(pc, wap, app, alipay, weixin, baidu)',
`is_enable` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否启用(0否,1是)',
`add_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
`upd_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
......@@ -830,7 +823,7 @@ CREATE TABLE `s_plugins` (
-- Records of `s_plugins`
-- ----------------------------
BEGIN;
INSERT INTO `s_plugins` VALUES ('1', '顶部大图广告', 'commontopmaxpicture', 'http://tp5-dev.com/static/upload/images/plugins_commontopmaxpicture/2019/02/09/1549671733987654.png', '1.0.0', '1.3.0', '顶部大图广告,突破视觉', 'Devil', 'https://shopxo.net/', '{\"images\":\"http:\\/\\/tp5-dev.com\\/static\\/upload\\/images\\/plugins_commontopmaxpicture\\/2019\\/02\\/09\\/1549671733978860.jpg\",\"bg_color\":\"#ce0000\",\"url\":\"https:\\/\\/shopxo.net\",\"is_new_window_open\":\"1\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\"}', '{\\\"pc\\\"}', '1', '0', '1549694936');
INSERT INTO `s_plugins` VALUES ('1', 'commontopmaxpicture', 'http://tp5-dev.com/static/upload/images/plugins_commontopmaxpicture/2019/02/09/1549671733987654.png', '{\"images\":\"http:\\/\\/tp5-dev.com\\/static\\/upload\\/images\\/plugins_commontopmaxpicture\\/2019\\/02\\/09\\/1549671733978860.jpg\",\"bg_color\":\"#ce0000\",\"url\":\"https:\\/\\/shopxo.net\",\"is_new_window_open\":\"1\",\"is_overall\":\"1\",\"time_start\":\"\",\"time_end\":\"\"}', '0', '0', '1549897473');
COMMIT;
-- ----------------------------
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册