* [highgo] Add " for table check.

This commit is contained in:
朱金勇
2025-11-05 08:54:34 +08:00
committed by Gitfox
parent b5d3c0df0e
commit 6da0fbf640
+5 -5
View File
@@ -1246,7 +1246,7 @@ class actionModel extends model
{
$actionCondition = $this->getActionCondition();
$actionCondition = str_replace(' `action`', ' action.`action`', $actionCondition);
$hasProduct = preg_match('/t2\.(`?)product/', $sql);
$hasProduct = preg_match('/t2\.([`"]?)product/', $sql);
/* 构建权限搜索条件。 */
/* Build has priv search condition. */
@@ -1952,7 +1952,7 @@ class actionModel extends model
if(empty($condition)) return false;
$beginAndEnd = $this->computeBeginAndEnd($period, '', $direction);
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
$hasProduct = preg_match('/t2\.([`"]?)product/', $condition);
$condition = preg_replace("/AND +`?date`?\s*(<|>|<=|>=)\s*'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
$actions = $this->dao->select('action.id')->from(TABLE_ACTION)->alias('action')
->beginIF($hasProduct)->leftJoin(TABLE_ACTIONPRODUCT)->alias('t2')->on('action.id=t2.action')->fi()
@@ -2566,7 +2566,7 @@ class actionModel extends model
if(empty($condition)) return 0;
$table = $this->actionTao->getActionTable($period);
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
$hasProduct = preg_match('/t2\.([`"]?)product/', $condition);
$useIndex = $hasProduct && strpos('mysql,oceanbase', $this->config->db->driver) !== false ? ' USE INDEX (`vision_date`)' : ''; // 关联产品时指定索引以提高查询性能。Specify index to improve query performance when associated with product.
$beginAndEnd = $this->computeBeginAndEnd($period, '', 'next');
$condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
@@ -2626,7 +2626,7 @@ class actionModel extends model
$condition = $this->session->actionQueryCondition;
if(empty($condition)) return false;
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
$hasProduct = preg_match('/t2\.([`"]?)product/', $condition);
$lastDate = substr($lastAction->originalDate, 0, 10);
$condition = preg_replace("/AND +`?date`? +(<|>|<=|>=) +'\d{4}\-\d{2}\-\d{2}'/", '', $condition);
$actions = $this->dao->select('action.id')->from(TABLE_ACTION)->alias('action')
@@ -2655,7 +2655,7 @@ class actionModel extends model
$condition = $this->session->actionQueryCondition;
if(empty($condition)) return array();
$hasProduct = preg_match('/t2\.(`?)product/', $condition);
$hasProduct = preg_match('/t2\.([`"]?)product/', $condition);
$lastAction = $this->dao->select('*')->from(TABLE_ACTION)->where('id')->eq($lastActionID)->fetch();
$lastDate = substr($lastAction->date, 0, 10);
$actions = $this->dao->select('action.*')->from(TABLE_ACTION)->alias('action')