浏览代码

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

Karson 5 年之前
父节点
当前提交
045b756272
共有 1 个文件被更改,包括 2 次插入1 次删除
  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]]);