mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-06 16:21:54 +08:00
后台插件管理新增排序功能、自定义显示顺序+插件调用顺序+细节优化
This commit is contained in:
@ -65,8 +65,8 @@ class Pluginsadmin extends Common
|
||||
// 页面类型
|
||||
if($this->view_type == 'home')
|
||||
{
|
||||
$data = PluginsAdminService::PluginsList();
|
||||
$this->assign('data_list', $data['data']);
|
||||
$ret = PluginsAdminService::PluginsList();
|
||||
$this->assign('data_list', $ret['data']);
|
||||
return $this->fetch();
|
||||
} else {
|
||||
return $this->fetch('upload');
|
||||
@ -94,10 +94,14 @@ class Pluginsadmin extends Common
|
||||
{
|
||||
// 获取数据
|
||||
$ret = PluginsAdminService::PluginsList();
|
||||
if(isset($ret['data'][$params['id']]))
|
||||
if(!empty($ret['data']) && is_array($ret['data']))
|
||||
{
|
||||
$data = $ret['data'][$params['id']];
|
||||
$params['plugins'] = $params['id'];
|
||||
$data = array_column($ret['data'], null, 'plugins');
|
||||
if(isset($data[$params['id']]))
|
||||
{
|
||||
$data = $data[$params['id']];
|
||||
$params['plugins'] = $params['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assign('data', $data);
|
||||
@ -263,5 +267,25 @@ class Pluginsadmin extends Common
|
||||
// 开始操作
|
||||
return PluginsAdminService::PluginsUninstall($this->data_request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序保存
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-01-05
|
||||
* @desc description
|
||||
*/
|
||||
public function SortSave()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error('非法访问');
|
||||
}
|
||||
|
||||
// 开始操作
|
||||
return PluginsAdminService::SortSave($this->data_post);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -10,7 +10,7 @@
|
||||
<!-- 表单顶部操作栏 -->
|
||||
{{block name="form_operate_top"}}
|
||||
<div class="am-dropdown am-margin-right-sm" data-am-dropdown>
|
||||
<button class="am-btn am-btn-secondary am-radius am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle>新增 <span class="am-icon-caret-down"></span></button>
|
||||
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle>新增 <span class="am-icon-caret-down"></span></button>
|
||||
<ul class="am-dropdown-content">
|
||||
<li>
|
||||
<button type="button" class="am-btn am-btn-link am-btn-xs am-btn-block am-text-left am-padding-horizontal-sm am-icon-plus submit-add" data-am-modal="{target: '#nav-custom-save-win'}" data-tag="nav-custom-save-win"> 自定义</button>
|
||||
|
||||
@ -6,13 +6,7 @@
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/pluginsadmin/saveinfo')}}" method="POST" request-type="form" enctype="multipart/form-data">
|
||||
<legend>
|
||||
<span class="am-text-default">
|
||||
{{if empty($data['id'])}}
|
||||
应用添加
|
||||
{{else /}}
|
||||
应用编辑
|
||||
{{/if}}
|
||||
</span>
|
||||
<span class="am-text-default">应用{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/index')}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
|
||||
</legend>
|
||||
|
||||
|
||||
@ -15,43 +15,86 @@
|
||||
{{/if}}
|
||||
<!-- operation end -->
|
||||
|
||||
{{if !empty($data_list)}}
|
||||
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-1 am-avg-md-2 am-avg-lg-3 am-gallery-bordered" data-am-gallery="{}">
|
||||
{{foreach $data_list as $v}}
|
||||
<li>
|
||||
<div id="data-list-{{$v.plugins}}" class="am-gallery-item {{if $v['is_enable'] neq 1}}am-active{{/if}}">
|
||||
<img src="{{$v.logo}}" class="icon" />
|
||||
<div class="base">
|
||||
<h3 class="name">{{$v.name}}</h3>
|
||||
<p>作者:{{$v.author}}</p>
|
||||
<p>主页:<a href="{{$v.author_url}}" target="_blank">{{$v.author_url}}</a></p>
|
||||
<p>版本:{{$v.version}}</p>
|
||||
</div>
|
||||
<div class="am-gallery-desc">{{$v.desc}}</div>
|
||||
<div class="operation">
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/saveinfo', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit" title="编辑"></a>
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/download', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-download" title="打包"></a>
|
||||
{{/if}}
|
||||
<div class="am-alert">
|
||||
<p>1 列表排序方式[ 自定义排序 -> 最早安装 ]</p>
|
||||
<p>
|
||||
<span>2. 可点击拖动图标按钮调整插件调用和展示顺序</span>
|
||||
<button type="button" class="am-btn am-btn-success am-radius am-btn-xs am-margin-left-xs am-icon-sort-numeric-asc submit-move-sort-open"> 开启排序</button>
|
||||
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-margin-left-xs am-icon-check submit-move-sort-save am-hide"> 保存</button>
|
||||
<button type="button" class="am-btn am-btn-danger am-radius am-btn-xs am-margin-left-xs am-icon-close submit-move-sort-cancel am-hide"> 取消</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{if !empty($data_list)}}
|
||||
<!-- 已安装 -->
|
||||
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-1 am-avg-md-2 am-avg-lg-3 am-gallery-bordered already-install" data-am-gallery="{}" data-sort-save-url="{{:MyUrl('admin/pluginsadmin/sortsave')}}">
|
||||
{{foreach $data_list as $v}}
|
||||
{{if isset($v['is_install']) and $v['is_install'] eq 1}}
|
||||
<li data-id="{{$v.id}}" data-plugins="{{$v.plugins}}">
|
||||
<div class="am-gallery-item {{if $v['is_enable'] eq 0}}am-active{{/if}}" id="data-list-{{$v.plugins}}">
|
||||
<img src="{{$v.logo}}" class="icon" />
|
||||
<div class="base">
|
||||
<h3 class="name">{{$v.name}}</h3>
|
||||
<p>作者:{{$v.author}}</p>
|
||||
<p>主页:<a href="{{$v.author_url}}" target="_blank">{{$v.author_url}}</a></p>
|
||||
<p>版本:{{$v.version}}</p>
|
||||
</div>
|
||||
<div class="am-gallery-desc">{{$v.desc}}</div>
|
||||
<div class="operation">
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/saveinfo', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit" title="编辑"></a>
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/download', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-download" title="打包"></a>
|
||||
{{/if}}
|
||||
|
||||
{{if isset($v['is_install']) and $v['is_install'] eq 1}}
|
||||
<a href="{{:PluginsAdminUrl($v['plugins'], 'admin', 'index')}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-gear" title="设置"></a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-circle-o submit-ajax" data-url="{{:MyUrl('admin/pluginsadmin/uninstall')}}" data-id="{{$v.plugins}}" data-view="reload" data-msg="卸载将删除基础数据不可恢复、确认操作吗?" title="卸载"></button>
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-circle-o submit-ajax" data-url="{{:MyUrl('admin/pluginsadmin/uninstall')}}" data-id="{{$v.plugins}}" data-view="reload" data-msg="卸载可能丢失插件基础数据不可恢复、确认操作吗?" title="卸载"></button>
|
||||
|
||||
<a href="javascript:;" class="am-icon-btn am-icon-check submit-state {{if $v['is_enable'] eq 1}}am-success{{else /}}am-default{{/if}}" data-url="{{:MyUrl('admin/pluginsadmin/statusupdate')}}" data-id="{{$v.plugins}}" data-state="{{$v['is_enable']}}" data-is-update-status="1" title="状态"></a>
|
||||
{{else /}}
|
||||
|
||||
{{if isset($v['is_home']) and $v['is_home'] eq true}}
|
||||
<a href="{{:PluginsHomeUrl($v['plugins'], 'index', 'index')}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-home" title="首页" target="_blank"></a>
|
||||
{{/if}}
|
||||
|
||||
<button type="button" class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-arrows submit-move am-hide" title="排序"></button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
|
||||
<!-- 未安装 -->
|
||||
<div class="am-text-center am-margin-top-lg am-margin-bottom-xs">
|
||||
<strong class="am-text-lg">以下插件未安装</strong>
|
||||
</div>
|
||||
<hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-top-0" />
|
||||
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-1 am-avg-md-2 am-avg-lg-3 am-gallery-bordered" data-am-gallery="{}" data-sort-save-url="{{:MyUrl('admin/pluginsadmin/sortsave')}}">
|
||||
{{foreach $data_list as $v}}
|
||||
{{if !isset($v['is_install']) or $v['is_install'] eq 0}}
|
||||
<li data-id="{{$v.id}}" data-plugins="{{$v.plugins}}">
|
||||
<div class="am-gallery-item am-active" id="data-list-{{$v.plugins}}">
|
||||
<img src="{{$v.logo}}" class="icon" />
|
||||
<div class="base">
|
||||
<h3 class="name">{{$v.name}}</h3>
|
||||
<p>作者:{{$v.author}}</p>
|
||||
<p>主页:<a href="{{$v.author_url}}" target="_blank">{{$v.author_url}}</a></p>
|
||||
<p>版本:{{$v.version}}</p>
|
||||
</div>
|
||||
<div class="am-gallery-desc">{{$v.desc}}</div>
|
||||
<div class="operation">
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/saveinfo', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit" title="编辑"></a>
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/download', array('id'=>$v['plugins']))}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-download" title="打包"></a>
|
||||
{{/if}}
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-remove submit-delete-modal" data-url="{{:MyUrl('admin/pluginsadmin/delete')}}" data-id="{{$v.plugins}}" title="删除"></button>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes submit-ajax" data-url="{{:MyUrl('admin/pluginsadmin/install')}}" data-id="{{$v.plugins}}" data-view="reload" data-msg="进行安装操作、确认继续吗?" title="安装"></button>
|
||||
{{/if}}
|
||||
|
||||
{{if isset($v['is_home']) and $v['is_home'] eq true}}
|
||||
<a href="{{:PluginsHomeUrl($v['plugins'], 'index', 'index')}}" class="am-btn am-btn-default am-btn-xs am-radius am-icon-home" title="首页" target="_blank"></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
|
||||
|
||||
@ -6,13 +6,7 @@
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/pluginsadmin/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/pluginsadmin/index')}}" enctype="multipart/form-data">
|
||||
<legend>
|
||||
<span class="am-text-default">
|
||||
{{if empty($data['id'])}}
|
||||
应用添加
|
||||
{{else /}}
|
||||
应用编辑
|
||||
{{/if}}
|
||||
</span>
|
||||
<span class="am-text-default">应用{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
|
||||
<a href="{{:MyUrl('admin/pluginsadmin/index')}}" class="am-fr am-text-sm am-margin-top-xs am-icon-mail-reply"> 返回</a>
|
||||
</legend>
|
||||
|
||||
@ -81,7 +75,6 @@
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
|
||||
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -378,17 +378,7 @@ class Common extends Controller
|
||||
$this->assign('goods_category_list', GoodsService::GoodsCategoryAll());
|
||||
|
||||
// 搜索框下热门关键字
|
||||
$home_search_keywords = [];
|
||||
switch(intval(MyC('home_search_keywords_type', 0)))
|
||||
{
|
||||
case 1 :
|
||||
$home_search_keywords = SearchService::SearchKeywordsList();
|
||||
break;
|
||||
case 2 :
|
||||
$home_search_keywords = explode(',', MyC('home_search_keywords'));
|
||||
break;
|
||||
}
|
||||
$this->assign('home_search_keywords', $home_search_keywords);
|
||||
$this->assign('home_search_keywords', SearchService::SearchKeywordsList());
|
||||
|
||||
// 友情链接
|
||||
$link = LinkService::LinkList(['where'=>['is_enable'=>1]]);
|
||||
|
||||
@ -2513,9 +2513,11 @@ class GoodsService
|
||||
$add_time = strtotime($add_time);
|
||||
}
|
||||
|
||||
// 自定义路径和名称
|
||||
// 自定义路径
|
||||
$path = 'static'.DS.'upload'.DS.'images'.DS.'goods_qrcode'.DS.APPLICATION_CLIENT_TYPE.DS.date('Y', $add_time).DS.date('m', $add_time).DS.date('d', $add_time).DS;
|
||||
$filename = $goods_id.'.png';
|
||||
|
||||
// 名称增加站点模式(站点模式不一样商品url地址也会不一样)
|
||||
$filename = $goods_id.MyC('common_site_type', 0, true).'.png';
|
||||
|
||||
// 二维码处理参数
|
||||
$params = [
|
||||
|
||||
@ -30,6 +30,9 @@ class PluginsAdminService
|
||||
// 排除的文件后缀
|
||||
private static $exclude_ext = ['php'];
|
||||
|
||||
// 读取插件排序方式(自定义排序 -> 最早安装)
|
||||
private static $plugins_order_by = 'sort asc,id asc';
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @author Devil
|
||||
@ -42,27 +45,33 @@ class PluginsAdminService
|
||||
public static function PluginsList($params = [])
|
||||
{
|
||||
$data = [];
|
||||
$db_data = [];
|
||||
$dir_data = [];
|
||||
$plugins_dir = APP_PATH.'plugins'.DS;
|
||||
if(is_dir($plugins_dir))
|
||||
{
|
||||
if($dh = opendir($plugins_dir))
|
||||
{
|
||||
// 获取数据库已安装插件
|
||||
$db_data = Db::name('Plugins')->order(self::$plugins_order_by)->column('*', 'plugins');
|
||||
|
||||
// 获取目录所有插件
|
||||
while(($temp_file = readdir($dh)) !== false)
|
||||
{
|
||||
if(!in_array($temp_file, ['.', '..', '/', 'view', 'index.html']) && substr($temp_file, 0, 1) != '.')
|
||||
{
|
||||
// 获取插件配置信息
|
||||
$config = self::GetPluginsConfig($temp_file);
|
||||
if($config !== false)
|
||||
if($config !== false && !empty($config['base']))
|
||||
{
|
||||
// 获取数据库配置信息
|
||||
$db_config = Db::name('Plugins')->where(['plugins'=>$config['base']['plugins']])->find();
|
||||
$base = $config['base'];
|
||||
$db_config = array_key_exists($base['plugins'], $db_data) ? $db_data[$base['plugins']] : [];
|
||||
|
||||
// 数据组装
|
||||
$base = $config['base'];
|
||||
$data[$config['base']['plugins']] = [
|
||||
'id' => empty($db_config['id']) ? date('YmdHis').GetNumberCode(8) : $db_config['id'],
|
||||
'plugins' => isset($base['plugins']) ? $base['plugins'] : '',
|
||||
$dir_data[$base['plugins']] = [
|
||||
'id' => empty($db_config['id']) ? 0 : $db_config['id'],
|
||||
'plugins' => $base['plugins'],
|
||||
'is_enable' => isset($db_config['is_enable']) ? $db_config['is_enable'] : 0,
|
||||
'is_install' => empty($db_config) ? 0 : 1,
|
||||
'logo_old' => $base['logo'],
|
||||
@ -85,6 +94,23 @@ class PluginsAdminService
|
||||
}
|
||||
}
|
||||
|
||||
// 存在插件和数据库插件数据则处理排序合并
|
||||
if(!empty($dir_data) && !empty($db_data))
|
||||
{
|
||||
$temp_data = [];
|
||||
foreach($db_data as $v)
|
||||
{
|
||||
if(array_key_exists($v['plugins'], $dir_data))
|
||||
{
|
||||
$temp_data[] = $dir_data[$v['plugins']];
|
||||
unset($dir_data[$v['plugins']]);
|
||||
}
|
||||
}
|
||||
$data = array_merge($temp_data, array_values($dir_data));
|
||||
} else {
|
||||
$data = array_values($dir_data);
|
||||
}
|
||||
|
||||
return DataReturn('处理成功', 0, $data);
|
||||
}
|
||||
|
||||
@ -107,10 +133,11 @@ class PluginsAdminService
|
||||
|
||||
// 数据处理
|
||||
$config = self::GetPluginsConfig($params['id']);;
|
||||
if($config !== false)
|
||||
if($config !== false && !empty($config['base']) && !empty($config['base']['name']))
|
||||
{
|
||||
$cache = PluginsService::PluginsCacheData($params['id']);
|
||||
$data = [
|
||||
'name' => $config['base']['name'],
|
||||
'plugins' => $params['id'],
|
||||
'data' => empty($cache) ? '' : json_encode($cache),
|
||||
'is_enable' => 0,
|
||||
@ -292,7 +319,7 @@ class PluginsAdminService
|
||||
}
|
||||
|
||||
// 处理应用钩子
|
||||
$data = Db::name('Plugins')->where(['is_enable'=>1])->column('plugins');
|
||||
$data = Db::name('Plugins')->where(['is_enable'=>1])->order(self::$plugins_order_by)->column('plugins');
|
||||
if(!empty($data))
|
||||
{
|
||||
foreach($data as $plugins)
|
||||
@ -518,7 +545,7 @@ class PluginsAdminService
|
||||
|
||||
// 应用目录不存在则创建
|
||||
$app_dir = APP_PATH.'plugins'.DS.$plugins;
|
||||
if(\base\FileUtil::CreateDir($app_dir) !== true)
|
||||
if(!is_dir($app_dir) && \base\FileUtil::CreateDir($app_dir) !== true)
|
||||
{
|
||||
return DataReturn('应用主目录创建失败', -10);
|
||||
}
|
||||
@ -537,7 +564,7 @@ class PluginsAdminService
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return DataReturn(empty($params['id']) ? '创建成功' : '更新成功', 0);
|
||||
return DataReturn('操作成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -729,60 +756,55 @@ h1 {
|
||||
php;
|
||||
// 静态文件目录
|
||||
$app_static_css_dir = ROOT.'public'.DS.'static'.DS.'plugins'.DS.'css'.DS.trim($params['plugins']);
|
||||
if(\base\FileUtil::CreateDir($app_static_css_dir) !== true)
|
||||
if(!is_dir($app_static_css_dir) && \base\FileUtil::CreateDir($app_static_css_dir) !== true)
|
||||
{
|
||||
return DataReturn('应用静态目录创建失败[css]', -10);
|
||||
} else {
|
||||
// 后端css目录创建
|
||||
if(\base\FileUtil::CreateDir($app_static_css_dir.DS.'admin') !== true)
|
||||
if(!is_dir($app_static_css_dir.DS.'admin') && \base\FileUtil::CreateDir($app_static_css_dir.DS.'admin') !== true)
|
||||
{
|
||||
return DataReturn('应用静态目录创建失败[css/admin]', -10);
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑模式下不生成后端文件
|
||||
if(empty($params['id']))
|
||||
// 后端admin目录创建
|
||||
if(!is_dir($app_dir.DS.'admin') && \base\FileUtil::CreateDir($app_dir.DS.'admin') !== true)
|
||||
{
|
||||
// 后端admin目录创建
|
||||
if(\base\FileUtil::CreateDir($app_dir.DS.'admin') !== true)
|
||||
{
|
||||
return DataReturn('应用后端目录创建失败[admin]', -10);
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
if(@file_put_contents($app_dir.DS.'admin'.DS.'Admin.php', $admin) === false)
|
||||
{
|
||||
return DataReturn('应用文件创建失败[Admin.php]', -11);
|
||||
}
|
||||
if(@file_put_contents($app_dir.DS.'Hook.php', $hook) === false)
|
||||
{
|
||||
return DataReturn('应用文件创建失败[Hook.php]', -11);
|
||||
}
|
||||
|
||||
// 应用后台视图目录不存在则创建
|
||||
$app_view_admin_dir = APP_PATH.'plugins'.DS.'view'.DS.trim($params['plugins']).DS.'admin'.DS.'admin';
|
||||
if(\base\FileUtil::CreateDir($app_view_admin_dir) !== true)
|
||||
{
|
||||
return DataReturn('应用视图目录创建失败[admin]', -10);
|
||||
}
|
||||
if(@file_put_contents($app_view_admin_dir.DS.'index.html', $admin_view) === false)
|
||||
{
|
||||
return DataReturn('应用视图文件创建失败[admin-view]', -11);
|
||||
}
|
||||
|
||||
// css创建
|
||||
if(@file_put_contents($app_static_css_dir.DS.'admin'.DS.'admin.css', $admin_css) === false)
|
||||
{
|
||||
return DataReturn('应用静态文件创建失败[admin-css]', -11);
|
||||
}
|
||||
return DataReturn('应用后端目录创建失败[admin]', -10);
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
if(!file_exists($app_dir.DS.'admin'.DS.'Admin.php') && @file_put_contents($app_dir.DS.'admin'.DS.'Admin.php', $admin) === false)
|
||||
{
|
||||
return DataReturn('应用文件创建失败[Admin.php]', -11);
|
||||
}
|
||||
if(!file_exists($app_dir.DS.'Hook.php') && @file_put_contents($app_dir.DS.'Hook.php', $hook) === false)
|
||||
{
|
||||
return DataReturn('应用文件创建失败[Hook.php]', -11);
|
||||
}
|
||||
|
||||
// 应用后台视图目录不存在则创建
|
||||
$app_view_admin_dir = APP_PATH.'plugins'.DS.'view'.DS.trim($params['plugins']).DS.'admin'.DS.'admin';
|
||||
if(!is_dir($app_view_admin_dir) && \base\FileUtil::CreateDir($app_view_admin_dir) !== true)
|
||||
{
|
||||
return DataReturn('应用视图目录创建失败[admin]', -10);
|
||||
}
|
||||
if(!file_exists($app_view_admin_dir.DS.'index.html') && @file_put_contents($app_view_admin_dir.DS.'index.html', $admin_view) === false)
|
||||
{
|
||||
return DataReturn('应用视图文件创建失败[admin-view]', -11);
|
||||
}
|
||||
|
||||
// css创建
|
||||
if(!file_exists($app_static_css_dir.DS.'admin'.DS.'admin.css') && @file_put_contents($app_static_css_dir.DS.'admin'.DS.'admin.css', $admin_css) === false)
|
||||
{
|
||||
return DataReturn('应用静态文件创建失败[admin-css]', -11);
|
||||
}
|
||||
|
||||
// 是否有前端页面
|
||||
if(isset($params['is_home']) && $params['is_home'] == 1)
|
||||
{
|
||||
// 前端index目录创建
|
||||
if(\base\FileUtil::CreateDir($app_dir.DS.'index') !== true)
|
||||
if(!is_dir($app_dir.DS.'index') && \base\FileUtil::CreateDir($app_dir.DS.'index') !== true)
|
||||
{
|
||||
return DataReturn('应用前端目录创建失败[index]', -10);
|
||||
}
|
||||
@ -815,15 +837,9 @@ php;
|
||||
{
|
||||
return DataReturn('应用静态文件创建失败[index-css]', -11);
|
||||
}
|
||||
|
||||
// 没有独立前端页面则删除文件
|
||||
} else {
|
||||
\base\FileUtil::UnlinkFile($app_dir.DS.'index'.DS.'Index.php');
|
||||
\base\FileUtil::UnlinkDir(APP_PATH.'plugins'.DS.'view'.DS.trim($params['plugins']).DS.'index');
|
||||
\base\FileUtil::UnlinkFile($app_static_css_dir.DS.'index'.DS.'index.css');
|
||||
}
|
||||
|
||||
return DataReturn('创建成功', 0);
|
||||
return DataReturn('操作成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -865,20 +881,24 @@ php;
|
||||
'hook' => (object) $hook,
|
||||
];
|
||||
|
||||
// 文件存在是否有权限
|
||||
// 文件是否存在、存在判断权限、则创建
|
||||
$config_file = $app_dir.DS.'config.json';
|
||||
if(file_exists($config_file) && !is_writable($config_file))
|
||||
if(file_exists($config_file))
|
||||
{
|
||||
return DataReturn('应用配置文件没有操作权限'.'['.$config_file.']', -3);
|
||||
// 文件存在是否有权限
|
||||
if(!is_writable($config_file))
|
||||
{
|
||||
return DataReturn('应用配置文件没有操作权限'.'['.$config_file.']', -3);
|
||||
}
|
||||
} else {
|
||||
// 创建配置文件
|
||||
if(@file_put_contents($config_file, JsonFormat($data)) === false)
|
||||
{
|
||||
return DataReturn('应用配置文件创建失败', -10);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建配置文件
|
||||
if(@file_put_contents($config_file, JsonFormat($data)) === false)
|
||||
{
|
||||
return DataReturn('应用配置文件创建失败', -10);
|
||||
}
|
||||
|
||||
return DataReturn('创建成功', 0);
|
||||
return DataReturn('操作成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1280,5 +1300,69 @@ php;
|
||||
return DataReturn('下载失败', -100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序保存
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-01-05
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function SortSave($params = [])
|
||||
{
|
||||
// 请求类型
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'data',
|
||||
'error_msg' => '没有可保存的插件数据',
|
||||
]
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 排序数据、非数组则当做json转换一次
|
||||
$data = is_array($params['data']) ? $params['data'] : json_decode($params['data'], true);
|
||||
if(!empty($data) && is_array($data))
|
||||
{
|
||||
// 启动事务
|
||||
Db::startTrans();
|
||||
|
||||
// 捕获异常
|
||||
try {
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
$upd_data = [
|
||||
'sort' => intval($k),
|
||||
'add_time' => time(),
|
||||
];
|
||||
if(Db::name('Plugins')->where(['id'=>intval($v)])->update($upd_data) === false)
|
||||
{
|
||||
throw new \Exception('操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 钩子部署
|
||||
$ret = self::PluginsHookDeployment();
|
||||
if($ret['code'] != 0)
|
||||
{
|
||||
throw new \Exception($ret['msg']);
|
||||
}
|
||||
|
||||
// 完成
|
||||
Db::commit();
|
||||
return DataReturn('操作成功', 0);
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
return DataReturn($e->getMessage(), -1);
|
||||
}
|
||||
}
|
||||
return DataReturn('插件排序数据有误', -1);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -210,19 +210,32 @@ class SearchService
|
||||
}
|
||||
|
||||
/**
|
||||
* [SearchKeywordsList 获取热门关键字列表]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-10-20T23:55:06+0800
|
||||
* @param [array] $params [输入参数]
|
||||
* 搜索关键字列表
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-01-03
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function SearchKeywordsList($params = [])
|
||||
{
|
||||
$where = [
|
||||
['keywords', '<>', ''],
|
||||
];
|
||||
return Db::name('SearchHistory')->where($where)->group('keywords')->limit(10)->column('keywords');
|
||||
// 搜索框下热门关键字
|
||||
$data = [];
|
||||
switch(intval(MyC('home_search_keywords_type', 0)))
|
||||
{
|
||||
case 1 :
|
||||
$data = Db::name('SearchHistory')->where([['keywords', '<>', '']])->group('keywords')->limit(10)->column('keywords');
|
||||
break;
|
||||
case 2 :
|
||||
$keywords = MyC('home_search_keywords', '', true);
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$data = explode(',', $keywords);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -35,18 +35,22 @@ return array (
|
||||
'plugins_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\share\\Hook',
|
||||
1 => 'app\\plugins\\points\\Hook',
|
||||
2 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
1 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
2 => 'app\\plugins\\exchangerate\\Hook',
|
||||
3 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
4 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_js' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\share\\Hook',
|
||||
1 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
3 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_view_common_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\share\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
),
|
||||
'plugins_common_page_bottom' =>
|
||||
array (
|
||||
@ -58,48 +62,128 @@ return array (
|
||||
),
|
||||
'plugins_service_navigation_header_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_pc' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_h5' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_weixin' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_alipay' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_baidu' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_qq' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_toutiao' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_goods_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
1 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
3 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_goods_spec_base' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_service_buy_group_goods_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_user_login_success_record' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_service_goods_spec_extends_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_view_admin_user_save' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_service_user_save_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_service_goods_save_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_panel_price_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_view_home_goods_inside_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_view_search_goods_inside_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_service_goods_spec_type' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
),
|
||||
'plugins_service_users_center_left_menu_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_header_navigation_top_right_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\membershiplevelvip\\Hook',
|
||||
1 => 'app\\plugins\\signin\\Hook',
|
||||
2 => 'app\\plugins\\exchangerate\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_pc' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_h5' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_weixin' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_alipay' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_baidu' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_qq' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_quick_navigation_toutiao' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
1 => 'app\\plugins\\exchangerate\\Hook',
|
||||
2 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_currency_data' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\exchangerate\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_base_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_home_floor_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_buy_form_inside' =>
|
||||
array (
|
||||
@ -109,10 +193,6 @@ return array (
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_buy_group_goods_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_buy_order_insert_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
@ -121,25 +201,5 @@ return array (
|
||||
array (
|
||||
0 => 'app\\plugins\\points\\Hook',
|
||||
),
|
||||
'plugins_service_users_center_left_menu_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_header_navigation_top_right_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\signin\\Hook',
|
||||
),
|
||||
'plugins_service_goods_spec_base' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_base_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
'plugins_view_home_floor_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\limitedtimediscount\\Hook',
|
||||
),
|
||||
);
|
||||
?>
|
||||
@ -18,7 +18,7 @@ web端
|
||||
4. 友情链接新增手机端显隐控制
|
||||
5. 公共动态数据表单参数优化
|
||||
6. 动态数据列表组件条件新增气泡式弹出层
|
||||
|
||||
7. 后台插件管理新增排序功能、自定义显示顺序+插件调用顺序
|
||||
|
||||
|
||||
小程序
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -6,22 +6,25 @@
|
||||
width: calc(100% + 10px);
|
||||
margin-left: -5px;
|
||||
}
|
||||
.content ul.am-gallery-bordered .icon {
|
||||
.content ul.am-gallery-bordered li .am-gallery-item {
|
||||
height: 197px;
|
||||
}
|
||||
.content ul.am-gallery-bordered li .icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 3px 6px 0px rgba(0,0,0,.4);
|
||||
}
|
||||
.content ul.am-gallery-bordered.am-gallery-bordered .am-gallery-item {
|
||||
.content ul.am-gallery-bordered .am-gallery-item {
|
||||
box-shadow: none;
|
||||
border: 1px solid #d4d4d4;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.content ul.am-gallery-bordered.am-gallery-bordered .am-gallery-item.am-active {
|
||||
.content ul.am-gallery-bordered .am-gallery-item.am-active {
|
||||
border: 1px solid #ff8a8a !important;
|
||||
background: #fff2f2;
|
||||
}
|
||||
.content ul.am-gallery-bordered.am-gallery-bordered .am-gallery-item:hover {
|
||||
.content ul.am-gallery-bordered .am-gallery-item:hover {
|
||||
border: 1px solid #999;
|
||||
box-shadow: 0px 12px 12px -10px rgba(0,0,0,.4);
|
||||
}
|
||||
@ -52,7 +55,7 @@
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.content ul.am-gallery-bordered.am-gallery-bordered .am-gallery-desc {
|
||||
.content ul.am-gallery-bordered .am-gallery-desc {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
@ -78,8 +81,18 @@
|
||||
.content ul.am-gallery-bordered li .submit-state.am-default {
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
.content ul.am-gallery-bordered li .submit-move {
|
||||
cursor: move !important;
|
||||
}
|
||||
.content ul.already-install .am-gallery-item.am-active {
|
||||
border: 1px solid #f8815d !important;
|
||||
background: #fffbf5;
|
||||
}
|
||||
@media only screen and (max-width: 641px) {
|
||||
.content ul.am-gallery-bordered .icon {
|
||||
.content ul.am-gallery-bordered li .am-gallery-item {
|
||||
height: 187px;
|
||||
}
|
||||
.content ul.am-gallery-bordered li .icon {
|
||||
width: 65px;
|
||||
height: 65px;
|
||||
}
|
||||
|
||||
@ -10,14 +10,16 @@ $(function()
|
||||
if(theme != undefined)
|
||||
{
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url:$('.data-list').data('select-url'),
|
||||
type:'POST',
|
||||
dataType:"json",
|
||||
timeout:10000,
|
||||
data:{"theme":theme, "nav_type":$('.data-list').data('nav-type')},
|
||||
success:function(result)
|
||||
url: $('.data-list').data('select-url'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 10000,
|
||||
data: {"theme":theme, "nav_type":$('.data-list').data('nav-type')},
|
||||
success: function(result)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
if(result.code == 0)
|
||||
{
|
||||
$('.am-gallery-item').removeClass('theme-active');
|
||||
@ -27,9 +29,10 @@ $(function()
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error:function()
|
||||
error: function(xhr, type)
|
||||
{
|
||||
Prompt('服务器错误');
|
||||
$.AMUI.progress.done();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -4,14 +4,16 @@ $(function()
|
||||
$('.test-email-submit').on('click', function()
|
||||
{
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url:$(this).data('url'),
|
||||
type:'POST',
|
||||
dataType:"json",
|
||||
timeout:30000,
|
||||
data:{"email":$('.test-email-value').val()},
|
||||
success:function(result)
|
||||
url: $(this).data('url'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 30000,
|
||||
data: {"email":$('.test-email-value').val()},
|
||||
success: function(result)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
if(result.code == 0)
|
||||
{
|
||||
Prompt(result.msg, 'success');
|
||||
@ -19,10 +21,11 @@ $(function()
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error:function()
|
||||
{
|
||||
Prompt('服务器错误');
|
||||
}
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -1,9 +1,80 @@
|
||||
$(function()
|
||||
{
|
||||
// 删除提示
|
||||
$('.submit-delete-modal').on('click', function()
|
||||
{
|
||||
var $modal = $('#plugins-delete-modal');
|
||||
$modal.find('button.submit-ajax').attr('data-id', $(this).data('id'));
|
||||
$modal.modal('open');
|
||||
});
|
||||
|
||||
// 拖拽
|
||||
$('.content ul.am-gallery-bordered').dragsort({ dragSelector: 'button.submit-move', placeHolderTemplate: '<li><div class="am-gallery-item drag-sort-dotted"></div></li>'});
|
||||
|
||||
// 排序开启/取消/保存
|
||||
$('.submit-move-sort-open').on('click', function()
|
||||
{
|
||||
$('.submit-move-sort-open').addClass('am-hide');
|
||||
$('.submit-move-sort-save').removeClass('am-hide');
|
||||
$('.submit-move-sort-cancel').removeClass('am-hide');
|
||||
$('.content ul.am-gallery-bordered li .submit-move').removeClass('am-hide');
|
||||
});
|
||||
$('.submit-move-sort-cancel').on('click', function()
|
||||
{
|
||||
$('.submit-move-sort-open').removeClass('am-hide');
|
||||
$('.submit-move-sort-save').addClass('am-hide');
|
||||
$('.submit-move-sort-cancel').addClass('am-hide');
|
||||
$('.content ul.am-gallery-bordered li .submit-move').addClass('am-hide');
|
||||
});
|
||||
$('.submit-move-sort-save').on('click', function()
|
||||
{
|
||||
var json = {};
|
||||
$('.content ul.am-gallery-bordered li').each(function(k, v)
|
||||
{
|
||||
var id = parseInt($(this).data('id')) || 0;
|
||||
if(id > 0)
|
||||
{
|
||||
json[k] = id;
|
||||
}
|
||||
});
|
||||
var len = 0;
|
||||
for(var i in json)
|
||||
{
|
||||
len++;
|
||||
}
|
||||
if(len <= 0)
|
||||
{
|
||||
Prompt('没有可保存的插件数据');
|
||||
return false;
|
||||
}
|
||||
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url: $('.content ul.am-gallery-bordered').data('sort-save-url'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 10000,
|
||||
data: {"data": json},
|
||||
success: function(result)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
if(result.code == 0)
|
||||
{
|
||||
$('.submit-move-sort-open').removeClass('am-hide');
|
||||
$('.submit-move-sort-save').addClass('am-hide');
|
||||
$('.submit-move-sort-cancel').addClass('am-hide');
|
||||
$('.content ul.am-gallery-bordered li .submit-move').addClass('am-hide');
|
||||
Prompt(result.msg, 'success');
|
||||
} else {
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -205,6 +205,7 @@ $(function()
|
||||
});
|
||||
|
||||
var $this = $(this);
|
||||
$.AMUI.progress.start();
|
||||
$this.button('loading');
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
|
||||
$.ajax({
|
||||
@ -212,8 +213,9 @@ $(function()
|
||||
type: 'post',
|
||||
data: {"page":page, "category_id":category_id, "keywords":keywords, "goods_ids":goods_ids},
|
||||
dataType: 'json',
|
||||
success:function(res)
|
||||
success: function(res)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
$this.button('reset');
|
||||
if(res.code == 0)
|
||||
{
|
||||
@ -225,11 +227,13 @@ $(function()
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> '+res.msg+'</div>');
|
||||
}
|
||||
},
|
||||
error:function(res)
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
$this.button('reset');
|
||||
Prompt('请求失败');
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> 请求失败</div>');
|
||||
var msg = HtmlToString(xhr.responseText) || '异常错误';
|
||||
Prompt(msg, null, 30);
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> '+msg+'</div>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -10,14 +10,16 @@ $(function()
|
||||
if(theme != undefined)
|
||||
{
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url:$('.data-list').data('select-url'),
|
||||
type:'POST',
|
||||
dataType:"json",
|
||||
timeout:10000,
|
||||
data:{"theme":theme},
|
||||
success:function(result)
|
||||
url: $('.data-list').data('select-url'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 10000,
|
||||
data: {"theme":theme},
|
||||
success: function(result)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
if(result.code == 0)
|
||||
{
|
||||
$('.am-gallery-item').removeClass('theme-active');
|
||||
@ -27,10 +29,11 @@ $(function()
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error:function()
|
||||
{
|
||||
Prompt('服务器错误');
|
||||
}
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ $(function()
|
||||
}
|
||||
|
||||
var $this = $(this);
|
||||
$.AMUI.progress.start();
|
||||
$this.button('loading');
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
|
||||
$.ajax({
|
||||
@ -48,6 +49,7 @@ $(function()
|
||||
dataType: 'json',
|
||||
success:function(res)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
$this.button('reset');
|
||||
if(res.code == 0)
|
||||
{
|
||||
@ -59,11 +61,13 @@ $(function()
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> '+res.msg+'</div>');
|
||||
}
|
||||
},
|
||||
error:function(res)
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
$this.button('reset');
|
||||
Prompt('请求失败');
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> 请求失败</div>');
|
||||
var msg = HtmlToString(xhr.responseText) || '异常错误';
|
||||
Prompt(msg, null, 30);
|
||||
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> '+msg+'</div>');
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -83,13 +87,15 @@ $(function()
|
||||
return false;
|
||||
}
|
||||
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'post',
|
||||
data: {"warehouse_id":warehouse_id, "goods_id":goods_id},
|
||||
dataType: 'json',
|
||||
success:function(res)
|
||||
success: function(res)
|
||||
{
|
||||
$.AMUI.progress.done();
|
||||
if(res.code == 0)
|
||||
{
|
||||
$this.parent().html(icon_html);
|
||||
@ -98,9 +104,10 @@ $(function()
|
||||
Prompt(res.msg);
|
||||
}
|
||||
},
|
||||
error:function(res)
|
||||
error: function(xhr, type)
|
||||
{
|
||||
Prompt('请求失败');
|
||||
$.AMUI.progress.done();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -38,10 +38,10 @@ function GoodsCommentsHtml(page)
|
||||
|
||||
$.ajax({
|
||||
url: $('.goods-comment').data('url'),
|
||||
type:'POST',
|
||||
data:{"goods_id": $('.goods-comment').data('goods-id'), "page": page || 1},
|
||||
dataType:'json',
|
||||
success:function(result)
|
||||
type: 'POST',
|
||||
data: {"goods_id": $('.goods-comment').data('goods-id'), "page": page || 1},
|
||||
dataType: 'json',
|
||||
success: function(result)
|
||||
{
|
||||
$('.goods-page-no-data').addClass('none');
|
||||
if(result.code == 0)
|
||||
@ -57,10 +57,10 @@ function GoodsCommentsHtml(page)
|
||||
$('.goods-page-no-data span').text('没有评论数据');
|
||||
}
|
||||
},
|
||||
error:function(result)
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$('.goods-page-no-data').removeClass('none');
|
||||
$('.goods-page-no-data span').text('请求出现错误,请稍后再试!');
|
||||
$('.goods-page-no-data span').text(xhr.responseText || '请求出现错误,请稍后再试!');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -516,10 +516,9 @@ $(function() {
|
||||
if(__user_id__ != 0)
|
||||
{
|
||||
var $this = $(this);
|
||||
// 开启进度条
|
||||
$.AMUI.progress.start();
|
||||
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
url: $(this).data('ajax-url'),
|
||||
type: 'post',
|
||||
@ -528,8 +527,8 @@ $(function() {
|
||||
data: {"id": $('.goods-detail').data('id')},
|
||||
success: function(result)
|
||||
{
|
||||
PoptitClose();
|
||||
$.AMUI.progress.done();
|
||||
PoptitClose();
|
||||
|
||||
if(result.code == 0)
|
||||
{
|
||||
@ -548,8 +547,8 @@ $(function() {
|
||||
},
|
||||
error: function(xhr, type)
|
||||
{
|
||||
PoptitClose();
|
||||
$.AMUI.progress.done();
|
||||
PoptitClose();
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
|
||||
@ -78,11 +78,11 @@ $(function()
|
||||
|
||||
// 发送验证码
|
||||
$.ajax({
|
||||
url:$('.verify-submit').data('url'),
|
||||
type:'POST',
|
||||
data:{"accounts":$accounts.val(), "verify":verify, "type":$form_tag.find('input[name="type"]').val()},
|
||||
dataType:'json',
|
||||
success:function(result)
|
||||
url: $('.verify-submit').data('url'),
|
||||
type: 'POST',
|
||||
data: {"accounts":$accounts.val(), "verify":verify, "type":$form_tag.find('input[name="type"]').val()},
|
||||
dataType: 'json',
|
||||
success: function(result)
|
||||
{
|
||||
if(result.code == 0)
|
||||
{
|
||||
@ -117,14 +117,14 @@ $(function()
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error:function()
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$this.button('reset');
|
||||
if(is_win == 1)
|
||||
{
|
||||
$('.verify-submit-win').button('reset');
|
||||
}
|
||||
Prompt('网络错误');
|
||||
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user