From 014260c99791367c536a0f47de6c2f937cc23298 Mon Sep 17 00:00:00 2001 From: xucong <850806214@qq.com> Date: Sat, 10 May 2025 15:57:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=BC=BA=E5=A4=B1=E4=BF=A1=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/service/UserServer.php | 5 +++-- config/database.php | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/api/service/UserServer.php b/app/api/service/UserServer.php index 5f35e0c..0d63270 100644 --- a/app/api/service/UserServer.php +++ b/app/api/service/UserServer.php @@ -28,11 +28,12 @@ use app\common\model\noticesetting\NoticeSetting; use app\common\model\UserLevel; use app\common\service\storage\Driver as StorageDriver; use app\common\service\UrlServer; -use think\Db; +use think\facade\Db; use think\Exception; use app\common\service\ConfigServer; use think\facade\Hook; + class UserServer { @@ -53,7 +54,7 @@ class UserServer $avatar_url = $response['headimgurl'] ?? ''; $nickname = $response['nickname'] ?? ''; - (new \think\Db)->startTrans(); + Db::startTrans(); // 获取存储引擎 $config = [ diff --git a/config/database.php b/config/database.php index b09a9bd..93bd19e 100755 --- a/config/database.php +++ b/config/database.php @@ -24,19 +24,19 @@ return [ // 数据库类型 'type' => env('database.type', 'mysql'), // 服务器地址 - 'hostname' => env('database.hostname', 'likeshop-mysql'), + 'hostname' => env('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => env('database.database', 'localhost_likeadmin'), + 'database' => env('database.database', 'jianbing'), // 用户名 'username' => env('database.username', 'root'), // 密码 - 'password' => env('database.password', 'root'), + 'password' => env('database.password', 'c24a8441c99a673b'), // 端口 'hostport' => env('database.hostport', '3306'), // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 - 'charset' => env('database.charset', 'utf8mb4'), + 'charset' => env('database.charset', 'utf8'), // 数据库表前缀 'prefix' => env('database.prefix', 'la_'), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)