fix:修复BUG/升级1.1.6版本

This commit is contained in:
Ying
2023-04-25 20:11:49 +08:00
parent 445e5f9662
commit 6a6866bbaf
2357 changed files with 456920 additions and 140567 deletions

View File

@@ -4,7 +4,7 @@
"license": "MIT",
"require": {
"workerman/webman-framework": "^1.2.1",
"topthink/think-orm": "^2.0.53"
"topthink/think-orm": "^2.0.53 || ^3.0.0"
},
"autoload": {
"psr-4": {

View File

@@ -29,10 +29,15 @@ class ThinkOrm implements Bootstrap
$manager_instance = $property->getValue();
}
Timer::add(55, function () use ($manager_instance) {
$reflect = new \ReflectionClass($manager_instance);
$property = $reflect->getProperty('instance');
$property->setAccessible(true);
$instances = $property->getValue($manager_instance);
$instances = [];
if (method_exists($manager_instance, 'getInstance')) {
$instances = $manager_instance->getInstance();
} else {
$reflect = new \ReflectionClass($manager_instance);
$property = $reflect->getProperty('instance');
$property->setAccessible(true);
$instances = $property->getValue($manager_instance);
}
foreach ($instances as $connection) {
/* @var \think\db\connector\Mysql $connection */
if ($connection->getConfig('type') == 'mysql') {

View File

@@ -82,7 +82,7 @@ namespace think\facade {
* @throws \think\db\exception\BindParamException
* @throws \PDOException
*/
public function query(string $sql, array $bind = []): array
public static function query(string $sql, array $bind = []): array
{
/** @var \think\Db $instance */
return $instance->query($sql,$bind);
@@ -108,7 +108,7 @@ namespace think\facade {
* @throws \think\db\exception\BindParamException
* @throws \PDOException
*/
public function execute(string $sql, array $bind = []): int
public static function execute(string $sql, array $bind = []): int
{
/** @var \think\Db $instance */
return $instance->execute($sql,$bind);