mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 07:02:47 +08:00
改进软删除
This commit is contained in:
@@ -38,6 +38,8 @@ class Mysql extends Builder
|
|||||||
list($table, $key) = explode('.', $key, 2);
|
list($table, $key) = explode('.', $key, 2);
|
||||||
if (isset($options['alias'][$table])) {
|
if (isset($options['alias'][$table])) {
|
||||||
$table = $options['alias'][$table];
|
$table = $options['alias'][$table];
|
||||||
|
} elseif ('__TABLE__' == $table) {
|
||||||
|
$table = $this->query->getTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
|
if (!preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class Pgsql extends Builder
|
|||||||
list($table, $key) = explode('.', $key, 2);
|
list($table, $key) = explode('.', $key, 2);
|
||||||
if (isset($options['alias'][$table])) {
|
if (isset($options['alias'][$table])) {
|
||||||
$table = $options['alias'][$table];
|
$table = $options['alias'][$table];
|
||||||
|
} elseif ('__TABLE__' == $table) {
|
||||||
|
$table = $this->query->getTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($table)) {
|
if (isset($table)) {
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ class Sqlite extends Builder
|
|||||||
list($table, $key) = explode('.', $key, 2);
|
list($table, $key) = explode('.', $key, 2);
|
||||||
if (isset($options['alias'][$table])) {
|
if (isset($options['alias'][$table])) {
|
||||||
$table = $options['alias'][$table];
|
$table = $options['alias'][$table];
|
||||||
|
} elseif ('__TABLE__' == $table) {
|
||||||
|
$table = $this->query->getTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($table)) {
|
if (isset($table)) {
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ class Sqlsrv extends Builder
|
|||||||
list($table, $key) = explode('.', $key, 2);
|
list($table, $key) = explode('.', $key, 2);
|
||||||
if (isset($options['alias'][$table])) {
|
if (isset($options['alias'][$table])) {
|
||||||
$table = $options['alias'][$table];
|
$table = $options['alias'][$table];
|
||||||
|
} elseif ('__TABLE__' == $table) {
|
||||||
|
$table = $this->query->getTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is_numeric($key) && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) {
|
if (!is_numeric($key) && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) {
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ trait SoftDelete
|
|||||||
{
|
{
|
||||||
$field = isset($this->deleteTime) ? $this->deleteTime : 'delete_time';
|
$field = isset($this->deleteTime) ? $this->deleteTime : 'delete_time';
|
||||||
if (!strpos($field, '.')) {
|
if (!strpos($field, '.')) {
|
||||||
$field = $this->db(false)->getTable() . '.' . $field;
|
$field = '__TABLE__.' . $field;
|
||||||
}
|
}
|
||||||
if (!$read && strpos($field, '.')) {
|
if (!$read && strpos($field, '.')) {
|
||||||
$array = explode('.', $field);
|
$array = explode('.', $field);
|
||||||
|
|||||||
Reference in New Issue
Block a user