From 375b74b9d664a5a07b53994de137ccbca1de1e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Mon, 18 Oct 2021 09:20:10 +0800 Subject: [PATCH 1/2] * adjust for api. --- module/common/model.php | 2 +- module/my/model.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index d1ccf771a5..bd9dd1454d 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1763,7 +1763,7 @@ EOD; else { $key = $existsObjectList['idkey']; - $hasWhere = srtipos($queryCondition, ' where ') !== false; + $hasWhere = stripos($queryCondition, ' where ') !== false; if(!empty($preAndNextObject->pre)) $preAndNextObject->pre = $this->dao->query($queryCondition . ($hasWhere ? " AND `$key`='{$preAndNextObject->pre}' " : " WHERE `$key`='{$preAndNextObject->pre}' "))->fetch(); if(!empty($preAndNextObject->next)) $preAndNextObject->next = $this->dao->query($queryCondition . ($hasWhere ? " AND `$key`='{$preAndNextObject->next}' " : " WHERE `$key`='{$preAndNextObject->next}' "))->fetch(); } diff --git a/module/my/model.php b/module/my/model.php index de0bebb724..ce75ba9b1e 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -193,11 +193,14 @@ class myModel extends model $account = $this->app->user->account; $contribute = new stdclass(); - $contribute->docCreatedTotal = $this->dao->select('count(*) AS count')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count'); - $contribute->ownerProductTotal = $this->dao->select('count(*) AS count')->from(TABLE_PRODUCT)->where('PO')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count'); + $contribute->myTaskTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count'); + $contribute->myStoryTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->andWhere('type')->eq('story')->fetch('count'); + $contribute->myBugTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count'); + $contribute->docCreatedTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count'); + $contribute->ownerProductTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_PRODUCT)->where('PO')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count'); $inTeam = $this->dao->select('root')->from(TABLE_TEAM)->where('type')->eq('project')->andWhere('account')->eq($this->app->user->account)->fetchPairs('root', 'root'); - $contribute->involvedProjectTotal = $this->dao->select('count(*) AS count')->from(TABLE_PROJECT) + $contribute->involvedProjectTotal = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT) ->where('deleted')->eq('0') ->andWhere('type')->eq('project') ->andWhere('id', true)->in($inTeam) From 06f6d3157967cfbfc6d9c4e3bf28da15dca5d49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Mon, 18 Oct 2021 10:24:28 +0800 Subject: [PATCH 2/2] * add my bug data for api. --- api/v1/entries/user.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/v1/entries/user.php b/api/v1/entries/user.php index 3d830aa3ed..8642cff4ee 100644 --- a/api/v1/entries/user.php +++ b/api/v1/entries/user.php @@ -98,6 +98,20 @@ class userEntry extends Entry $info->task['tasks'] = $data->data->tasks; } + break; + case 'bug': + $info->bug = array('total' => 0, 'bugs' => array()); + + $control = $this->loadController('my', 'bug'); + $control->bug($this->param('type', 'assignedTo'), $this->param('order', 'id_desc'), $this->param('total', 0), $this->param('limit', 5), $this->param('page', 1)); + $data = $this->getData(); + + if($data->status == 'success') + { + $info->bug['total'] = $data->data->pager->recTotal; + $info->bug['bugs'] = $data->data->bugs; + } + break; case 'todo': $info->todo = array('total' => 0, 'todos' => array());