Browse Source

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

Karson 5 years ago
parent
commit
045b756272
1 changed files with 2 additions and 1 deletions
  1. 2 1
      application/common/controller/Backend.php

+ 2 - 1
application/common/controller/Backend.php

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