You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.7 KiB
PHTML
105 lines
3.7 KiB
PHTML
7 years ago
|
<script language="javascript">
|
||
|
|
||
|
function batch_update_amp(index) {
|
||
|
var ic_id = $('#cache_ic_id_' + index).val();
|
||
|
var msg_obj = "#cache" + index;
|
||
|
var amp_code = '';
|
||
|
$(msg_obj).html("\u7a0d\u7b49...");
|
||
|
|
||
|
$.ajax({
|
||
|
type: "get",
|
||
|
dataType: "json",
|
||
|
url: "<?php echo site_url('amp/auto_create/') ?>/" + ic_id,
|
||
|
success: function (result, textStatus) {
|
||
|
$.each(result, function (i, field) {
|
||
|
if (i === 'data') {
|
||
|
amp_code = field.amp;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(msg_obj).html("\u0041\u004d\u0050\u8f6c\u6362\u6210\u529f\u0021\u6b63\u5728\u4fdd\u5b58\u2026\u2026");
|
||
|
//保存转换的AMP代码 begin
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
dataType: "json",
|
||
|
url: "<?php echo site_url('amp/edit_save/') ?>",
|
||
|
data: {
|
||
|
"ic_id": ic_id,
|
||
|
"textarea_htmlcode": amp_code,
|
||
|
"amp_status": 1
|
||
|
},
|
||
|
success: function (result, textStatus) {
|
||
|
$(msg_obj).html("\u0041\u004d\u0050\u66f4\u65b0\u6210\u529f\u0021");
|
||
|
create_amp_data(++index);
|
||
|
},
|
||
|
error: function () {
|
||
|
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
|
||
|
create_amp_data(++index);
|
||
|
}
|
||
|
});
|
||
|
//保存转换的AMP代码 end
|
||
|
},
|
||
|
error: function () {
|
||
|
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
|
||
|
create_amp_data(++index);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function create_amp_data(index) {
|
||
|
if ($('#cache_url' + index).length > 0) {
|
||
|
if ($('#cache' + index).html() !== '\u0041\u004d\u0050\u66f4\u65b0\u6210\u529f\u0021') {
|
||
|
batch_update_amp(index);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
</script>
|
||
|
|
||
|
<div class="container-fluid">
|
||
|
<div class="row">
|
||
|
<div class="col-sm-4">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="col-sm-16">
|
||
|
|
||
|
<table class="table table-striped">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th class="col-sm-2">#</th>
|
||
|
<th class="col-sm-18">URL</th>
|
||
|
<th class="col-sm-4">更新进度</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<?php
|
||
|
$i = 0;
|
||
|
foreach ($all_information as $key => $info) {
|
||
|
if ($info->ic_status == 1 && !empty($info->ic_url)) {
|
||
|
$i++;
|
||
|
?>
|
||
|
<tr>
|
||
|
<td><?php echo $i; ?></td>
|
||
|
<td id="cache_url<?php echo $i; ?>" name="cache_url<?php echo $i; ?>" class="cache_url"><?php echo $info->ic_url; ?></a></td>
|
||
|
<td id="cache<?php echo $i; ?>" name="cache<?php echo $i; ?>"><i class="icon-refresh"></i></td>
|
||
|
<input type="hidden" id="cache_ic_id_<?php echo $i; ?>" value="<?php echo $info->ic_id; ?>" />
|
||
|
</tr>
|
||
|
<?php
|
||
|
}
|
||
|
}
|
||
|
?>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div class="col-sm-4">
|
||
|
<a href="javascript:void(0);" class="btn btn-danger" onclick="batch_update_amp(1);">开始更新</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|