|
@@ -388,7 +388,7 @@ class Backend extends Controller |
|
@@ -388,7 +388,7 @@ class Backend extends Controller |
388
|
$arr = $arr[0];
|
388
|
$arr = $arr[0];
|
389
|
}
|
389
|
}
|
390
|
$tableArr = explode('.', $k);
|
390
|
$tableArr = explode('.', $k);
|
391
|
- if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias)) {
|
391
|
+ if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) {
|
392
|
//修复关联模型下时间无法搜索的BUG
|
392
|
//修复关联模型下时间无法搜索的BUG
|
393
|
$relation = Loader::parseName($tableArr[0], 1, false);
|
393
|
$relation = Loader::parseName($tableArr[0], 1, false);
|
394
|
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
|
394
|
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
|
|
@@ -406,12 +406,15 @@ class Backend extends Controller |
|
@@ -406,12 +406,15 @@ class Backend extends Controller |
406
|
}
|
406
|
}
|
407
|
$index++;
|
407
|
$index++;
|
408
|
}
|
408
|
}
|
409
|
-
|
409
|
+ if (!empty($this->model)) {
|
410
|
$this->model->alias($alias);
|
410
|
$this->model->alias($alias);
|
|
|
411
|
+ }
|
411
|
$model = $this->model;
|
412
|
$model = $this->model;
|
412
|
$where = function ($query) use ($where, $alias, $bind, &$model) {
|
413
|
$where = function ($query) use ($where, $alias, $bind, &$model) {
|
|
|
414
|
+ if (!empty($model)) {
|
413
|
$model->alias($alias);
|
415
|
$model->alias($alias);
|
414
|
$model->bind($bind);
|
416
|
$model->bind($bind);
|
|
|
417
|
+ }
|
415
|
foreach ($where as $k => $v) {
|
418
|
foreach ($where as $k => $v) {
|
416
|
if (is_array($v)) {
|
419
|
if (is_array($v)) {
|
417
|
call_user_func_array([$query, 'where'], $v);
|
420
|
call_user_func_array([$query, 'where'], $v);
|