下载中心修复

master
sunke 5 years ago
parent 1f6de9be57
commit 715d8ace1c

@ -2015,12 +2015,12 @@ class DownloadController extends BaseController {
*/ */
public function export() { //开始导出 public function export() { //开始导出
$id = $_REQUEST['lid']; $id = $_REQUEST['lid'];
$dataname = $_REQUEST['dname']; $downloadStatus = M('downloadlog','tab_')->where(['id'=>$id])->field('dataname,status,conditions')->select();
$downloadStatus = M('downloadlog','tab_')->where(['id'=>$id])->field('status')->select();
if($downloadStatus[0]['status'] == 1) { if($downloadStatus[0]['status'] == 1) {
$this->error("该数据已下载请重新添加",U('listsIndex')); $this->error("该数据已下载请重新添加",U('listsIndex'));
} }
$conditions = $_REQUEST['conditions']; $dataname = $downloadStatus[0]['dataname'];
$conditions = $downloadStatus[0]['conditions'];
$map = array(); $map = array();
foreach (json_decode($conditions,FALSE) as $key => $value) { foreach (json_decode($conditions,FALSE) as $key => $value) {
if($value !== 0 && $value !== "" ) { if($value !== 0 && $value !== "" ) {
@ -2351,7 +2351,7 @@ class DownloadController extends BaseController {
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = '100000';//从数据库获取总量,假设是十万 $accessNum = '100000';//从数据库获取总量,假设是十万
$accessNum = count($data1)?:0 ; $accessNum = count($data1)?:0 ;
var_dump($data1);die();
$perSize = 5000;//每次查询的条数 $perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize); $pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages; $i++) { for($i = 1; $i <= $pages; $i++) {

@ -179,10 +179,8 @@
<td> <td>
<if condition="$vo['status'] eq 0"> <if condition="$vo['status'] eq 0">
<form action="{:U('download/export')}" method="post" id="downloadForm"> <form action="{:U('download/export')}" method="post" id="downloadForm">
<input type="hidden" name="conditions" value='{$vo["conditions"]}'/> <input type="hidden" name="lid" value=""/>
<input type="hidden" name="lid" value="{$vo['id']}"/> <a style="cursor: pointer" onclick="reload('{$vo.id}')" target="_blank" class="chakan"><span>可下载</span></a>
<input type="hidden" name="dname" value="{$vo['dataname']}"/>
<a style="cursor: pointer" onclick="reload()" target="_blank" class="chakan"><span>可下载</span></a>
</form> </form>
<else /> <a href="javascript:;" class="current"><span style="color:#9D9D9D">已下载</span></a> <else /> <a href="javascript:;" class="current"><span style="color:#9D9D9D">已下载</span></a>
</if> </if>
@ -283,7 +281,8 @@
}); });
</script> </script>
<script> <script>
function reload() { function reload(id) {
$('input[name=lid]').val(id);
document.getElementById('downloadForm').submit() document.getElementById('downloadForm').submit()
setTimeout(function(){ window.location.reload(); }, 7000); setTimeout(function(){ window.location.reload(); }, 7000);
} }

Loading…
Cancel
Save