From 23f28106eaed68c78b43f0407dec12bb91170ea1 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 8 Aug 2023 14:13:42 +0800 Subject: [PATCH] * Change the query action table when the date < 30. --- config/zentaopms.php | 1 + module/action/config.php | 2 ++ module/action/model.php | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index c62bbf6550..731f4db128 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -316,6 +316,7 @@ define('TABLE_API_LIB_RELEASE', '`' . $config->db->prefix . 'api_lib_release`'); define('TABLE_MODULE', '`' . $config->db->prefix . 'module`'); define('TABLE_ACTION', '`' . $config->db->prefix . 'action`'); +define('TABLE_ACTIONLATEST', '`' . $config->db->prefix . 'actionlatest`'); define('TABLE_FILE', '`' . $config->db->prefix . 'file`'); define('TABLE_HOLIDAY', '`' . $config->db->prefix . 'holiday`'); define('TABLE_HISTORY', '`' . $config->db->prefix . 'history`'); diff --git a/module/action/config.php b/module/action/config.php index 62fef9227b..a4848f7218 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -92,3 +92,5 @@ $config->trash->search['params']['objectName'] = array('operator' => 'include', $config->trash->search['params']['objectID'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->trash->search['params']['actor'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->trash->search['params']['date'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); + +$config->action->latestDateList = array('today', 'yesterday', 'thisWeek', 'lastWeek', 'thisMonth'); diff --git a/module/action/model.php b/module/action/model.php index f416ca27a8..2c1e099cd2 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -71,6 +71,7 @@ class actionModel extends model $this->dao->insert(TABLE_ACTION)->data($action)->autoCheck()->exec(); $actionID = $this->dao->lastInsertID(); + $this->dao->insert(TABLE_ACTIONLATEST)->data($action)->autoCheck()->exec(); if($this->post->uid) $this->file->updateObjectID($this->post->uid, $objectID, $objectType); /* Call the message notification function. */ @@ -1162,7 +1163,9 @@ class actionModel extends model $condition = "($condition)"; /* Get actions. */ - $actions = $this->dao->select('*')->from(TABLE_ACTION) + $actionTable = in_array($period, $this->config->action->latestDateList) ? TABLE_ACTIONLATEST : TABLE_ACTION; + + $actions = $this->dao->select('*')->from($actionTable) ->where('objectType')->notIN($this->config->action->ignoreObjectType4Dynamic) ->andWhere('vision')->eq($this->config->vision) ->beginIF($period != 'all')->andWhere('date')->gt($begin)->fi()