From ee8780119037558ab19a28ea0b199a75355b8251 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 18 Jun 2025 14:01:18 +0800 Subject: [PATCH] * [perf story #75386] Adjust execution dynamic page. --- module/action/tao.php | 6 +++++- module/execution/control.php | 4 ++-- module/execution/ui/dynamic.html.php | 21 +++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/module/action/tao.php b/module/action/tao.php index a88b377785..acea13e932 100644 --- a/module/action/tao.php +++ b/module/action/tao.php @@ -699,8 +699,12 @@ class actionTao extends actionModel $lastMonth = date('Y-m-d', strtotime('-1 month')); $actionTable = ($begin >= $lastMonth && $end >= $lastMonth) ? TABLE_ACTIONRECENT : TABLE_ACTION; + $hasProduct = strpos($condition, 't2.product') !== false; + if(is_numeric($productID) && $productID) $hasProduct = true; + if($productID === 'notzero') $hasProduct = true; + return $this->dao->select('action.*')->from($actionTable)->alias('action') - ->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action') + ->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi() ->where('objectType')->notIN($this->config->action->ignoreObjectType4Dynamic) ->andWhere('action.action')->notIN($this->config->action->ignoreActions4Dynamic) ->andWhere('vision')->eq($this->config->vision) diff --git a/module/execution/control.php b/module/execution/control.php index 2adffc7a20..9cd628fe8a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2618,9 +2618,9 @@ class execution extends control $period = $type == 'account' ? 'all' : $type; $orderBy = $direction == 'next' ? 'date_desc' : 'date_asc'; $date = empty($date) ? '' : date('Y-m-d', (int)$date); - $actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, 50, 'all', 'all', $executionID, $date, $direction); + $actions = $this->loadModel('action')->getDynamicByExecution($executionID, $account, $period, $orderBy, 50, $date, $direction); $dateGroups = $this->action->buildDateGroup($actions, $direction); - if(empty($recTotal)) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); + if(empty($recTotal) && $dateGroups) $recTotal = count($dateGroups) < 2 ? count($dateGroups, 1) - count($dateGroups) : $this->action->getDynamicCount(); $this->view->title = $execution->name . $this->lang->hyphen . $this->lang->execution->dynamic; $this->view->userIdPairs = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted|useid'); diff --git a/module/execution/ui/dynamic.html.php b/module/execution/ui/dynamic.html.php index 6a4e9c0f67..d40eaa7c7c 100644 --- a/module/execution/ui/dynamic.html.php +++ b/module/execution/ui/dynamic.html.php @@ -51,7 +51,8 @@ else $lastAction = ''; foreach($dateGroups as $date => $actions) { - $isToday = date(DT_DATE4) == $date; + $lastAction = end($actions); + $isToday = date(DT_DATE4) == $date; if(empty($firstAction)) $firstAction = reset($actions); $content[] = li ( @@ -84,9 +85,25 @@ else ) ) ); - $lastAction = end($actions); } + global $app; + $hasMore = $app->control->loadModel('action')->hasMoreAction($lastAction); + if($hasMore) + { + $content[] = li + ( + a + ( + setID('showMoreDynamic'), + setClass('block text-center'), + setData(array('lastid' => $lastAction->id)), + set::href('###'), + on::click('showMore'), + icon('chevron-double-down') + ) + ); + } $content = ul ( setClass('timeline list-none pl-0'),