From eea9be6a2437240357f0025edc8edd8195b412c7 Mon Sep 17 00:00:00 2001 From: Yongchun Jiang Date: Sun, 3 Aug 2025 13:01:47 +0800 Subject: [PATCH] =?UTF-8?q?logback=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + data/magic-api/api/认证授权/登录.ms | 18 ++++------ src/main/resources/application.yml | 2 ++ src/main/resources/logback-spring.xml | 47 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/.gitignore b/.gitignore index 94d9114..22d8940 100644 --- a/.gitignore +++ b/.gitignore @@ -115,3 +115,4 @@ gradle-app.setting # ---> Gradle .idea +logs/ diff --git a/data/magic-api/api/认证授权/登录.ms b/data/magic-api/api/认证授权/登录.ms index 82ae048..b97763e 100644 --- a/data/magic-api/api/认证授权/登录.ms +++ b/data/magic-api/api/认证授权/登录.ms @@ -5,7 +5,7 @@ "groupId" : "0f7392c3132d4ae698caf0e8ab55756b", "name" : "登录", "createTime" : 1754119582735, - "updateTime" : 1754121286889, + "updateTime" : 1754193379477, "lock" : null, "createBy" : "admin", "updateBy" : "admin", @@ -13,7 +13,7 @@ "method" : "POST", "parameters" : [ ], "options" : [ ], - "requestBody" : "{\n \"username\": \"admin\",\n \"password\": \"123456\"\n}", + "requestBody" : "{\n \"username\": \"admin\",\n \"password\": \"1234567\"\n}", "headers" : [ ], "paths" : [ ], "responseBody" : "{\n \"code\": \"000000\",\n \"message\": \"成功\",\n \"data\": {\n \"access_token\": \"7a01c52f44d54dd6a6517ba36cba122f\",\n \"refresh_token\": \"d8c639f0288a4cdfa96ac56378bdcc23\"\n }\n}", @@ -132,7 +132,7 @@ ================================ // 参数校验 if (is_null(body) || is_blank(body.username) || is_blank(body.password)){ - return biz_failure_fmt(BizConstants.FAILURE, "请求参数无效,用户名或密码不能为空") + return biz_failure(BizConstants.AUTH_0301) } // 登录 @@ -140,19 +140,13 @@ var userDO = db.select(""" SELECT * FROM sys_org_user WHERE username = #{body.username} """) if (userDO == null || !bcrypt_match(body.password, userDO.password)){ - return biz_failure_fmt(BizConstants.FAILURE, "用户名或密码错误") -} -if (userDO.status == "PENDING") { - return biz_failure_fmt(BizConstants.FAILURE, "用户未审核通过") + return biz_failure(BizConstants.AUTH_0302) } if (userDO.status == "LOCKED") { - return biz_failure_fmt(BizConstants.FAILURE, "用户以被锁定,请稍后重试") + return biz_failure(BizConstants.AUTH_0303) } if (userDO.status == "BANNED") { - return biz_failure_fmt(BizConstants.FAILURE, "用户以被禁用") -} -if (userDO.status == "DELETED") { - return biz_failure_fmt(BizConstants.FAILURE, "用户不存在") + return biz_failure(BizConstants.AUTH_0304) } var access_token = uuid() diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 793b327..d3e4251 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,6 +5,8 @@ server: spring: application: name: dolphin-parent + profiles: + active: dev datasource: name: postgres driver-class-name: org.postgresql.Driver diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..fc3e167 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + ${LOG_PATTERN} + + + + + + ${LOG_PATH}/app-execute.log + + ${LOG_PATH}/app-execute-%d{yyyy-MM-dd}.%i.log + 100MB + 30 + + + ${LOG_PATTERN} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file