修改了重复写入mdversion表的sql bug

This commit is contained in:
Li Jianxuan 2012-06-11 09:34:57 +00:00
parent dc0b83af5c
commit 348912eb78
1 changed files with 6 additions and 5 deletions

View File

@ -3000,14 +3000,14 @@ class AuthorController extends Zend_Controller_Action
/*
* getStaticByYear按月份获取统计数据
*/
public function getStaticByYear($year=0)
public function getStaticByYear($year=0)
{
$uid=Zend_Auth::getInstance()->getIdentity()->id;
$sql = "select to_char(o.ts_created, 'YYYY-MM') as d , count(o.id) as c from dataorder o
where o.status in (0,5) and o.uuid in (select uuid from mdauthor where status=1 and userid=".$uid.")";
if ($year>0)
$sql.=" and o.ts_created between '$year-01-01' and '$year-12-31' ";
where o.status in (0,5) and o.uuid in (select uuid from mdauthor where status=1 and userid=".$uid.")";
if ($year>0)
$sql.=" and o.ts_created between '$year-01-01' and '$year-12-31' ";
$sql.=" group by d order by d desc";
$sth = $this->db->prepare($sql);
@ -3078,7 +3078,8 @@ class AuthorController extends Zend_Controller_Action
$sql="insert into mdversion (xml,ts_created,uuid,changelog,userid)
select x.data,m.ts_created,?,?,? from metadata m left join xml x on m.id=x.id
left join mdversion v on m.uuid=v.uuid
where m.uuid=? and v.changelog is null";
where m.uuid=? and v.changelog is null
order by v.ts_created ASC LIMIT 1";
$sth=$this->db->prepare($sql);
try
{