mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进query类的value和column方法的缓存问题
This commit is contained in:
@@ -605,7 +605,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
$model = $class->$relation();
|
$model = $class->$relation();
|
||||||
$info = $class->getRelationInfo();
|
$info = $class->getRelationInfo();
|
||||||
$table = $info['model']::getTable();
|
$table = $info['model']::getTable();
|
||||||
return self::db()->alias('a')->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'])->group('b.' . $info['foreignKey'])
|
return self::db()->alias('a')
|
||||||
|
->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'])
|
||||||
|
->group('b.' . $info['foreignKey'])
|
||||||
->having('count(' . $id . ')' . $operator . $count);
|
->having('count(' . $id . ')' . $operator . $count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +632,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self::db()->alias('a')->field('a.*')->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'])->where($where);
|
return self::db()->alias('a')
|
||||||
|
->field('a.*')
|
||||||
|
->join($table . ' b', 'a.' . $info['localKey'] . '=b.' . $info['foreignKey'])
|
||||||
|
->where($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ class Query
|
|||||||
// 缓存数据
|
// 缓存数据
|
||||||
Cache::set($key, $result, $cache['expire']);
|
Cache::set($key, $result, $cache['expire']);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 清空查询条件
|
||||||
|
$this->options = [];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -149,6 +152,9 @@ class Query
|
|||||||
// 缓存数据
|
// 缓存数据
|
||||||
Cache::set($guid, $result, $cache['expire']);
|
Cache::set($guid, $result, $cache['expire']);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 清空查询条件
|
||||||
|
$this->options = [];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user