增加了离线下载用户与网站用户自动匹配的功能
This commit is contained in:
parent
f6b99198e8
commit
593787fa2c
|
@ -146,6 +146,8 @@ class Admin_DownController extends Zend_Controller_Action
|
|||
$edit=(int)$this->_getParam('edit');
|
||||
$delete=(int)$this->_getParam('delete');
|
||||
$down=(int)$this->_getParam('down');
|
||||
$update=$this->_getParam('update');
|
||||
|
||||
if ($add) {
|
||||
$form=new OfflinelogForm();
|
||||
$form->pdf->setDestination($this->view->config->offline->savepath);
|
||||
|
@ -224,7 +226,28 @@ class Admin_DownController extends Zend_Controller_Action
|
|||
->setHeader('Pragma','public')
|
||||
->setBody($content);
|
||||
|
||||
} else if ($update) {
|
||||
|
||||
$sql = 'select o.id as oid,o.userid,o.username as un,u.email as uemail,o.email,u.realname as rn,u.id as uid from offlineapp o
|
||||
right join users u on o.email=u.email
|
||||
where o.userid is null and o.ts_approved is not null and o.email is not null';
|
||||
$re = $this->db->query($sql);
|
||||
$row = $re->fetchAll();
|
||||
$s=0;
|
||||
foreach ($row as $k=>$v)
|
||||
{
|
||||
if (empty($v['userid']))
|
||||
{
|
||||
$sql="update offlineapp set userid='{$v['uid']}' where id='{$v['oid']}'";
|
||||
$re=$this->db->exec($sql);
|
||||
$s++;
|
||||
}
|
||||
}
|
||||
$this->messenger->addMessage('提示信息:已有 '.$s.' 条记录被更改');
|
||||
|
||||
$this->_redirect('/admin/down/offline');
|
||||
|
||||
}//同步用户账户与离线申请记录
|
||||
$select=$this->db->select();
|
||||
$select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null and status>=0')->order('ts_created desc');
|
||||
$paginator = Zend_Paginator::factory($select);
|
||||
|
@ -432,5 +455,42 @@ class Admin_DownController extends Zend_Controller_Action
|
|||
|
||||
}//searchAction 搜索
|
||||
|
||||
function updateAction(){
|
||||
|
||||
/*$select=$this->db->select();
|
||||
$select ->from('offlineapp as o',array('username as un','email'))
|
||||
->join('users as u','u.email=o.email')
|
||||
->where('o.userid is null and o.ts_approved is not null and o.email is not null');*/
|
||||
|
||||
$sql = 'select o.id as oid,o.userid,o.username as un,u.email as uemail,o.email,u.realname as rn,u.id as uid from offlineapp o
|
||||
right join users u on o.email=u.email
|
||||
where o.userid is null and o.ts_approved is not null and o.email is not null';
|
||||
$re = $this->db->query($sql);
|
||||
$row = $re->fetchAll();
|
||||
|
||||
foreach ($row as $k=>$v)
|
||||
{
|
||||
if (empty($v['userid']))
|
||||
{
|
||||
$sql="update offlineapp set userid='{$v['uid']}' where id='{$v['oid']}'";
|
||||
$row[$k]['sql']=$sql;
|
||||
//$re=$this->db-exec($sql);
|
||||
}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($row);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(20);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
$count = count($row);
|
||||
$this->view->count=$count;
|
||||
|
||||
$this->_helper->viewRenderer('update');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<li class="title">申请管理与在线下载记录</li>
|
||||
<li><a href="/admin/down/offlineapp">离线数据申请管理</a></li>
|
||||
<li><a href="/admin/down/offline">离线数据服务记录</a></li>
|
||||
<li><a href="/admin/down/update">手动同步离线申请与网站帐号</a></li>
|
||||
<li><a href="/admin/down/online">在线数据下载记录(从20110908开始)</a></li>
|
||||
<li><a href="/admin/down/user">用户下载记录</a></li>
|
||||
<li><a href="/admin/down/data">数据下载记录</a></li>
|
||||
|
|
|
@ -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/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a> | <a href="/admin/down/offline/update/1" onclick="return confirm('该操作需要较长时间,请不要中途刷新页面,是否确定继续?')">自动匹配离线下载用户与网站用户</a>
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table>
|
||||
<thead><tr>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle('后台管理');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
||||
$this->breadcrumb('申请管理');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<div id="divContent">
|
||||
<div id="leftPanel">
|
||||
<?= $this->partial('down/left.phtml'); ?>
|
||||
</div>
|
||||
<div id="rightPanel">
|
||||
|
||||
<div class="right_title">离线申请中可能与网站会员关联的账户列表 (<?php echo $this->count;?> 条)</div>
|
||||
|
||||
<table>
|
||||
<tr style="color:#FFF;background:#0a3e68;line-height:30px;">
|
||||
<td width='100'>离线申请姓名</td>
|
||||
<td width='150'>离线申请Email</td>
|
||||
<td width='100'>用户姓名</td>
|
||||
<td width='150'>用户Email</td>
|
||||
<td width='100'>用户ID</td>
|
||||
<td width='200'>sql</td>
|
||||
</tr>
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<?php $autoindex=0;?>
|
||||
<?php foreach ($this->paginator as $item): ?>
|
||||
<?php $autoindex++;?>
|
||||
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
|
||||
<td><?php echo $item['un'];?></td>
|
||||
<td><?php echo $item['email']; ?></td>
|
||||
<td><?php echo $item['rn'];?></td>
|
||||
<td><?php echo $item['uemail']; ?></td>
|
||||
<td><?php echo $item['uid'];?></td>
|
||||
<td><?php echo $item['sql'];?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div style="width:50%;text-align:left;">
|
||||
<?= $this->paginator; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue