修复关联主表时间字段无法搜索的BUG

pull/236/head
Karson 2020-09-12 16:27:56 +08:00
parent 788b1d57f6
commit 045b756272
1 changed files with 2 additions and 1 deletions

View File

@ -273,6 +273,7 @@ class Backend extends Controller
$op = (array)json_decode($op, true); $op = (array)json_decode($op, true);
$filter = $filter ? $filter : []; $filter = $filter ? $filter : [];
$where = []; $where = [];
$name = '';
$tableName = ''; $tableName = '';
if ($relationSearch) { if ($relationSearch) {
if (!empty($this->model)) { if (!empty($this->model)) {
@ -384,7 +385,7 @@ class Backend extends Controller
$arr = $arr[0]; $arr = $arr[0];
} }
$tableArr = explode('.', $k); $tableArr = explode('.', $k);
if (count($tableArr) > 1) { if (count($tableArr) > 1 && $tableArr[0] != $name) {
//修复关联模型下时间无法搜索的BUG //修复关联模型下时间无法搜索的BUG
$relation = Loader::parseName($tableArr[0], 1, false); $relation = Loader::parseName($tableArr[0], 1, false);
$this->model->alias([$this->model->$relation()->getTable() => $tableArr[0]]); $this->model->alias([$this->model->$relation()->getTable() => $tableArr[0]]);