diff --git a/log/star.log b/log/star.log index 973ac46d7d2462634d7b404954fed73347fa88fc..ed3f359ff66035fcfcd13fa787468a5849866b45 100644 --- a/log/star.log +++ b/log/star.log @@ -1571,6 +1571,14 @@ {"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]"} +<<<<<<< HEAD +{"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"} +======= {"level":"INFO","timestamp":"2022-06-15 20:29:44.398","file":"store/mysql.go:50","msg":"数据库连接成功.Database Name: javaweb"} {"level":"INFO","timestamp":"2022-06-15 20:29:44.399","file":"store/redis.go:44","msg":"redis连接成功. URL: 127.0.0.1:6379"} {"level":"INFO","timestamp":"2022-06-15 20:29:44.401","file":"sd/healthcheck.go:25","msg":"路由正常"} @@ -1591,3 +1599,15 @@ {"level":"INFO","timestamp":"2022-06-15 20:58:52.045","file":"sd/healthcheck.go:25","msg":"路由正常"} {"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 2be52cb7860f3f5299c2df2ed96fd904b2f3fcf6..194059e9865c478552a04edc5799fbb2cfc5f6ca 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/pkg/util/onlineUserUtil.go b/pkg/util/onlineUserUtil.go index cf8b6ed4cff754aa080ed3bea7830d794ede1f68..fe540134b8a46c4a467f8fcc590f7c35617d61dd 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中字符串序列化为结构体失败") diff --git a/service/user.go b/service/user.go index 1de8c86d448867b8837e520a1f52e5e7f5e8c9d1..d14911b7be73a54a251ebb98421ad42350f8e05a 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 }