Ticket #191 增加了导出用户email的功能。

This commit is contained in:
Li Jianxuan 2011-09-29 02:24:47 +00:00
parent e7233554de
commit 8cbe2bf913
2 changed files with 98 additions and 63 deletions

View File

@ -186,6 +186,7 @@ class Admin_DownController extends Zend_Controller_Action
$update=$this->_getParam('update');
$show=$this->_getParam('show');
$undelete=$this->_getParam('undelete');
$emaillist=$this->_getParam('emaillist');
if ($add) {
$form=new OfflinelogForm();
@ -311,6 +312,40 @@ class Admin_DownController extends Zend_Controller_Action
$this->_helper->viewRenderer('offlineshow');
}//查看单条记录
else if($emaillist)
{
$sql = "select distinct(t.*) from
(
select u.email from dataorder d left join users u on d.userid=u.id where (d.status=0 or d.status=5)
union
select o.email from offlineapp o where o.userid is null and o.email is not null
) as t";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
$filecontent = "";
foreach($rows as $row){
$filecontent.=$row['email']."\r\n";
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="emails.txt"')
->setHeader('Content-Length', strlen($filecontent))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($filecontent);
}//下载邮箱地址列表
$select=$this->db->select();
$select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->order('ts_created desc');
$paginator = Zend_Paginator::factory($select);

View File

@ -23,7 +23,7 @@
</div>
<?php endif; ?>
<div class="right_title">离线数据服务记录</div>
<a href="/admin/down/offline/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a> | <a href="/admin/down/offline/update/1" onclick="return confirm('该操作需要较长时间,请不要中途刷新页面,是否确定继续?')">自动匹配离线下载用户与网站用户</a>
<a href="/admin/down/offline/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a> | <a href="/admin/down/offline/update/1" onclick="return confirm('该操作需要较长时间,请不要中途刷新页面,是否确定继续?')">自动匹配离线下载用户与网站用户</a> | <a href="/admin/down/offline/emaillist/1">下载服务用户邮箱列表</a>
<?php if (count($this->paginator)): ?>
<table>
<thead><tr>