初始上传
This commit is contained in:
121
app/shop/view/upgrade/auth.html
Executable file
121
app/shop/view/upgrade/auth.html
Executable file
@@ -0,0 +1,121 @@
|
||||
<style type="text/css">
|
||||
.auth-form {padding-top: 150px;text-align: center;}
|
||||
.auth-form .layui-input {display: inline-block;}
|
||||
.auth-tips {font-size: 12px;color: #666;width: 544px;margin: 5px auto;}
|
||||
</style>
|
||||
|
||||
{if condition="$auth_info['code'] == 0"}
|
||||
<div class="index-box">
|
||||
<div class="index-content">
|
||||
<div class="system-function">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="30%">
|
||||
<col width="20%">
|
||||
<col width="30%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">产品名称</td>
|
||||
<td>{$auth_info['data']['product_name']}</td>
|
||||
<td class="bg-color-light-gray">授权状态</td>
|
||||
<td>已授权</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">授权码</td>
|
||||
<td>{$auth_info['data']['devolution_code']}</td>
|
||||
<td class="bg-color-light-gray">授权类型</td>
|
||||
<td>{$auth_info['data']['devolution_version_name']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">当前版本</td>
|
||||
<td>{$app_info.version}</td>
|
||||
<td class="bg-color-light-gray">最新版本</td>
|
||||
<td>
|
||||
{$auth_info['data']['newest_version'] ?? ''}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">授权时间</td>
|
||||
<td>{:date('Y-m-d H:i:s', $auth_info['data']['devolution_date'])}</td>
|
||||
<td class="bg-color-light-gray">服务到期时间</td>
|
||||
<td>
|
||||
{:date('Y-m-d H:i:s', $auth_info['data']['devolution_expire_date'])}
|
||||
{if condition="$auth_info['data']['devolution_expire_date'] > time()"}
|
||||
<span style="color:red;">可更新</span>
|
||||
{else/}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">授权归属</td>
|
||||
<td>{$auth_info['data']['devolution_attribution']}</td>
|
||||
<td class="bg-color-light-gray">授权域名</td>
|
||||
<td>{$auth_info['data']['devolution_url']}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="index-box">
|
||||
<div class="index-content">
|
||||
<div class="system-function">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="30%">
|
||||
<col width="20%">
|
||||
<col width="30%">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">产品名称</td>
|
||||
<td>单商户V5</td>
|
||||
<td class="bg-color-light-gray">授权状态</td>
|
||||
<td>未授权 <a href="https://www.niushop.com" class="text-color" target="_blank">去授权</a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-color-light-gray">套餐版本</td>
|
||||
<td>免费版</td>
|
||||
<td class="bg-color-light-gray">当前版本</td>
|
||||
<td>{$app_info.version}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript">
|
||||
var isSub = false;
|
||||
function auth(){
|
||||
var authCode = $('.auth-form [name="auth_code"]').val();
|
||||
if (!/[\S]+/.test(authCode)) {
|
||||
layer.msg('请输入您的授权码')
|
||||
return;
|
||||
}
|
||||
if (isSub) return;
|
||||
isSub = true;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ns.url("shop/upgrade/auth"),
|
||||
data: {
|
||||
code: authCode
|
||||
},
|
||||
dataType: 'JSON',
|
||||
success: function (res) {
|
||||
isSub = false;
|
||||
if (res.code == 0) {
|
||||
listenerHash(); // 刷新页面
|
||||
} else {
|
||||
layer.msg('未查找到该授权码');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
164
app/shop/view/upgrade/patch_lists.html
Executable file
164
app/shop/view/upgrade/patch_lists.html
Executable file
@@ -0,0 +1,164 @@
|
||||
|
||||
<div class="layui-collapse tips-wrap" style="margin-bottom: 15px;">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>一、下载补丁文件后一般是根目录解压覆盖即可,特殊情况请根据补丁文件中的说明文档进行操作</li>
|
||||
<li>二、如果对补丁文件有疑问,请联系官方售后进行处理</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="data_list" lay-filter="data_list"></table>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="action">
|
||||
<div class="table-btn">
|
||||
{{# if(!d.patch_res || d.patch_res.patch_res == 'not'){ }}
|
||||
<a class="layui-btn" lay-event="complete">已处理</a>
|
||||
<a class="layui-btn" lay-event="ignore">无需处理</a>
|
||||
{{# } }}
|
||||
<a class="layui-btn" lay-event="download">下载</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<a id="patch_download"><span></span></a>
|
||||
|
||||
<script>
|
||||
var patch_res_config = {
|
||||
complete : '已处理',
|
||||
ignore: '无需处理',
|
||||
};
|
||||
var form, table;
|
||||
layui.use(['table', 'form'], function() {
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#data_list',
|
||||
url: ns.url("shop/upgrade/patchlists"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'patch_name',
|
||||
width: '25%',
|
||||
title: '补丁名称',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
var html = '';
|
||||
html += '<p class="text">'+ data.patch_name +'</p>'
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
field: 'version',
|
||||
width: '8%',
|
||||
title: '适用版本',
|
||||
unresize: 'false'
|
||||
},{
|
||||
width: '10%',
|
||||
title: '发布时间',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
},{
|
||||
width: '25%',
|
||||
title: '说明',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
var html = '';
|
||||
html += '<p class="text">'+ data.patch_desc +'</p>'
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
width: '20%',
|
||||
title: '处理结果',
|
||||
unresize: 'false',
|
||||
templet: function(data) {
|
||||
var html = '';
|
||||
if(data.patch_res && data.patch_res.patch_res !== 'not'){
|
||||
html += '<div class="text">'+(patch_res_config[data.patch_res.patch_res] || '') + ' ' + ns.time_to_date(data.patch_res.patch_time)+'</div>';
|
||||
}else{
|
||||
html += '--';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
},{
|
||||
title: '操作',
|
||||
width: '12%',
|
||||
toolbar: '#action',
|
||||
align:'right',
|
||||
unresize: 'false'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'complete':
|
||||
patchRes(data, 'complete');
|
||||
break;
|
||||
case 'ignore':
|
||||
patchRes(data, 'ignore');
|
||||
break;
|
||||
case 'download':
|
||||
patchDownload(data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 补丁处理
|
||||
*/
|
||||
function patchRes(data, patch_res) {
|
||||
layer.confirm('确定要标记为'+ patch_res_config[patch_res] +'吗?', function(index) {
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
url: ns.url("shop/upgrade/patchres"),
|
||||
data: {
|
||||
patch_id: data.id,
|
||||
patch_res: patch_res,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 补丁处理
|
||||
*/
|
||||
function patchDownload(data) {
|
||||
$.ajax({
|
||||
url: ns.url("shop/upgrade/patchdownload"),
|
||||
data: {
|
||||
patch_id: data.id,
|
||||
patch_link: data.patch_link,
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
beforeSend: function () {layer_index = layer.load();},
|
||||
complete: function () {layer.close(layer_index);},
|
||||
success: function (res) {
|
||||
if (res.code == 0) {
|
||||
$("#patch_download").attr({
|
||||
href : ns.img(res.data.patch_link),
|
||||
download: data.patch_name+'.zip',
|
||||
}).find('span').click();
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
120
app/shop/view/upgrade/recovery.html
Executable file
120
app/shop/view/upgrade/recovery.html
Executable file
@@ -0,0 +1,120 @@
|
||||
<style>
|
||||
.no-content-tip{
|
||||
text-align:center;
|
||||
padding:20px 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
{if condition="!empty($upgrade_log_info)"}
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" id="recovery_btn">一键回滚</button>
|
||||
</div>
|
||||
<div class="index-box">
|
||||
<div class="index-content">
|
||||
<div class="system-function">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="40%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>主体</th>
|
||||
<th>操作</th>
|
||||
<th>升级前版本</th>
|
||||
<th>升级后版本</th>
|
||||
<th>升级内容</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="$upgrade_log_info.version_info" id="item"}
|
||||
<tr>
|
||||
<td>{$item.goods_name}</td>
|
||||
<td>{$item.action_name}</td>
|
||||
<td>{$item.current_version_name}</td>
|
||||
<td>{$item.latest_version_name}</td>
|
||||
<td>
|
||||
<a href="javascript:;" onclick="showScripts(this)" data-data='{:json_encode($item.scripts)}'>查看升级内容</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="no-content-tip">暂无可回滚内容</div>
|
||||
{/if}
|
||||
|
||||
<script type="text/html" id="upgrade_desc">
|
||||
<div><span>更新版本数:{{d.length}}</span></div>
|
||||
<table class="layui-table" lay-skin="lg">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="80%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>版本号</th>
|
||||
<th>更新说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr>
|
||||
<td>{{item.version_name}}</td>
|
||||
<td>{{item.description}}</td>
|
||||
</tr>
|
||||
{{# }) }}
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var laytpl;
|
||||
|
||||
layui.use(['laytpl'], function() {
|
||||
laytpl = layui.laytpl;
|
||||
})
|
||||
|
||||
function showScripts(e) {
|
||||
var scripts = $(e).data('data');
|
||||
var uploadHtml = $("#upgrade_desc").html();
|
||||
laytpl(uploadHtml).render(scripts, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '更新说明',
|
||||
area: ['700px', '500px'],
|
||||
content: html
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$("#recovery_btn").click(function(){
|
||||
var confirm_index = layer.confirm('确定要回滚吗?', ['确定', '取消'], function(){
|
||||
layer.close(confirm_index);
|
||||
var load_index = layer.load(1, {
|
||||
shade: [0.1,'#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/recovery"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
layer.msg('回滚成功', function(index, layero){
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
})
|
||||
}else{
|
||||
layer.msg('回滚失败,错误信息为:' + res.message);
|
||||
}
|
||||
layer.close(load_index);
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
279
app/shop/view/upgrade/upgrade.html
Executable file
279
app/shop/view/upgrade/upgrade.html
Executable file
@@ -0,0 +1,279 @@
|
||||
<style>
|
||||
.layui-layer-content {
|
||||
word-break: break-all;
|
||||
line-height: 24px;
|
||||
overflow: auto !important;
|
||||
}
|
||||
.single-filter-box{
|
||||
display: block;
|
||||
}
|
||||
.upgrade-tips p{margin-bottom: 5px;}
|
||||
.upgrade-tips p:last-child{margin-bottom: 0;}
|
||||
</style>
|
||||
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>一、建议在系统升级前将网站的文件权限全部修改为777,保证系统备份文件、下载文件和覆盖文件的正常进行</li>
|
||||
<li>二、在升级完成后,为保证网站的安全,需要重新设置文件权限。建议进行如下修改</li>
|
||||
<li>1、runtime文件夹,upload文件夹依旧为777权限</li>
|
||||
<li>2、其他文件设置为755权限</li>
|
||||
<li>三、升级完成,升级文件存放目录(网站根目录/upload/upgrade/)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div class="single-filter-box top">
|
||||
<button class="layui-btn" id="upgrade_btn">一键升级</button>
|
||||
<button class="layui-btn" id="refresh_btn">一键刷新</button>
|
||||
</div>
|
||||
|
||||
<table id="version_list" lay-filter="version_list"></table>
|
||||
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="upgrade_desc">查看更新说明</a>
|
||||
<a class="layui-btn" lay-event="upgrade_file">查看更新文件</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="upgrade_desc">
|
||||
<div style="height:100%; overflow-y: auto;">
|
||||
<div><span>需更新版本数:{{d.scripts.length}}</span></div>
|
||||
<table class="layui-table" lay-skin="lg">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="80%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>版本号</th>
|
||||
<th>更新说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{# layui.each(d.scripts, function(index, item){ }}
|
||||
<tr>
|
||||
<td>{{item.version_no}}</td>
|
||||
<td>{{item.description}}</td>
|
||||
</tr>
|
||||
{{# }) }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="upgrade_file">
|
||||
<div style="height:100%; overflow-y: auto;">
|
||||
<div><span>需更新文件数:{{d.files.length}}</span></div>
|
||||
<table class="layui-table" lay-skin="lg">
|
||||
<tbody>
|
||||
{{# layui.each(d.files, function(index, item){ }}
|
||||
<tr>
|
||||
<td>{{item.file_path}}</td>
|
||||
</tr>
|
||||
{{# }) }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="right_check">
|
||||
<div style="height:100%; overflow-y: auto;">
|
||||
<div><span>共有{{d.length}}个文件或文件夹不可写,请先修正这些问题,再继续升级</span></div>
|
||||
<table class="layui-table" lay-skin="lg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>类型</th>
|
||||
<th>路径</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{# layui.each(d, function(index, item){ }}
|
||||
<tr>
|
||||
<td>{{item.type_name}}</td>
|
||||
<td>{{item.path}}</td>
|
||||
</tr>
|
||||
{{# }) }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
//升级的权限检测
|
||||
var right_check = null;
|
||||
var system_upgrade_info_ready = null;
|
||||
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var table,
|
||||
laytpl = layui.laytpl,
|
||||
form = layui.form;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#version_list',
|
||||
url: ns.url("shop/upgrade/upgrade"),
|
||||
parseData: function(res){ //res 即为原始返回的数据
|
||||
if (res.code == 0) {
|
||||
right_check = res.data.right_check;
|
||||
system_upgrade_info_ready = res.data.system_upgrade_info_ready;
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.message, //解析提示文本
|
||||
"data": res.data.system_upgrade_info_ready //解析数据列表
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.message, //解析提示文本
|
||||
"data": [] //解析数据列表
|
||||
};
|
||||
}
|
||||
},
|
||||
page: false,
|
||||
cols: [
|
||||
[{
|
||||
field: 'type_name',
|
||||
title: '主体',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.goods_name;
|
||||
}
|
||||
},{
|
||||
field: 'type_name',
|
||||
title: '操作类型',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.action_name;
|
||||
}
|
||||
}, {
|
||||
field: 'current_version_name',
|
||||
title: '当前版本',
|
||||
width: '10%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'latest_version_name',
|
||||
title: '最新版本',
|
||||
width: '10%',
|
||||
unresize: 'false'
|
||||
}, {
|
||||
field: 'scripts',
|
||||
title: '更新版本数',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.scripts.length;
|
||||
}
|
||||
}, {
|
||||
field: 'files',
|
||||
title: '更新文件数',
|
||||
width: '10%',
|
||||
unresize: 'false',
|
||||
templet: function (data) {
|
||||
return data.files.length;
|
||||
}
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data,
|
||||
event = obj.event;
|
||||
switch (event) {
|
||||
case 'upgrade_desc':
|
||||
upgradeDesc(data);
|
||||
break;
|
||||
case 'upgrade_file':
|
||||
upgradeFile(data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//详情说明
|
||||
function upgradeDesc(data) {
|
||||
var uploadHtml = $("#upgrade_desc").html();
|
||||
laytpl(uploadHtml).render(data, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '更新说明',
|
||||
area: ['700px', '600px'],
|
||||
content: html
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
//更新文件
|
||||
function upgradeFile(data) {
|
||||
var uploadHtml = $("#upgrade_file").html();
|
||||
laytpl(uploadHtml).render(data, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '更新文件',
|
||||
area: ['700px', '600px'],
|
||||
content: html
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$("#upgrade_btn").click(function(){
|
||||
if(system_upgrade_info_ready === null){
|
||||
layer.msg('数据正在获取中,请稍候');
|
||||
return false;
|
||||
}
|
||||
if(system_upgrade_info_ready.length <= 0){
|
||||
layer.msg('暂无可以升级的内容');
|
||||
return false;
|
||||
}
|
||||
if(right_check.length > 0){
|
||||
var uploadHtml = $("#right_check").html();
|
||||
laytpl(uploadHtml).render(right_check, function(html) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '权限检测',
|
||||
area: ['700px', '500px'],
|
||||
content: html
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
layer.open({
|
||||
title: '注意事项',
|
||||
area: ['400px'],
|
||||
btn: ['继续'],
|
||||
content: `<div class="upgrade-tips"><p>1、升级前请先检查防火墙以及cc拦截是否已经关闭。</p>
|
||||
<p>2、强烈建议清理runtime下的子文件夹,做好备份工作(后台程序、数据库),方便后期与售后人员协调。</p>
|
||||
<p>3、升级完成后,点击一键刷新按钮(授权升级—>系统升级功能),清理runtime缓存,清理浏览器缓存,Ctrl+F5强制刷新。</p>
|
||||
<p>4、重置自定义首页,可在模板选择中选择。</p></div>`,
|
||||
yes: function () {
|
||||
location.href = ns.href("shop/upgrade/upgradeAction");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#refresh_btn").click(function () {
|
||||
var index = layer.load(2);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: ns.url('shop/upgrade/refresh'),
|
||||
dataType: "JSON",
|
||||
success: function (res) {
|
||||
layer.msg(res.message);
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
590
app/shop/view/upgrade/upgrade_action.html
Executable file
590
app/shop/view/upgrade/upgrade_action.html
Executable file
@@ -0,0 +1,590 @@
|
||||
<script type="text/javascript" src="SHOP_JS/progressbar.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="SHOP_CSS/upgrade/style.css" media="screen">
|
||||
<link rel="stylesheet" type="text/css" href="SHOP_CSS/upgrade/jquery.easy-pie-chart.css" media="screen">
|
||||
<style>
|
||||
.chart{
|
||||
display:inline-block;
|
||||
float:unset;
|
||||
}
|
||||
.up-footer{padding:20px;text-align:center;}
|
||||
.up-footer button{
|
||||
padding:8px 15px;
|
||||
color:#FFF;
|
||||
border:none;
|
||||
border-radius:3px;
|
||||
font-size:15px;
|
||||
margin: 0 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.up-footer button.disabled{
|
||||
background-color:#c0c1c1 !important;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
/*.up-footer button:nth-child(2){
|
||||
display: none;
|
||||
}*/
|
||||
.install-content{
|
||||
margin-top:40px;
|
||||
padding: 10px 0 10px 20px;
|
||||
border: 1px solid #AAD2E5;
|
||||
background-color: #E1F2FA;
|
||||
}
|
||||
.panel-title{
|
||||
font-size:15px;
|
||||
margin:7px auto;
|
||||
line-height:30px;
|
||||
color: #31708f;
|
||||
border-bottom:1px solid #aad2e5 !important;
|
||||
}
|
||||
.step-title{
|
||||
color: #31708f;
|
||||
font-weight:bold;
|
||||
}
|
||||
.step-text{
|
||||
color: #31708f;
|
||||
}
|
||||
#container {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
margin: 50px auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.alert-warning-word {
|
||||
background-color: #FCF8E3;
|
||||
border-top: 1px solid #FBEED5;
|
||||
border-bottom: 1px solid #FBEED5;
|
||||
padding: 5px 20px;
|
||||
line-height: 30px;
|
||||
color: #C09853;
|
||||
}
|
||||
.complete-title{text-align: center;font-size: 24px;padding-bottom: 20px;border:0px}
|
||||
.complete-ontent{text-align: center;font-size: 14px;}
|
||||
.complete-ontent-nex{text-align: center;font-size: 14px;padding: 10px 0px;}
|
||||
.complete-url{text-align: center;font-size: 14px;padding-bottom: 20px;}
|
||||
.complete-close{cursor:pointer;display: block;width: 70px;height: 35px;color: #fff;font-size: 16px;text-align: center;line-height: 35px;border-radius: 5px;margin: 0 auto;}
|
||||
</style>
|
||||
|
||||
<div class="tips-wrap">
|
||||
<div id="container"></div>
|
||||
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
<div class="alert alert-warning alert-warning-word">
|
||||
<strong>警告!</strong>版本升级中,请不要关闭当前页面!
|
||||
</div>
|
||||
|
||||
<div class="install-content alert alert-info">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">详细过程</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<span class="step-title">升级操作 : </span><span class="step-text action-name"></span><br/>
|
||||
<span class="step-title">整体进度 : </span><span class="step-text count-percent">0%</span><br/>
|
||||
<span class="step-title">操作显示 : </span><span class="step-text step-content"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-10"></div>
|
||||
|
||||
<div class="up-view" >
|
||||
<div class="up-footer">
|
||||
<button class="up-btn bg-color" onclick="upgradeStart();">开始升级</button>
|
||||
<button class="up-btn bg-color" onclick="downloadFile();">下载升级文件</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var action_type = 'upgrade';
|
||||
var upgrade_obj = {
|
||||
'data' : [],
|
||||
'total_action' : {
|
||||
'list' : [
|
||||
'backupFile',
|
||||
'backupSql',
|
||||
'downloadFile',
|
||||
'upgradeStart',//升级开始
|
||||
'executeFile',
|
||||
'executeSql',
|
||||
'upgradeEnd',//升级结束
|
||||
],
|
||||
'method' : '',
|
||||
'status' : {},
|
||||
'error_message' : '',
|
||||
},
|
||||
'download_file' : {
|
||||
'index' : -1,
|
||||
'error_index' : -1,
|
||||
'error_num' : 0,
|
||||
'error_limit' : 10,
|
||||
'download_root': ''
|
||||
},
|
||||
'backup_sql' : {
|
||||
'last_table' : '',
|
||||
'index' : 0,
|
||||
'series' : 1,
|
||||
},
|
||||
'version' : {
|
||||
'current' : 0,
|
||||
'upgrade' : 0,
|
||||
'newVersion' : 0
|
||||
}
|
||||
};
|
||||
var is_down = false;
|
||||
var is_trigger = true;
|
||||
|
||||
//总操作控制
|
||||
upgrade_obj.totalActionControl = function(){
|
||||
var that = this;
|
||||
var method = that.total_action.method;
|
||||
var index = that.total_action.list.indexOf(method);
|
||||
if(index < 0){
|
||||
method = that.total_action.method = that.total_action.list[0];
|
||||
that.total_action.status[method] = 'start';
|
||||
that[method]();
|
||||
}else{
|
||||
var status = that.total_action.status[method];
|
||||
if(status === 'end'){
|
||||
index ++;
|
||||
if(index < that.total_action.list.length){
|
||||
method = that.total_action.method = that.total_action.list[index];
|
||||
that.total_action.status[method] = 'start';
|
||||
that[method]();
|
||||
}else{
|
||||
that.totalActionEnd();
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//总操作完成
|
||||
upgrade_obj.totalActionEnd = function(){
|
||||
setActionName('升级完成');
|
||||
|
||||
var html = "";
|
||||
html += "<div>";
|
||||
html += '<h1 class="complete-title text-color">升级成功!</h1>';
|
||||
html += '<p class="complete-ontent">您已从版本V'+ this.version.current +'升级到版本<span class="complete-word text-color">V'+ this.version.upgrade +'</span></p>';
|
||||
html += '<p class="complete-ontent-nex">最新版本为V'+ this.version.newVersion +'</p>';
|
||||
html += '<p class="complete-url">下载文件存储路径为: 网站根目录/upload/upgrade/'+ this.version.current +'_'+ this.version.upgrade +'</p>';
|
||||
html += '<span onclick="close_popup()" class="complete-close bg-color">确认</span>';
|
||||
html += '</div>';
|
||||
|
||||
layer.open({
|
||||
title: '温馨提示',
|
||||
skin: 'layer-tips-class',
|
||||
type: 1,
|
||||
area: ['450px'],
|
||||
content: html,
|
||||
closeBtn: 0
|
||||
});
|
||||
// layer.msg('升级完成', function(index, layero){
|
||||
// location.href = ns.href("shop/upgrade/upgrade");
|
||||
// })
|
||||
}
|
||||
|
||||
//备份文件
|
||||
upgrade_obj.backupFile = function(){
|
||||
var that = this;
|
||||
var method = 'backupFile';
|
||||
|
||||
setActionName('备份系统文件...');
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/backupFile"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
that.total_action.status[method] = 'end';
|
||||
}else{
|
||||
that.total_action.status[method] = 'error';
|
||||
setActionContent(res.message);
|
||||
}
|
||||
that.totalActionControl();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//备份sql
|
||||
upgrade_obj.backupSql = function(){
|
||||
var that = this;
|
||||
var method = 'backupSql';
|
||||
|
||||
var last_table = that.backup_sql.last_table;
|
||||
var index = that.backup_sql.index;
|
||||
var series = that.backup_sql.series;
|
||||
|
||||
if(!last_table){
|
||||
setActionName('备份数据库文件...');
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/backupSql"),
|
||||
dataType : 'json',
|
||||
data : {
|
||||
last_table : last_table,
|
||||
index : index,
|
||||
series : series,
|
||||
},
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
var data = res.data;
|
||||
//判断是否备份完成
|
||||
if(data.is_backup_end){
|
||||
that.total_action.status[method] = 'end';
|
||||
that.totalActionControl();
|
||||
}else{
|
||||
that.backup_sql.last_table = data.last_table;
|
||||
that.backup_sql.index = data.index;
|
||||
that.backup_sql.series = data.series;
|
||||
setActionContent(res.message);
|
||||
that.backupSql();
|
||||
}
|
||||
}else{
|
||||
that.total_action.status[method] = 'error';
|
||||
setActionContent(res.message);
|
||||
that.totalActionControl();
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//下载文件操作
|
||||
upgrade_obj.downloadFile = function(){
|
||||
var that = this;
|
||||
setActionName('文件下载');
|
||||
|
||||
if(that.data.files.length > 0){
|
||||
that.downloadFileControl();
|
||||
}else{
|
||||
that.total_action.status['downloadFile'] = 'end';
|
||||
if (action_type == 'upgrade') {
|
||||
that.totalActionControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//下载文件控制
|
||||
upgrade_obj.downloadFileControl = function(){
|
||||
//验证文件是否完成
|
||||
var that = this;
|
||||
that.download_file.index ++;
|
||||
var files = that.data['files'];
|
||||
if(that.download_file.index < files.length && is_down == false){
|
||||
that.downloadFileExec();
|
||||
}else{
|
||||
that.download_file.index = -1;
|
||||
that.total_action.status['downloadFile'] = 'end';
|
||||
if (action_type == 'upgrade' && is_down == false) {
|
||||
setActionContent("文件下载完成");
|
||||
downComplete();
|
||||
that.totalActionControl();
|
||||
} else if(action_type == 'upgrade' && is_down == true){
|
||||
setActionContent("文件下载完成");
|
||||
setCountPercent(1);
|
||||
that.totalActionControl();
|
||||
} else {
|
||||
setActionContent("文件下载完成,升级文件已下载到:网站根目录/" + that.download_file.download_root + "目录下");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//执行下载文件
|
||||
upgrade_obj.downloadFileExec = function(){
|
||||
if(is_trigger && is_down == true){
|
||||
verificationDown();
|
||||
}
|
||||
var that = this;
|
||||
var download_file_index = that.download_file.index;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/download"),
|
||||
dataType : 'json',
|
||||
data:{
|
||||
'action_type': action_type,
|
||||
'tag' : 'system_upgrade',
|
||||
'download_file_index':download_file_index
|
||||
},
|
||||
success:function(data){
|
||||
if(data.code >= 0){
|
||||
//显示进度条和下载文件
|
||||
that.download_file.download_root = data.download_root;
|
||||
that.version.current = data.current;
|
||||
that.version.upgrade = data.upgrade;
|
||||
that.version.newVersion = data.newVersion;
|
||||
setCountPercent((that.download_file.index + 1) / that.data.files.length);
|
||||
setActionContent(that.data.files[that.download_file.index]['file_path']);
|
||||
that.downloadFileControl();
|
||||
}else{
|
||||
//如果下载文件有错误可以在一定时间后重新发起请求
|
||||
if(that.download_file.index === that.download_file.error_index){
|
||||
that.download_file.error_num ++;
|
||||
}else{
|
||||
that.download_file.error_num = 1;
|
||||
}
|
||||
if(that.download_file.error_num <= that.download_file.error_limit){
|
||||
that.download_file.index --;
|
||||
setActionContent("文件下载出错,即将重新发起请求");
|
||||
setTimeout(function(){
|
||||
that.downloadFileControl();
|
||||
}, 300);
|
||||
}else{
|
||||
setActionContent("文件下载出错,已达到最大错误次数,请稍后重新进行系统升级");
|
||||
layer.msg('error',data.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//覆盖文件
|
||||
upgrade_obj.executeFile = function(){
|
||||
var that = this;
|
||||
var method = 'executeFile';
|
||||
setActionName('覆盖文件');
|
||||
if(that.data.files.length > 0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/executeFile"),
|
||||
dataType : 'json',
|
||||
data:{},
|
||||
success:function(data){
|
||||
if(data.code >= 0){
|
||||
//显示进度条和下载文件
|
||||
that.total_action.status[method] = 'end';
|
||||
that.totalActionControl();
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
that.total_action.status[method] = 'end';
|
||||
that.totalActionControl();
|
||||
}
|
||||
}
|
||||
|
||||
//执行sql
|
||||
upgrade_obj.executeSql = function(){
|
||||
var that = this;
|
||||
var method = 'executeSql';
|
||||
setActionName('执行数据库脚本');
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/executeSql"),
|
||||
dataType : 'json',
|
||||
success:function(data){
|
||||
if(data.code >= 0){
|
||||
that.total_action.status[method] = 'end';
|
||||
that.totalActionControl();
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
setActionContent(data.message);
|
||||
that.executeRecovery();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//开始系统升级
|
||||
upgrade_obj.upgradeStart = function(){
|
||||
var that = this;
|
||||
var method = 'upgradeStart';
|
||||
|
||||
setActionName('开始系统升级...');
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/upgradeStart"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
that.total_action.status[method] = 'end';
|
||||
}else{
|
||||
that.total_action.status[method] = 'error';
|
||||
setActionContent(res.message);
|
||||
}
|
||||
that.totalActionControl();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//结束系统升级
|
||||
upgrade_obj.upgradeEnd = function(){
|
||||
var that = this;
|
||||
var method = 'upgradeEnd';
|
||||
|
||||
setActionName('结束系统升级...');
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/upgradeEnd"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
that.total_action.status[method] = 'end';
|
||||
that.totalActionControl();
|
||||
}else{
|
||||
that.total_action.status[method] = 'error';
|
||||
layer.msg(res.message);
|
||||
setActionContent(res.message);
|
||||
that.executeRecovery();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//执行sql
|
||||
upgrade_obj.executeRecovery = function(){
|
||||
var that = this;
|
||||
setActionName('升级出错,系统正在执行回滚操作,请勿关闭浏览器');
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/executeRecovery"),
|
||||
dataType : 'json',
|
||||
data : {
|
||||
upgrade_no : that.data.upgrade_no,
|
||||
},
|
||||
success:function(data){
|
||||
if(data.code >= 0){
|
||||
setActionName('回滚完成');
|
||||
layer.msg('回滚完成', function(index, layero){
|
||||
window.location.href = ns.href("shop/upgrade/upgrade");
|
||||
})
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var container = document.querySelector('#container');
|
||||
var bar = new ProgressBar.Circle(container, {
|
||||
color: '#067cf3',
|
||||
strokeWidth: 5, // 正好是从圆心开始画起,>50会越过圆心,<50画出的是圆环
|
||||
trailWidth: 0, // 也设置为50,就是一个未填充的圆形,而不是圆环。要么设置为0
|
||||
easing: 'easeInOut',
|
||||
duration: 10,
|
||||
text: {
|
||||
style: {
|
||||
color: '#31708f',
|
||||
display: 'inline-block',
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%,-50%)'
|
||||
},
|
||||
autoStyleContainer: false
|
||||
},
|
||||
fill: '#e1f2fa', // 圆形内容区域填充色,当需要画圆环时,效果应该最好。
|
||||
from: { color: '#aaa', width: 1},
|
||||
to: { color: '#333', width: 5},
|
||||
step: function(state, circle) {
|
||||
circle.path.setAttribute('stroke-width', state.width);
|
||||
|
||||
var value = Math.round(circle.value() * 100);
|
||||
circle.setText(value+'%');
|
||||
}
|
||||
});
|
||||
bar.text.style.fontFamily = '"Raleway", Helvetica, sans-serif';
|
||||
bar.text.style.fontSize = '32px';
|
||||
|
||||
//升级操作
|
||||
function upgradeStart(){
|
||||
action_type = 'upgrade';
|
||||
$(".up-btn").attr('disabled',true);
|
||||
$(".up-footer .up-btn").addClass('disabled');
|
||||
upgrade_obj.totalActionControl();
|
||||
}
|
||||
|
||||
//控制进度条
|
||||
function setProgress(width, text){
|
||||
var barValue = width / 100;
|
||||
width = width.toFixed(2);
|
||||
bar.animate(barValue);
|
||||
$(".count-percent").text(width+"%");
|
||||
$(".step-content").text(text);
|
||||
}
|
||||
|
||||
//设置操作名称
|
||||
function setActionName(action_name)
|
||||
{
|
||||
$(".action-name").text(action_name);
|
||||
}
|
||||
|
||||
//设置统计进度
|
||||
function setCountPercent(percent)
|
||||
{
|
||||
bar.animate(percent);
|
||||
percent = percent * 100;
|
||||
percent = percent.toFixed(2);
|
||||
$(".count-percent").text(percent + "%");
|
||||
}
|
||||
|
||||
//设置操作名称
|
||||
function setActionContent(content){
|
||||
$(".step-content").text(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取升级信息
|
||||
*/
|
||||
function getUpgradeInfo() {
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/upgradeAction"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
if(res.code >= 0){
|
||||
upgrade_obj.data = res.data;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载升级文件
|
||||
*/
|
||||
function downloadFile(){
|
||||
action_type = 'download';
|
||||
$(".up-btn").attr('disabled',true);
|
||||
$(".up-footer .up-btn").addClass('disabled');
|
||||
upgrade_obj.downloadFile();
|
||||
}
|
||||
|
||||
$(function(){
|
||||
getUpgradeInfo();
|
||||
})
|
||||
|
||||
function downComplete(){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/downComplete"),
|
||||
dataType : 'json',
|
||||
})
|
||||
}
|
||||
|
||||
function verificationDown(){
|
||||
is_trigger = false;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url : ns.url("shop/upgrade/verificationDown"),
|
||||
dataType : 'json',
|
||||
success:function(res){
|
||||
is_down = res;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function close_popup() {
|
||||
window.location.href = ns.href("shop/upgrade/upgrade")
|
||||
}
|
||||
</script>
|
||||
226
app/shop/view/upgrade/version_log.html
Executable file
226
app/shop/view/upgrade/version_log.html
Executable file
@@ -0,0 +1,226 @@
|
||||
<link rel="stylesheet" type="text/css" href="SHOP_CSS/upgrade/version_log.css" />
|
||||
<style>
|
||||
.item-block-parent{
|
||||
display: block;
|
||||
}
|
||||
.version{
|
||||
font-size: 18px;
|
||||
}
|
||||
.versionlog{
|
||||
padding:10px 20px;
|
||||
margin-top: 10px;
|
||||
background-color: #f8f8f8;
|
||||
line-height: 2;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/html" id="log_block">
|
||||
<div class="log-block">
|
||||
<div class="log-content-block">
|
||||
<div class="log-content">
|
||||
{{# if(d.count === 0){ }}
|
||||
暂无数据
|
||||
{{# }else{ }}
|
||||
<div class="log-step-text">
|
||||
<ul class="layui-timeline">
|
||||
{{# layui.each(d.list, function(index, item){ }}
|
||||
<li class="layui-timeline-item">
|
||||
<div class="layui-timeline-axis log-version-date">{{ ns.time_to_date(item.create_time,'Y-m-d') }}</div>
|
||||
<i class="layui-icon open layui-timeline-axis bg-color" style="display:{{# if(item.isclose){ }}block {{# }else{ }}none {{# } }}" onclick="showHidebtn($(this))" data-index="{{index}}"></i>
|
||||
<i class="layui-icon close layui-timeline-axis bg-color" style="display:{{# if(item.isclose){ }}none {{# }else{ }}block {{# } }}" onclick="showHidebtn($(this))" data-index="{{index}}"></i>
|
||||
<div class="log-body look_text" onclick="showHide($(this))" data-index="{{index}}">{{# if(item.isclose){ }}点击查看完整更新日志{{# }else{ }}点击收起 {{# } }}</div>
|
||||
<div class="item-block-parent look" style="padding-top:0;display:{{# if(item.isclose){ }}none{{# }else{ }}block {{# } }}">
|
||||
<div class="version">版本:单商户{{item.version_name}}</div>
|
||||
<div class="versionlog">
|
||||
<pre>{{item.version_desc}}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="site_list item-block-parent item-five look" style="display:{{# if(item.isclose){ }}none{{# }else{ }}flex {{# } }}">
|
||||
{{# layui.each(item.list, function(item_index, item_item){ }}
|
||||
<div class="item-block item-block-hover">
|
||||
<div class="item-block-wrap">
|
||||
<div class="item-pic">
|
||||
{{# if (item_item.sku_image) { }}
|
||||
<img src="{{ ns.img(item_item.sku_image) }}" />
|
||||
{{# } else { }}
|
||||
<img src="SHOP_IMG/upgrade_default.png" />
|
||||
{{# } }}
|
||||
</div>
|
||||
<div class="item-con">
|
||||
<div class="item-content-title">
|
||||
{{ item_item.goods_name }}
|
||||
</div>
|
||||
<p class="item-content-desc">版本号:{{ item_item.version_name }}</p>
|
||||
<p class="item-content-desc line-hiding" title="发布时间:{{ ns.time_to_date(item_item.create_time) }}">发布时间:{{ ns.time_to_date(item_item.create_time) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{{# var str = JSON.stringify(item_item)}}
|
||||
<a class="text-color item-block-btn" onclick='changeDesc({{str}})'>更新内容</a> -->
|
||||
<!-- <div class="title prompt-block">
|
||||
<div class="prompt">
|
||||
<span class="text-color">更新内容</span>
|
||||
<div class="prompt-box">
|
||||
<div class="prompt-con">
|
||||
{{ item_item.version_desc }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- </div>
|
||||
{{# }); }}
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="look" style="display:{{# if(item.isclose){ }}none{{# }else{ }}block {{# } }}">
|
||||
{{# layui.each(item.list, function(item_index, item_item){ }}
|
||||
<div class="layui-timeline-content layui-text log-body">
|
||||
<h3 class="log-step-text-title">{{ item_item.goods_name }}</h3>
|
||||
<div class="log-step-text-content">
|
||||
版本号:{{ item_item.version_name }}
|
||||
</div>
|
||||
<div class="log-step-text-content">
|
||||
发布时间:{{ ns.time_to_date(item_item.create_time) }}
|
||||
</div>
|
||||
<div class="log-detail">
|
||||
<div>{{ item_item.version_desc }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{# }); }}
|
||||
</div> -->
|
||||
|
||||
</li>
|
||||
{{# }); }}
|
||||
<!-- <li class="layui-timeline-item load-more">
|
||||
<div class="layui-timeline-axis log-version-date"></div>
|
||||
<img src="SHOP_IMG/version_load_more.png" class="load-more-img"/>
|
||||
<div class="layui-timeline-content layui-text log-body">
|
||||
<h3 class="log-step-text-title" onclick="LoadingData()">
|
||||
{{# if(d.is_end == 1){ }}
|
||||
已经加载到底了
|
||||
{{# }else{ }}
|
||||
加载更多
|
||||
{{# } }}
|
||||
</h3>
|
||||
</div>
|
||||
</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<div id="log_detail"></div>
|
||||
|
||||
<div id="page"></div>
|
||||
|
||||
<script>
|
||||
var logData = {};
|
||||
var page = 0;
|
||||
var page_size = 14;
|
||||
var is_end = false;
|
||||
|
||||
function LoadingData(){
|
||||
if(is_end) return false;
|
||||
page ++;
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: 'JSON',
|
||||
url: ns.url("shop/upgrade/versionlog"),
|
||||
async: true,
|
||||
data:{
|
||||
page:page,
|
||||
page_size:page_size
|
||||
},
|
||||
success: function(res) {
|
||||
if(res.data.page_count == page){
|
||||
is_end = true;
|
||||
}
|
||||
renderLogData(res);//调用函数
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderLogData(res){
|
||||
var new_list = res.data.list;
|
||||
if(page > 1){
|
||||
var old_list = logData.list; //logData.data不存在
|
||||
//如果上一页的最后一条和新数据的第一条是属于同一天的要进行数据合并
|
||||
if(old_list[old_list.length - 1]['create_time'] === new_list[0]['time']){
|
||||
var first = new_list.shift();
|
||||
|
||||
for(var i in first['list']){
|
||||
old_list[old_list.length - 1]['create_time'].push(first['list'][i]);
|
||||
}
|
||||
}
|
||||
for(var i in new_list){
|
||||
old_list.push(new_list[i]);
|
||||
}
|
||||
}else{
|
||||
for(var i in res.data){
|
||||
res.data[i].isclose = i== 0 ? 0:1
|
||||
}
|
||||
logData.list = res.data;
|
||||
}
|
||||
logData.is_end = is_end;
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var laytpl = layui.laytpl;
|
||||
if($("#log_block").length) {
|
||||
laytpl($("#log_block").html()).render(logData, function (html) {
|
||||
$("#log_detail").html(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function renderLogDataStatus(res){
|
||||
logData.list[res].isclose = logData.list[res].isclose ? 0 :1,
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var laytpl = layui.laytpl;
|
||||
if($("#log_block").length) {
|
||||
laytpl($("#log_block").html()).render(logData, function (html) {
|
||||
$("#log_detail").html(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function showHide(val){
|
||||
val.siblings('.look').slideToggle(function(){
|
||||
val.text( $(this).is(":visible") ? "点击收起" : "点击查看完整更新日志" );
|
||||
|
||||
if($(this).is(":visible") ){
|
||||
val.siblings('.close').show()
|
||||
val.siblings('.open').hide()
|
||||
|
||||
}else{
|
||||
val.siblings('.open').show()
|
||||
val.siblings('.close').hide()
|
||||
|
||||
}
|
||||
renderLogDataStatus(val.data('index'))
|
||||
})
|
||||
}
|
||||
function showHidebtn(val){
|
||||
val.siblings('.look').slideToggle(function(){
|
||||
val.hide()
|
||||
if($(this).is(":visible") ){
|
||||
val.siblings('.close').show()
|
||||
}else{
|
||||
val.siblings('.open').show()
|
||||
}
|
||||
val.siblings('.look_text').text( $(this).is(":visible") ? "点击收起" : "点击查看完整更新日志" );
|
||||
renderLogDataStatus(val.data('index'))
|
||||
})
|
||||
}
|
||||
$(function(){
|
||||
LoadingData();
|
||||
})
|
||||
|
||||
function changeDesc(data) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: "更新内容",
|
||||
area: ['500px', '300px'],
|
||||
content: data.version_desc //这里content是一个普通的String
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user