diff --git a/module/design/control.php b/module/design/control.php index 739e347b09..d45d6d6106 100755 --- a/module/design/control.php +++ b/module/design/control.php @@ -309,7 +309,7 @@ class design extends control $repoID = $repoID ? $repoID : key($repos); $repo = $this->loadModel('repo')->getByID((int)$repoID); - $revisions = $this->design->getCommits($repo,$begin, date('Y-m-d 23:59:59', strtotime($end))); + $revisions = $this->repo->getCommits($repo, '', 'HEAD', 'dir', null, $begin, date('Y-m-d 23:59:59', strtotime($end))); $this->session->set('designRevisions', $revisions); diff --git a/module/design/model.php b/module/design/model.php index 5bfb20c422..1c4cda7a7e 100755 --- a/module/design/model.php +++ b/module/design/model.php @@ -351,45 +351,6 @@ class designModel extends model return $design; } - /** - * Get commits - * - * @param object $repo - * @param string $begin - * @param string $end - * @access public - * @return array - */ - public function getCommits(object $repo, string $begin, string $end): array - { - $revisionTime = $this->dao->select('time')->from(TABLE_REPOHISTORY)->alias('t1') - ->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision') - ->where('t1.repo')->eq($repo->id) - ->beginIF($repo->SCM != 'Subversion' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi() - ->orderBy('time desc') - ->limit(1) - ->fetch('time'); - - $comments = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1') - ->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision') - ->where('t1.repo')->eq($repo->id) - ->beginIF($revisionTime)->andWhere('t1.`time`')->le($revisionTime)->fi() - ->andWhere('left(t1.comment, 12)')->ne('Merge branch') - ->beginIF($repo->SCM != 'Subversion' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi() - ->beginIF($begin)->andWhere('t1.time')->ge($begin)->fi() - ->beginIF($end)->andWhere('t1.time')->le($end)->fi() - ->orderBy('time desc') - ->fetchAll('id'); - - $this->loadModel('repo'); - foreach($comments as $repoComment) - { - $repoComment->originalComment = $repoComment->comment; - $repoComment->comment = $this->repo->replaceCommentLink($repoComment->comment); - } - return $comments; - } - /** * 获取搜索后的设计列表数据。 * Get designs by search.