diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index f04a9c73..737e1bb2 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -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 {