From 1acec8643b390754924a430ee3f8516524b387b9 Mon Sep 17 00:00:00 2001 From: yangxuzheng <1391625461@qq.com> Date: Wed, 15 Jun 2022 21:04:15 +0800 Subject: [PATCH 1/3] 1 --- log/star.log | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/log/star.log b/log/star.log index e72fb3b..f771062 100644 --- a/log/star.log +++ b/log/star.log @@ -1571,3 +1571,9 @@ {"level":"INFO","timestamp":"2022-06-15 11:22:48.672","file":"qiandaoxitong/main.go:49","msg":"开始监听 http 地址上的传入请求: :8000"} {"level":"INFO","timestamp":"2022-06-15 11:22:49.711","file":"store/lesson.go:141","msg":"获取用户加入课程成功"} {"level":"INFO","timestamp":"2022-06-15 11:22:54.090","file":"store/lesson.go:84","msg":"查询用户创建列表成功[0xc00033e4b0]"} +{"level":"ERROR","timestamp":"2022-06-15 20:49:15.837","file":"store/mysql.go:48","msg":"数据库连接失败.Database Name: javaweb","data":{"error":"Error 1045: Access denied for user 'root'@'localhost' (using password: YES)"}} +{"level":"INFO","timestamp":"2022-06-15 20:49:15.838","file":"store/mysql.go:50","msg":"数据库连接成功.Database Name: javaweb"} +{"level":"INFO","timestamp":"2022-06-15 20:49:15.838","file":"store/redis.go:44","msg":"redis连接成功. URL: 127.0.0.1:6379"} +{"level":"INFO","timestamp":"2022-06-15 20:49:16.343","file":"sd/healthcheck.go:25","msg":"路由正常"} +{"level":"INFO","timestamp":"2022-06-15 20:49:16.344","file":"qiandaoxitong/main.go:48","msg":"路由启动成功."} +{"level":"INFO","timestamp":"2022-06-15 20:49:16.344","file":"qiandaoxitong/main.go:49","msg":"开始监听 http 地址上的传入请求: :8000"} -- Gitee From a57c698609041144d24d47556bb6da954762fd4d Mon Sep 17 00:00:00 2001 From: yangxuzheng <1391625461@qq.com> Date: Thu, 11 Aug 2022 10:46:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/onlineUserUtil.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/util/onlineUserUtil.go b/pkg/util/onlineUserUtil.go index cf8b6ed..fe54013 100644 --- a/pkg/util/onlineUserUtil.go +++ b/pkg/util/onlineUserUtil.go @@ -32,7 +32,7 @@ func GetRequestIP(c *gin.Context) string { } // GetAllOnlineUser -// @Description: 获取所有在线的用户 +// @Description: 获取某个账号所有在线的信息 // @Author YangXuZheng // @Date: 2022-06-12 21:03 func GetAllOnlineUser(userId string) ([]viewmodel.OnlineUserInfo, error) { @@ -48,6 +48,9 @@ func GetAllOnlineUser(userId string) ([]viewmodel.OnlineUserInfo, error) { userInfo, _ := RedisGet(v) bytes := StringToByteSlice(userInfo) err := json.Unmarshal(bytes, &dateMap) + if dateMap.Id != userId { + continue + } if err != nil { log.Errorf(err, "redis中字符串序列化为结构体失败") return nil, errors.New("redis中字符串序列化为结构体失败") -- Gitee From baefa263e6375d392e1389ed225982d1aacb1a20 Mon Sep 17 00:00:00 2001 From: yangxuzheng <1391625461@qq.com> Date: Thu, 11 Aug 2022 10:47:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B8=A2=E5=87=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/star.log | 11 +++++++++++ pkg/util/codeUtil.go | 4 ++-- service/user.go | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/log/star.log b/log/star.log index 0d5556e..ed3f359 100644 --- a/log/star.log +++ b/log/star.log @@ -1600,3 +1600,14 @@ {"level":"INFO","timestamp":"2022-06-15 20:58:52.046","file":"qiandaoxitong/main.go:48","msg":"路由启动成功."} {"level":"INFO","timestamp":"2022-06-15 20:58:52.046","file":"qiandaoxitong/main.go:49","msg":"开始监听 http 地址上的传入请求: :8000"} >>>>>>> f09892ddbcff36a357838fc1389d93abd9903946 +{"level":"ERROR","timestamp":"2022-06-15 21:06:34.968","file":"store/mysql.go:48","msg":"数据库连接失败.Database Name: javaweb","data":{"error":"Error 1045: Access denied for user 'root'@'localhost' (using password: YES)"}} +{"level":"INFO","timestamp":"2022-06-15 21:06:34.969","file":"store/mysql.go:50","msg":"数据库连接成功.Database Name: javaweb"} +{"level":"INFO","timestamp":"2022-06-15 21:06:34.969","file":"store/redis.go:44","msg":"redis连接成功. URL: 127.0.0.1:6379"} +{"level":"INFO","timestamp":"2022-06-15 21:06:35.476","file":"sd/healthcheck.go:25","msg":"路由正常"} +{"level":"INFO","timestamp":"2022-06-15 21:06:35.476","file":"qiandaoxitong/main.go:48","msg":"路由启动成功."} +{"level":"INFO","timestamp":"2022-06-15 21:06:35.476","file":"qiandaoxitong/main.go:49","msg":"开始监听 http 地址上的传入请求: :8000"} +{"level":"INFO","timestamp":"2022-06-15 21:08:47.872","file":"sd/healthcheck.go:53","msg":"OK - 可用空间:283597MB(276GB) / 720762MB(703GB) | 已使用:39%"} +{"level":"INFO","timestamp":"2022-06-15 21:17:15.104","file":"sd/healthcheck.go:77","msg":"OK - 平均负荷: 0.00, 0.00, 0.00 | 物理内核: 6"} +{"level":"INFO","timestamp":"2022-06-15 21:17:24.973","file":"sd/healthcheck.go:106","msg":"OK - 可用空间:10268MB(10GB) / 16261MB(15GB) | 已使用:63%"} +{"level":"INFO","timestamp":"2022-06-15 21:17:47.304","file":"sd/healthcheck.go:25","msg":"路由正常"} +{"level":"INFO","timestamp":"2022-06-15 21:17:50.905","file":"sd/healthcheck.go:25","msg":"路由正常"} diff --git a/pkg/util/codeUtil.go b/pkg/util/codeUtil.go index 2be52cb..194059e 100644 --- a/pkg/util/codeUtil.go +++ b/pkg/util/codeUtil.go @@ -12,8 +12,8 @@ var Result = base64Captcha.DefaultMemStore // @Description: 生成图片验证码的 base64编码和ID // @Author YangXuZheng 2022-06-11 13:21 // @Result id 验证码id -// @Result base64 图片base64编码 -// @Result error 错误 +// @Result bse64s 图片base64编码 +// @Result err 错误 func CreateCode() (string, string, error) { var driver base64Captcha.Driver switch viper.GetString("code.captcha_type") { diff --git a/service/user.go b/service/user.go index 1de8c86..d14911b 100644 --- a/service/user.go +++ b/service/user.go @@ -189,7 +189,7 @@ func Login(loginRequest viewmodel.LoginRequest, ctx *gin.Context) (viewmodel.Log // 单用户模式:true,多用户模式:false // 为true需要踢掉之前登陆过的用户 if viper.GetBool("login.single_login") { - err := util.CheckLoginOnUser(loginRequest.Uuid, userToken) + err := util.CheckLoginOnUser(userInfo.UserId, userToken) if err != nil { return viewmodel.LoginResponse{}, err } -- Gitee