diff --git a/code/allapp/allapp-go/biz/handler/auth/login_service.go b/code/allapp/allapp-go/biz/handler/auth/login_service.go index 431356ad..a91808e5 100644 --- a/code/allapp/allapp-go/biz/handler/auth/login_service.go +++ b/code/allapp/allapp-go/biz/handler/auth/login_service.go @@ -3,15 +3,16 @@ package auth import ( + "allapp/biz/handler/space" "allapp/biz/model/auth" "allapp/conf" "allapp/db" "allapp/db/repo" - "allapp/utils" "allapp/utils/errorx" "allapp/utils/httpx" "allapp/utils/idgen" "allapp/utils/jwtx" + "allapp/utils/redisx" "allapp/utils/response" "context" "fmt" @@ -57,6 +58,14 @@ func LoginQq(ctx context.Context, c *app.RequestContext) { return } + // 初始化空间信息 + err := InitUserSpaces(ctx, user.UserID) + + if err != nil { + errorx.AddError(c, err) + return + } + _ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID) token, _ := jwtx.CreateToken(user.UserID) @@ -64,6 +73,7 @@ func LoginQq(ctx context.Context, c *app.RequestContext) { resp.UserId = user.UserID resp.Username = user.Username resp.Avatar = user.Avatar + response.Success(c).Data(resp).Send() return } @@ -140,6 +150,14 @@ func LoginWx(ctx context.Context, c *app.RequestContext) { return } + // 初始化用户空间信息 + err := InitUserSpaces(ctx, user.UserID) + + if err != nil { + errorx.AddError(c, err) + return + } + _ = db.Queries.UpdateUserLastLoginTime(ctx, user.UserID) token, _ := jwtx.CreateToken(user.UserID) @@ -175,7 +193,6 @@ func LoginWx(ctx context.Context, c *app.RequestContext) { // registerUser 注册通用函数 func registerUser(ctx context.Context, c *app.RequestContext, openid, nickname, avatar string, loginType int32) { userId := idgen.NextId() - spaceId := idgen.NextId() if nickname == "" { nickname = fmt.Sprintf("用户_%d", userId) @@ -185,33 +202,10 @@ func registerUser(ctx context.Context, c *app.RequestContext, openid, nickname, } err := db.WithTx(ctx, func(q *repo.Queries) error { - // 生成唯一邀请码 - var inviteCode string - for { - code := utils.GenerateCode(6) - _, err := q.FindSpaceByInviteCode(ctx, code) - if errorx.IsNotFound(err) { - inviteCode = code - break - } else if err != nil { - return err - } - } + // 确保空间存在 + err := space.EnsureUserHasSpaceWithTx(ctx, q, userId) - // 插入空间 - if err := q.InsertSpace(ctx, repo.InsertSpaceParams{ - ID: spaceId, - InviteCode: inviteCode, - }); err != nil { - return err - } - - // 插入空间用户 - if err := q.InsertSpaceUser(ctx, repo.InsertSpaceUserParams{ - ID: idgen.NextId(), - SpaceID: spaceId, - UserID: userId, - }); err != nil { + if err != nil { return err } @@ -248,6 +242,14 @@ func registerUser(ctx context.Context, c *app.RequestContext, openid, nickname, return } + // 初始化用户空间信息 + err = InitUserSpaces(ctx, userId) + + if err != nil { + errorx.AddError(c, err) + return + } + token, _ := jwtx.CreateToken(userId) resp := &auth.LoginResp{ Token: token, @@ -289,3 +291,18 @@ func initMoneyCategoryTx(ctx context.Context, q *repo.Queries, userId int64) err return nil } + +// 初始化用户空间信息 +func InitUserSpaces(ctx context.Context, userID int64) error { + spaces, err := db.Queries.ListUserSpaces(ctx, userID) + if err != nil { + return err + } + + spaceRoles := make(map[int64]int32, len(spaces)) + for _, row := range spaces { + spaceRoles[row.ID] = row.Role + } + + return redisx.SetUserSpaces(ctx, userID, spaceRoles) +} diff --git a/code/allapp/allapp-go/biz/handler/space/space_service.go b/code/allapp/allapp-go/biz/handler/space/space_service.go index c3bc74f3..b56e2178 100644 --- a/code/allapp/allapp-go/biz/handler/space/space_service.go +++ b/code/allapp/allapp-go/biz/handler/space/space_service.go @@ -6,7 +6,10 @@ import ( "allapp/biz/router/middleware" "allapp/db" "allapp/db/repo" + "allapp/utils" "allapp/utils/errorx" + "allapp/utils/idgen" + "allapp/utils/redisx" "allapp/utils/response" "context" @@ -16,47 +19,29 @@ import ( "github.com/cloudwego/hertz/pkg/protocol/consts" ) -// DissolveSpace . -// @router /space/dissolve [POST] -func DissolveSpace(ctx context.Context, c *app.RequestContext) { - var err error - var req space.DissolveSpaceParams - err = c.BindAndValidate(&req) - if err != nil { +// KickOutUser 踢出某人 +// @router /space/kick [POST] +func KickOutUser(ctx context.Context, c *app.RequestContext) { + var req space.KickOutUserParams + if err := c.BindAndValidate(&req); err != nil { c.String(consts.StatusBadRequest, err.Error()) return } userID := middleware.GetUserID(ctx) - spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID) + spaceID := middleware.GetSpaceID(ctx) + hasPermission, err := CheckUserPermission(ctx, userID, spaceID) if err != nil { - if errorx.IsNotFound(err) { - response.Success(c).Send() - return - } else { - errorx.AddError(c, err) - return - } + errorx.AddError(c, err) + return + } + if !hasPermission { + response.Fail(c).Message("无权限操作").Send() + return } - spaceId := spaceByUserId.ID - - err = db.WithTx(ctx, func(q *repo.Queries) error { - err := q.DeleteSpace(ctx, spaceId) - if err != nil { - return err - } - - err = q.DeleteSpaceUserAll(ctx, spaceId) - if err != nil { - return err - } - - return nil - }) - - if err != nil { + if err := LeaveSpace(ctx, req.UserId, spaceID); err != nil { errorx.AddError(c, err) return } @@ -64,20 +49,293 @@ func DissolveSpace(ctx context.Context, c *app.RequestContext) { response.Success(c).Send() } -// EnterSpace . -// @router /space/enter [POST] -func EnterSpace(ctx context.Context, c *app.RequestContext) { +// QuitSpace . +// @router /space/quit [POST] +func QuitSpace(ctx context.Context, c *app.RequestContext) { + var req space.QuitSpaceParams + if err := c.BindAndValidate(&req); err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + userID := middleware.GetUserID(ctx) + spaceID := req.SpaceId + + // 检查权限 + role, exists, err := redisx.GetUserSpaceRole(ctx, userID, spaceID) + + if err != nil { + errorx.AddError(c, err) + return + } + + if !exists { + response.Fail(c).Message("已不在该空间内").Send() + return + } + + err = db.WithTx(ctx, func(q *repo.Queries) error { + if role == 0 { + + } + + return nil + }) + + response.Success(c).Send() +} + +// JoinSpace . +// @router /space/join [POST] +func JoinSpace(ctx context.Context, c *app.RequestContext) { var err error - var req space.EnterSpaceParams + var req space.JoinSpaceParams err = c.BindAndValidate(&req) if err != nil { c.String(consts.StatusBadRequest, err.Error()) return } - resp := new(space.EnterSpaceResult) + resp := new(space.JoinSpaceResult) userID := middleware.GetUserID(ctx) + oldSpaceID := middleware.GetSpaceID(ctx) + inviteCode := req.InviteCode + + spaceByInviteCode, err := db.Queries.FindSpaceByInviteCode(ctx, inviteCode) + if err != nil { + if errorx.IsNotFound(err) { + response.Fail(c).Message("邀请码错误或已过期").Send() + return + } + errorx.AddError(c, err) + return + } + + joinSpaceID := spaceByInviteCode.ID + + // 检查权限 + role, exists, err := redisx.GetUserSpaceRole(ctx, userID, oldSpaceID) + if err != nil { + errorx.AddError(c, err) + return + } + + err = db.WithTx(ctx, func(q *repo.Queries) error { + // 判断权限, 如果角色为 0 则解散 + if exists && role == 0 { + users, err2 := q.ListSpaceUsers(ctx, oldSpaceID) + + if err2 != nil { + return err2 + } + + for _, user := range users { + if err2 := LeaveSpace(ctx, user.UserID, oldSpaceID); err2 != nil { + return err2 + } + } + } else { + // 退出就行 + if err2 := q.DeleteSpaceUser(ctx, repo.DeleteSpaceUserParams{ + SpaceID: oldSpaceID, + UserID: userID, + }); err2 != nil { + return err2 + } + + if err2 := redisx.RemoveUserSpace(ctx, userID, oldSpaceID); err2 != nil { + return err2 + } + + // 再加入 + if err2 := q.InsertSpaceUser(ctx, repo.InsertSpaceUserParams{ + ID: idgen.NextId(), + UserID: userID, + SpaceID: joinSpaceID, + Role: 0, + }); err2 != nil { + return err2 + } + + if err2 := redisx.AddOrUpdateUserSpace(ctx, userID, joinSpaceID, 0); err2 != nil { + return err2 + } + } + return nil + }) c.JSON(consts.StatusOK, resp) } + +// ListSpaceUsers . +// @router /space/users [POST] +func ListSpaceUsers(ctx context.Context, c *app.RequestContext) { + var err error + var req space.ListSpaceUsersParams + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + resp := new(space.ListSpaceUsersResult) + + // 查询 + users, err := db.Queries.ListSpaceUsers(ctx, req.SpaceId) + if err != nil { + errorx.AddError(c, err) + return + } + + spaceUsers := make([]*space.SpaceUser, 0, len(users)) + + for _, user := range users { + spaceUsers = append(spaceUsers, &space.SpaceUser{ + UserId: user.UserID, + UserName: user.UserName, + UserAvatar: user.UserAvatar, + Role: user.Role, + }) + } + + resp.Users = spaceUsers + + response.Success(c).Data(spaceUsers).Send() +} + +// CheckUserPermission 检查是否有权限 +func CheckUserPermission(ctx context.Context, userID int64, spaceID int64) (bool, error) { + inSpace, err := redisx.InSpace(ctx, userID, spaceID) + + if err != nil { + return false, err + } + + if !inSpace { + return false, nil + } + + role, exists, err := redisx.GetUserSpaceRole(ctx, userID, spaceID) + + if err != nil { + return false, err + } + + if !exists { + return false, nil + } + + return role == 0, nil +} + +// LeaveSpace 处理用户离开空间逻辑(包括删除空间用户、清理 Redis、创建新空间) +func LeaveSpace(ctx context.Context, userID, spaceID int64) error { + return db.WithTx(ctx, func(q *repo.Queries) error { + // 1. 删除数据库空间用户 + if err := q.DeleteSpaceUser(ctx, repo.DeleteSpaceUserParams{ + UserID: userID, + SpaceID: spaceID, + }); err != nil { + return err + } + + // 确保该用户加入了缓存 + err := InitUserSpaces(ctx, userID) + + if err != nil { + return err + } + + // 2. 删除 Redis 缓存 + if err := redisx.RemoveUserSpace(ctx, userID, spaceID); err != nil { + return err + } + + // 3. 确保用户至少有一个空间 + if err := EnsureUserHasSpaceWithTx(ctx, q, userID); err != nil { + return err + } + + return nil + }) +} + +// InitUserSpaces 初始化用户空间信息 +func InitUserSpaces(ctx context.Context, userID int64) error { + hasSpace, err := redisx.HasUserSpaces(ctx, userID) + + if err != nil { + return err + } + + if hasSpace { + return nil + } + + spaces, err := db.Queries.ListUserSpaces(ctx, userID) + if err != nil { + return err + } + + spaceRoles := make(map[int64]int32, len(spaces)) + for _, row := range spaces { + spaceRoles[row.ID] = row.Role + } + + return redisx.SetUserSpaces(ctx, userID, spaceRoles) +} + +// EnsureUserHasSpaceWithTx 确保用户至少有一个空间,如果没有则创建新空间 +// 注意:不管理事务,需要在外层传入 q *repo.Queries +func EnsureUserHasSpaceWithTx(ctx context.Context, q *repo.Queries, userID int64) error { + // 1. 查询用户现有空间 + spaces, err := redisx.GetUserSpaces(ctx, userID) + if err != nil { + return err + } + + if len(spaces) > 0 { + // 已经有空间,无需创建 + return nil + } + + // 2. 没有空间则创建 + var inviteCode string + for { + code := utils.GenerateCode(6) + _, err := q.FindSpaceByInviteCode(ctx, code) + if errorx.IsNotFound(err) { + inviteCode = code + break + } else if err != nil { + return err + } + } + + newSpaceID := idgen.NextId() + + // 插入新空间 + if err := q.InsertSpace(ctx, repo.InsertSpaceParams{ + ID: newSpaceID, + InviteCode: inviteCode, + }); err != nil { + return err + } + + // 插入空间用户 + if err := q.InsertSpaceUser(ctx, repo.InsertSpaceUserParams{ + ID: idgen.NextId(), + SpaceID: newSpaceID, + UserID: userID, + }); err != nil { + return err + } + + // 同步到 Redis + if err := redisx.AddOrUpdateUserSpace(ctx, userID, newSpaceID, 0); err != nil { + return err + } + + return nil +} diff --git a/code/allapp/allapp-go/biz/handler/space/space_user_service.go b/code/allapp/allapp-go/biz/handler/space/space_user_service.go deleted file mode 100644 index 0bc1a4e6..00000000 --- a/code/allapp/allapp-go/biz/handler/space/space_user_service.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by hertz generator. - -package space - -import ( - space "allapp/biz/model/space" - "allapp/biz/router/middleware" - "allapp/db" - "allapp/db/repo" - "allapp/utils/errorx" - "allapp/utils/idgen" - "allapp/utils/pgtypex" - "allapp/utils/response" - "context" - - "github.com/cloudwego/hertz/pkg/app" - "github.com/cloudwego/hertz/pkg/protocol/consts" -) - -// ExitSpace . -// @router /space/user/exit [POST] -func ExitSpace(ctx context.Context, c *app.RequestContext) { - var err error - var req space.ExitSpaceParams - err = c.BindAndValidate(&req) - if err != nil { - c.String(consts.StatusBadRequest, err.Error()) - return - } - - userID := middleware.GetUserID(ctx) - - err = db.Queries.DeleteSpaceUser(ctx, userID) - - if err != nil { - errorx.AddError(c, err) - return - } - - response.Success(c).Send() -} - -// ListSpaceUsers . -// @router /space/user/list [POST] -func ListSpaceUsers(ctx context.Context, c *app.RequestContext) { - var err error - var req space.ListSpaceUsersParams - err = c.BindAndValidate(&req) - if err != nil { - c.String(consts.StatusBadRequest, err.Error()) - return - } - - // 先创建空返回对象 - resp := &space.ListSpaceUsersResult{ - Users: []*space.SpaceUser{}, - } - - userID := middleware.GetUserID(ctx) - - // 获取用户所在空间 - spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID) - if err != nil || errorx.IsNotFound(err) { - // 未加入空间或查询出错,直接返回空数组 - response.Success(c).Data(resp).Send() - return - } - - spaceId := spaceByUserId.ID - - // 查询空间内用户 - users, err := db.Queries.ListSpaceUsers(ctx, spaceId) - if err != nil { - // 查询出错,返回空数组 - errorx.AddError(c, err) - return - } - - // 填充用户列表 - for _, u := range users { - resp.Users = append(resp.Users, &space.SpaceUser{ - UserId: u.UserID, - Username: u.Username.String, - SpaceRole: u.Role, - ActiveTime: pgtypex.TimestampToDateTimeString(u.ActiveTime), - }) - } - - response.Success(c).Data(resp).Send() -} - -// RemoveSpaceUser 移除空间用户 -// @router /space/user/remove [POST] -func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) { - var req space.RemoveSpaceUserParams - if err := c.BindAndValidate(&req); err != nil { - c.String(consts.StatusBadRequest, err.Error()) - return - } - - delUserID := req.UserId - currentUserID := middleware.GetUserID(ctx) - - // 不能删除自己 - if currentUserID == delUserID { - response.Fail(c).Message("请退出空间或解散空间").Send() - return - } - - // 获取当前操作者所在空间及角色 - spaceUser, err := db.Queries.GetSpaceUserByUserId(ctx, currentUserID) - if err != nil { - if errorx.IsNotFound(err) { - response.Fail(c).Message("权限不足").Send() - return - } - errorx.AddError(c, err) - return - } - - // 检查权限 - if spaceUser.Role != 0 && spaceUser.Role != 1 { - response.Fail(c).Message("权限不足").Send() - return - } - - // 获取待删除用户的空间信息 - delUserSpace, err := db.Queries.GetSpaceByUserId(ctx, delUserID) - if err != nil { - if errorx.IsNotFound(err) { - response.Fail(c).Message("待删除用户不存在或权限不足").Send() - return - } - errorx.AddError(c, err) - return - } - - // 校验是否在同一个空间 - if spaceUser.SpaceID != delUserSpace.ID { - response.Fail(c).Message("权限不足").Send() - return - } - - // 删除用户 - if err := db.Queries.DeleteSpaceUser(ctx, delUserID); err != nil { - errorx.AddError(c, err) - return - } - - response.Success(c).Message("移除成功").Send() -} - -// JoinSpace . -// @router /space/user/join [POST] -func JoinSpace(ctx context.Context, c *app.RequestContext) { - var err error - var req space.JoinSpaceParams - err = c.BindAndValidate(&req) - if err != nil { - c.String(consts.StatusBadRequest, err.Error()) - return - } - - userID := middleware.GetUserID(ctx) - inviteCode := req.InviteCode - // 检查该用户是否已加入其他空间 - _, err = db.Queries.GetSpaceByUserId(ctx, userID) - if err != nil { - if errorx.IsNotFound(err) { - - } else { - errorx.AddError(c, err) - } - } else { - response.Fail(c).Message("请先退出已加入的空间").Send() - return - } - - // 检查验证码是否有效 - spaceByCode, err := db.Queries.FindSpaceByInviteCode(ctx, inviteCode) - - if err != nil { - if errorx.IsNotFound(err) { - response.Fail(c).Message("邀请码无效").Send() - return - } else { - errorx.AddError(c, err) - return - } - } - - // 加入空间,默认 - params := repo.InsertSpaceUserParams{ - ID: idgen.NextId(), - SpaceID: spaceByCode.ID, - UserID: userID, - Role: 1, - } - - err = db.Queries.InsertSpaceUser(ctx, params) - - if err != nil { - errorx.AddError(c, err) - return - } - - response.Success(c).Message("加入空间成功").Send() -} - -// GetUserSpace . -// @router /space/user/get [GET] -func GetUserSpace(ctx context.Context, c *app.RequestContext) { - var err error - var req space.GetUserSpaceParams - err = c.BindAndValidate(&req) - if err != nil { - c.String(consts.StatusBadRequest, err.Error()) - return - } - - resp := new(space.GetUserSpaceResult) - - userID := middleware.GetUserID(ctx) - - spaceByUserId, err := db.Queries.GetUserSpaceDetail(ctx, userID) - - if err != nil { - if errorx.IsNotFound(err) { - response.Success(c).Data(nil).Send() - return - } else { - errorx.AddError(c, err) - return - } - } - - resp.SpaceId = spaceByUserId.SpaceID - resp.SpaceName = spaceByUserId.SpaceName.String - resp.InviteCode = spaceByUserId.SpaceInviteCode - resp.Role = spaceByUserId.Role - - response.Success(c).Data(resp).Send() -} diff --git a/code/allapp/allapp-go/biz/handler/user/user_service.go b/code/allapp/allapp-go/biz/handler/user/user_service.go new file mode 100644 index 00000000..ba71f701 --- /dev/null +++ b/code/allapp/allapp-go/biz/handler/user/user_service.go @@ -0,0 +1,54 @@ +// Code generated by hertz generator. + +package user + +import ( + "allapp/biz/router/middleware" + "allapp/db" + "allapp/utils/errorx" + "allapp/utils/response" + "context" + + user "allapp/biz/model/user" + + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/protocol/consts" +) + +// ListUserSpaces . +// @router /user/spaces [GET] +func ListUserSpaces(ctx context.Context, c *app.RequestContext) { + var err error + var req user.ListUserSpacesParams + err = c.BindAndValidate(&req) + if err != nil { + c.String(consts.StatusBadRequest, err.Error()) + return + } + + resp := new(user.ListUserSpacesResult) + + userID := middleware.GetUserID(ctx) + + // 查询 + spaces, err := db.Queries.ListUserSpaces(ctx, userID) + if err != nil { + errorx.AddError(c, err) + return + } + + userSpaces := make([]*user.UserSpace, 0, len(spaces)) + + for _, space := range spaces { + userSpaces = append(userSpaces, &user.UserSpace{ + Id: space.ID, + Name: space.Name.String, + InviteCode: space.InviteCode, + Role: space.Role, + }) + } + + resp.Spaces = userSpaces + + response.Success(c).Data(resp).Send() +} diff --git a/code/allapp/allapp-go/biz/model/api/api.pb.go b/code/allapp/allapp-go/biz/model/api/api.pb.go index ff03c0ce..d82e6a07 100644 --- a/code/allapp/allapp-go/biz/model/api/api.pb.go +++ b/code/allapp/allapp-go/biz/model/api/api.pb.go @@ -3,7 +3,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: api.proto package api diff --git a/code/allapp/allapp-go/biz/model/space/space.pb.go b/code/allapp/allapp-go/biz/model/space/space.pb.go index 8c067df8..1005e6c5 100644 --- a/code/allapp/allapp-go/biz/model/space/space.pb.go +++ b/code/allapp/allapp-go/biz/model/space/space.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: space.proto package space @@ -26,91 +26,57 @@ var file_space_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xbe, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x73, 0x6f, - 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x2e, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1a, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, - 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x22, 0x13, 0xd2, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x64, 0x69, 0x73, - 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x17, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x65, - 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x17, 0x2e, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xdc, 0x02, 0x0a, 0x0c, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x52, 0x0a, 0x0b, 0x4b, 0x69, 0x63, + 0x6b, 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x4f, + 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x0f, 0xd2, 0xc1, + 0x18, 0x0b, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x6b, 0x69, 0x63, 0x6b, 0x12, 0x4c, 0x0a, + 0x09, 0x51, 0x75, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x2e, 0x51, 0x75, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x51, 0x75, 0x69, 0x74, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x0f, 0xd2, 0xc1, 0x18, 0x0b, + 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x71, 0x75, 0x69, 0x74, 0x12, 0x4c, 0x0a, 0x09, 0x4a, + 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x0f, 0xd2, 0xc1, 0x18, 0x0b, 0x2f, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x5c, 0x0a, 0x0e, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x10, 0xd2, 0xc1, 0x18, 0x0c, 0x2f, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x2f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x32, 0xdc, 0x03, 0x0a, 0x10, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x0c, - 0x67, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x19, 0x2e, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x22, 0x13, 0xca, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, - 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x45, 0x78, 0x69, 0x74, 0x53, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, 0x69, - 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x69, 0x74, 0x12, 0x60, 0x0a, 0x0e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x65, 0x0a, 0x0f, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, - 0x1c, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c, 0x2e, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x16, 0xd2, 0xc1, 0x18, - 0x12, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, - 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x2f, 0x6a, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, - 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, + 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_space_proto_goTypes = []interface{}{ - (*DissolveSpaceParams)(nil), // 0: space.DissolveSpaceParams - (*EnterSpaceParams)(nil), // 1: space.EnterSpaceParams - (*GetUserSpaceParams)(nil), // 2: space.GetUserSpaceParams - (*ExitSpaceParams)(nil), // 3: space.ExitSpaceParams - (*ListSpaceUsersParams)(nil), // 4: space.ListSpaceUsersParams - (*RemoveSpaceUserParams)(nil), // 5: space.RemoveSpaceUserParams - (*JoinSpaceParams)(nil), // 6: space.JoinSpaceParams - (*DissolveSpaceResult)(nil), // 7: space.DissolveSpaceResult - (*EnterSpaceResult)(nil), // 8: space.EnterSpaceResult - (*GetUserSpaceResult)(nil), // 9: space.GetUserSpaceResult - (*ExitSpaceResult)(nil), // 10: space.ExitSpaceResult - (*ListSpaceUsersResult)(nil), // 11: space.ListSpaceUsersResult - (*RemoveSpaceUserResult)(nil), // 12: space.RemoveSpaceUserResult - (*JoinSpaceResult)(nil), // 13: space.JoinSpaceResult + (*KickOutUserParams)(nil), // 0: space.KickOutUserParams + (*QuitSpaceParams)(nil), // 1: space.QuitSpaceParams + (*JoinSpaceParams)(nil), // 2: space.JoinSpaceParams + (*ListSpaceUsersParams)(nil), // 3: space.ListSpaceUsersParams + (*KickOutUserResult)(nil), // 4: space.KickOutUserResult + (*QuitSpaceResult)(nil), // 5: space.QuitSpaceResult + (*JoinSpaceResult)(nil), // 6: space.JoinSpaceResult + (*ListSpaceUsersResult)(nil), // 7: space.ListSpaceUsersResult } var file_space_proto_depIdxs = []int32{ - 0, // 0: space.SpaceService.DissolveSpace:input_type -> space.DissolveSpaceParams - 1, // 1: space.SpaceService.EnterSpace:input_type -> space.EnterSpaceParams - 2, // 2: space.SpaceUserService.getUserSpace:input_type -> space.GetUserSpaceParams - 3, // 3: space.SpaceUserService.ExitSpace:input_type -> space.ExitSpaceParams - 4, // 4: space.SpaceUserService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams - 5, // 5: space.SpaceUserService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams - 6, // 6: space.SpaceUserService.JoinSpace:input_type -> space.JoinSpaceParams - 7, // 7: space.SpaceService.DissolveSpace:output_type -> space.DissolveSpaceResult - 8, // 8: space.SpaceService.EnterSpace:output_type -> space.EnterSpaceResult - 9, // 9: space.SpaceUserService.getUserSpace:output_type -> space.GetUserSpaceResult - 10, // 10: space.SpaceUserService.ExitSpace:output_type -> space.ExitSpaceResult - 11, // 11: space.SpaceUserService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult - 12, // 12: space.SpaceUserService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult - 13, // 13: space.SpaceUserService.JoinSpace:output_type -> space.JoinSpaceResult - 7, // [7:14] is the sub-list for method output_type - 0, // [0:7] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: space.SpaceService.KickOutUser:input_type -> space.KickOutUserParams + 1, // 1: space.SpaceService.QuitSpace:input_type -> space.QuitSpaceParams + 2, // 2: space.SpaceService.JoinSpace:input_type -> space.JoinSpaceParams + 3, // 3: space.SpaceService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams + 4, // 4: space.SpaceService.KickOutUser:output_type -> space.KickOutUserResult + 5, // 5: space.SpaceService.QuitSpace:output_type -> space.QuitSpaceResult + 6, // 6: space.SpaceService.JoinSpace:output_type -> space.JoinSpaceResult + 7, // 7: space.SpaceService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_space_proto_init() } @@ -119,7 +85,6 @@ func file_space_proto_init() { return } file_space_space_types_proto_init() - file_space_space_user_types_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -128,7 +93,7 @@ func file_space_proto_init() { NumEnums: 0, NumMessages: 0, NumExtensions: 0, - NumServices: 2, + NumServices: 1, }, GoTypes: file_space_proto_goTypes, DependencyIndexes: file_space_proto_depIdxs, diff --git a/code/allapp/allapp-go/biz/model/space/space_types.pb.go b/code/allapp/allapp-go/biz/model/space/space_types.pb.go index 68d4c9ba..339bf673 100644 --- a/code/allapp/allapp-go/biz/model/space/space_types.pb.go +++ b/code/allapp/allapp-go/biz/model/space/space_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: space/space_types.proto package space @@ -21,15 +21,17 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// 创建空间 -type CreateSpaceParams struct { +// --- 空间用户列表 --- +type ListSpaceUsersParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" json:"SpaceId" query:"space_id"` } -func (x *CreateSpaceParams) Reset() { - *x = CreateSpaceParams{} +func (x *ListSpaceUsersParams) Reset() { + *x = ListSpaceUsersParams{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -37,13 +39,13 @@ func (x *CreateSpaceParams) Reset() { } } -func (x *CreateSpaceParams) String() string { +func (x *ListSpaceUsersParams) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateSpaceParams) ProtoMessage() {} +func (*ListSpaceUsersParams) ProtoMessage() {} -func (x *CreateSpaceParams) ProtoReflect() protoreflect.Message { +func (x *ListSpaceUsersParams) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -55,22 +57,31 @@ func (x *CreateSpaceParams) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateSpaceParams.ProtoReflect.Descriptor instead. -func (*CreateSpaceParams) Descriptor() ([]byte, []int) { +// Deprecated: Use ListSpaceUsersParams.ProtoReflect.Descriptor instead. +func (*ListSpaceUsersParams) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{0} } -type CreateSpaceResult struct { +func (x *ListSpaceUsersParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +type SpaceUser struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"` - InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` + UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId" query:"user_id"` + UserName string `protobuf:"bytes,2,opt,name=UserName,proto3" json:"UserName" query:"user_name"` + UserAvatar string `protobuf:"bytes,3,opt,name=UserAvatar,proto3" json:"UserAvatar" query:"user_avatar"` + Role int32 `protobuf:"varint,4,opt,name=Role,proto3" json:"Role" query:"role"` } -func (x *CreateSpaceResult) Reset() { - *x = CreateSpaceResult{} +func (x *SpaceUser) Reset() { + *x = SpaceUser{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -78,13 +89,13 @@ func (x *CreateSpaceResult) Reset() { } } -func (x *CreateSpaceResult) String() string { +func (x *SpaceUser) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateSpaceResult) ProtoMessage() {} +func (*SpaceUser) ProtoMessage() {} -func (x *CreateSpaceResult) ProtoReflect() protoreflect.Message { +func (x *SpaceUser) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -96,34 +107,49 @@ func (x *CreateSpaceResult) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateSpaceResult.ProtoReflect.Descriptor instead. -func (*CreateSpaceResult) Descriptor() ([]byte, []int) { +// Deprecated: Use SpaceUser.ProtoReflect.Descriptor instead. +func (*SpaceUser) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{1} } -func (x *CreateSpaceResult) GetId() int64 { +func (x *SpaceUser) GetUserId() int64 { if x != nil { - return x.Id + return x.UserId } return 0 } -func (x *CreateSpaceResult) GetInviteCode() string { +func (x *SpaceUser) GetUserName() string { if x != nil { - return x.InviteCode + return x.UserName } return "" } -// 解散空间 -type DissolveSpaceParams struct { +func (x *SpaceUser) GetUserAvatar() string { + if x != nil { + return x.UserAvatar + } + return "" +} + +func (x *SpaceUser) GetRole() int32 { + if x != nil { + return x.Role + } + return 0 +} + +type ListSpaceUsersResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Users []*SpaceUser `protobuf:"bytes,1,rep,name=users,proto3" form:"users" json:"users" query:"users"` } -func (x *DissolveSpaceParams) Reset() { - *x = DissolveSpaceParams{} +func (x *ListSpaceUsersResult) Reset() { + *x = ListSpaceUsersResult{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -131,13 +157,13 @@ func (x *DissolveSpaceParams) Reset() { } } -func (x *DissolveSpaceParams) String() string { +func (x *ListSpaceUsersResult) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DissolveSpaceParams) ProtoMessage() {} +func (*ListSpaceUsersResult) ProtoMessage() {} -func (x *DissolveSpaceParams) ProtoReflect() protoreflect.Message { +func (x *ListSpaceUsersResult) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -149,19 +175,30 @@ func (x *DissolveSpaceParams) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DissolveSpaceParams.ProtoReflect.Descriptor instead. -func (*DissolveSpaceParams) Descriptor() ([]byte, []int) { +// Deprecated: Use ListSpaceUsersResult.ProtoReflect.Descriptor instead. +func (*ListSpaceUsersResult) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{2} } -type DissolveSpaceResult struct { +func (x *ListSpaceUsersResult) GetUsers() []*SpaceUser { + if x != nil { + return x.Users + } + return nil +} + +// 踢出用户 +type KickOutUserParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` + UserId int64 `protobuf:"varint,2,opt,name=UserId,proto3" form:"user_id" json:"user_id"` } -func (x *DissolveSpaceResult) Reset() { - *x = DissolveSpaceResult{} +func (x *KickOutUserParams) Reset() { + *x = KickOutUserParams{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -169,13 +206,13 @@ func (x *DissolveSpaceResult) Reset() { } } -func (x *DissolveSpaceResult) String() string { +func (x *KickOutUserParams) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DissolveSpaceResult) ProtoMessage() {} +func (*KickOutUserParams) ProtoMessage() {} -func (x *DissolveSpaceResult) ProtoReflect() protoreflect.Message { +func (x *KickOutUserParams) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -187,21 +224,33 @@ func (x *DissolveSpaceResult) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DissolveSpaceResult.ProtoReflect.Descriptor instead. -func (*DissolveSpaceResult) Descriptor() ([]byte, []int) { +// Deprecated: Use KickOutUserParams.ProtoReflect.Descriptor instead. +func (*KickOutUserParams) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{3} } -type EnterSpaceParams struct { +func (x *KickOutUserParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +func (x *KickOutUserParams) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type KickOutUserResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` } -func (x *EnterSpaceParams) Reset() { - *x = EnterSpaceParams{} +func (x *KickOutUserResult) Reset() { + *x = KickOutUserResult{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -209,13 +258,13 @@ func (x *EnterSpaceParams) Reset() { } } -func (x *EnterSpaceParams) String() string { +func (x *KickOutUserResult) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EnterSpaceParams) ProtoMessage() {} +func (*KickOutUserResult) ProtoMessage() {} -func (x *EnterSpaceParams) ProtoReflect() protoreflect.Message { +func (x *KickOutUserResult) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -227,26 +276,22 @@ func (x *EnterSpaceParams) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EnterSpaceParams.ProtoReflect.Descriptor instead. -func (*EnterSpaceParams) Descriptor() ([]byte, []int) { +// Deprecated: Use KickOutUserResult.ProtoReflect.Descriptor instead. +func (*KickOutUserResult) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{4} } -func (x *EnterSpaceParams) GetSpaceId() int64 { - if x != nil { - return x.SpaceId - } - return 0 -} - -type EnterSpaceResult struct { +// 退出空间 +type QuitSpaceParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` } -func (x *EnterSpaceResult) Reset() { - *x = EnterSpaceResult{} +func (x *QuitSpaceParams) Reset() { + *x = QuitSpaceParams{} if protoimpl.UnsafeEnabled { mi := &file_space_space_types_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -254,13 +299,13 @@ func (x *EnterSpaceResult) Reset() { } } -func (x *EnterSpaceResult) String() string { +func (x *QuitSpaceParams) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EnterSpaceResult) ProtoMessage() {} +func (*QuitSpaceParams) ProtoMessage() {} -func (x *EnterSpaceResult) ProtoReflect() protoreflect.Message { +func (x *QuitSpaceParams) ProtoReflect() protoreflect.Message { mi := &file_space_space_types_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -272,34 +317,187 @@ func (x *EnterSpaceResult) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use EnterSpaceResult.ProtoReflect.Descriptor instead. -func (*EnterSpaceResult) Descriptor() ([]byte, []int) { +// Deprecated: Use QuitSpaceParams.ProtoReflect.Descriptor instead. +func (*QuitSpaceParams) Descriptor() ([]byte, []int) { return file_space_space_types_proto_rawDescGZIP(), []int{5} } +func (x *QuitSpaceParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +type QuitSpaceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QuitSpaceResult) Reset() { + *x = QuitSpaceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuitSpaceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuitSpaceResult) ProtoMessage() {} + +func (x *QuitSpaceResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuitSpaceResult.ProtoReflect.Descriptor instead. +func (*QuitSpaceResult) Descriptor() ([]byte, []int) { + return file_space_space_types_proto_rawDescGZIP(), []int{6} +} + +// 加入空间 +type JoinSpaceParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + InviteCode string `protobuf:"bytes,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` +} + +func (x *JoinSpaceParams) Reset() { + *x = JoinSpaceParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_types_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinSpaceParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSpaceParams) ProtoMessage() {} + +func (x *JoinSpaceParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_types_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSpaceParams.ProtoReflect.Descriptor instead. +func (*JoinSpaceParams) Descriptor() ([]byte, []int) { + return file_space_space_types_proto_rawDescGZIP(), []int{7} +} + +func (x *JoinSpaceParams) GetInviteCode() string { + if x != nil { + return x.InviteCode + } + return "" +} + +type JoinSpaceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *JoinSpaceResult) Reset() { + *x = JoinSpaceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_types_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinSpaceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinSpaceResult) ProtoMessage() {} + +func (x *JoinSpaceResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_types_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinSpaceResult.ProtoReflect.Descriptor instead. +func (*JoinSpaceResult) Descriptor() ([]byte, []int) { + return file_space_space_types_proto_rawDescGZIP(), []int{8} +} + var File_space_space_types_proto protoreflect.FileDescriptor var file_space_space_types_proto_rawDesc = []byte{ 0x0a, 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x22, 0x5c, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, - 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, - 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x15, - 0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, - 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x0a, 0x10, - 0x45, 0x6e, 0x74, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, - 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x45, 0x6e, 0x74, 0x65, - 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x18, 0x5a, 0x16, - 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3e, 0x0a, 0x14, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xb2, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0xaa, 0x01, 0x0a, 0x09, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xb2, 0xbb, 0x18, 0x07, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x29, + 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x0d, 0xb2, 0xbb, 0x18, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x52, + 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xb2, + 0xbb, 0x18, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x52, 0x0a, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x04, 0x52, 0x6f, + 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x08, 0xb2, 0xbb, 0x18, 0x04, 0x72, 0x6f, + 0x6c, 0x65, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x12, 0x26, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x10, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x60, 0x0a, 0x11, 0x4b, 0x69, 0x63, 0x6b, + 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, + 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, + 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, + 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x4b, 0x69, + 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, + 0x39, 0x0a, 0x0f, 0x51, 0x75, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x51, 0x75, + 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x42, 0x0a, + 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, + 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, + 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -314,21 +512,25 @@ func file_space_space_types_proto_rawDescGZIP() []byte { return file_space_space_types_proto_rawDescData } -var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_space_space_types_proto_goTypes = []interface{}{ - (*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams - (*CreateSpaceResult)(nil), // 1: space.CreateSpaceResult - (*DissolveSpaceParams)(nil), // 2: space.DissolveSpaceParams - (*DissolveSpaceResult)(nil), // 3: space.DissolveSpaceResult - (*EnterSpaceParams)(nil), // 4: space.EnterSpaceParams - (*EnterSpaceResult)(nil), // 5: space.EnterSpaceResult + (*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams + (*SpaceUser)(nil), // 1: space.SpaceUser + (*ListSpaceUsersResult)(nil), // 2: space.ListSpaceUsersResult + (*KickOutUserParams)(nil), // 3: space.KickOutUserParams + (*KickOutUserResult)(nil), // 4: space.KickOutUserResult + (*QuitSpaceParams)(nil), // 5: space.QuitSpaceParams + (*QuitSpaceResult)(nil), // 6: space.QuitSpaceResult + (*JoinSpaceParams)(nil), // 7: space.JoinSpaceParams + (*JoinSpaceResult)(nil), // 8: space.JoinSpaceResult } var file_space_space_types_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_space_space_types_proto_init() } @@ -338,7 +540,7 @@ func file_space_space_types_proto_init() { } if !protoimpl.UnsafeEnabled { file_space_space_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateSpaceParams); i { + switch v := v.(*ListSpaceUsersParams); i { case 0: return &v.state case 1: @@ -350,7 +552,7 @@ func file_space_space_types_proto_init() { } } file_space_space_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateSpaceResult); i { + switch v := v.(*SpaceUser); i { case 0: return &v.state case 1: @@ -362,7 +564,7 @@ func file_space_space_types_proto_init() { } } file_space_space_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DissolveSpaceParams); i { + switch v := v.(*ListSpaceUsersResult); i { case 0: return &v.state case 1: @@ -374,7 +576,7 @@ func file_space_space_types_proto_init() { } } file_space_space_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DissolveSpaceResult); i { + switch v := v.(*KickOutUserParams); i { case 0: return &v.state case 1: @@ -386,7 +588,7 @@ func file_space_space_types_proto_init() { } } file_space_space_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnterSpaceParams); i { + switch v := v.(*KickOutUserResult); i { case 0: return &v.state case 1: @@ -398,7 +600,43 @@ func file_space_space_types_proto_init() { } } file_space_space_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnterSpaceResult); i { + switch v := v.(*QuitSpaceParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuitSpaceResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinSpaceParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_space_space_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinSpaceResult); i { case 0: return &v.state case 1: @@ -416,7 +654,7 @@ func file_space_space_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_space_space_types_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/code/allapp/allapp-go/biz/model/space/space_user_types.pb.go b/code/allapp/allapp-go/biz/model/space/space_user_types.pb.go index d355d059..490b9af7 100644 --- a/code/allapp/allapp-go/biz/model/space/space_user_types.pb.go +++ b/code/allapp/allapp-go/biz/model/space/space_user_types.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.0 -// protoc v6.33.1 +// protoc v4.25.3 // source: space/space_user_types.proto package space @@ -21,11 +21,13 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// 获取空间下的成员 +// --- 空间用户列表 --- type ListSpaceUsersParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" json:"SpaceId" query:"space_id"` } func (x *ListSpaceUsersParams) Reset() { @@ -60,15 +62,22 @@ func (*ListSpaceUsersParams) Descriptor() ([]byte, []int) { return file_space_space_user_types_proto_rawDescGZIP(), []int{0} } +func (x *ListSpaceUsersParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + type SpaceUser struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" form:"user_id" json:"user_id"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" form:"username" json:"username"` - SpaceRole int32 `protobuf:"varint,3,opt,name=SpaceRole,proto3" form:"space_role" json:"space_role"` - ActiveTime string `protobuf:"bytes,4,opt,name=ActiveTime,proto3" form:"active_time" json:"active_time"` + UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId" query:"user_id"` + UserName string `protobuf:"bytes,2,opt,name=UserName,proto3" json:"UserName" query:"user_name"` + UserAvatar string `protobuf:"bytes,3,opt,name=UserAvatar,proto3" json:"UserAvatar" query:"user_avatar"` + Role int32 `protobuf:"varint,4,opt,name=Role,proto3" json:"Role" query:"role"` } func (x *SpaceUser) Reset() { @@ -110,27 +119,27 @@ func (x *SpaceUser) GetUserId() int64 { return 0 } -func (x *SpaceUser) GetUsername() string { +func (x *SpaceUser) GetUserName() string { if x != nil { - return x.Username + return x.UserName } return "" } -func (x *SpaceUser) GetSpaceRole() int32 { +func (x *SpaceUser) GetUserAvatar() string { if x != nil { - return x.SpaceRole + return x.UserAvatar + } + return "" +} + +func (x *SpaceUser) GetRole() int32 { + if x != nil { + return x.Role } return 0 } -func (x *SpaceUser) GetActiveTime() string { - if x != nil { - return x.ActiveTime - } - return "" -} - type ListSpaceUsersResult struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -178,19 +187,199 @@ func (x *ListSpaceUsersResult) GetUsers() []*SpaceUser { return nil } +// 踢出用户 +type KickOutUserParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` + UserId int64 `protobuf:"varint,2,opt,name=UserId,proto3" form:"user_id" json:"user_id"` +} + +func (x *KickOutUserParams) Reset() { + *x = KickOutUserParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KickOutUserParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KickOutUserParams) ProtoMessage() {} + +func (x *KickOutUserParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KickOutUserParams.ProtoReflect.Descriptor instead. +func (*KickOutUserParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{3} +} + +func (x *KickOutUserParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +func (x *KickOutUserParams) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type KickOutUserResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *KickOutUserResult) Reset() { + *x = KickOutUserResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KickOutUserResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KickOutUserResult) ProtoMessage() {} + +func (x *KickOutUserResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KickOutUserResult.ProtoReflect.Descriptor instead. +func (*KickOutUserResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{4} +} + +// 退出空间 +type QuitSpaceParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` +} + +func (x *QuitSpaceParams) Reset() { + *x = QuitSpaceParams{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuitSpaceParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuitSpaceParams) ProtoMessage() {} + +func (x *QuitSpaceParams) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuitSpaceParams.ProtoReflect.Descriptor instead. +func (*QuitSpaceParams) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{5} +} + +func (x *QuitSpaceParams) GetSpaceId() int64 { + if x != nil { + return x.SpaceId + } + return 0 +} + +type QuitSpaceResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QuitSpaceResult) Reset() { + *x = QuitSpaceResult{} + if protoimpl.UnsafeEnabled { + mi := &file_space_space_user_types_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuitSpaceResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuitSpaceResult) ProtoMessage() {} + +func (x *QuitSpaceResult) ProtoReflect() protoreflect.Message { + mi := &file_space_space_user_types_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuitSpaceResult.ProtoReflect.Descriptor instead. +func (*QuitSpaceResult) Descriptor() ([]byte, []int) { + return file_space_space_user_types_proto_rawDescGZIP(), []int{6} +} + // 加入空间 type JoinSpaceParams struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - InviteCode string `protobuf:"bytes,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code" vd:"$ != ''"` // 邀请码 + SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` } func (x *JoinSpaceParams) Reset() { *x = JoinSpaceParams{} if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[3] + mi := &file_space_space_user_types_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +392,7 @@ func (x *JoinSpaceParams) String() string { func (*JoinSpaceParams) ProtoMessage() {} func (x *JoinSpaceParams) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[3] + mi := &file_space_space_user_types_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,14 +405,14 @@ func (x *JoinSpaceParams) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinSpaceParams.ProtoReflect.Descriptor instead. func (*JoinSpaceParams) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{3} + return file_space_space_user_types_proto_rawDescGZIP(), []int{7} } -func (x *JoinSpaceParams) GetInviteCode() string { +func (x *JoinSpaceParams) GetSpaceId() int64 { if x != nil { - return x.InviteCode + return x.SpaceId } - return "" + return 0 } type JoinSpaceResult struct { @@ -235,7 +424,7 @@ type JoinSpaceResult struct { func (x *JoinSpaceResult) Reset() { *x = JoinSpaceResult{} if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[4] + mi := &file_space_space_user_types_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -248,7 +437,7 @@ func (x *JoinSpaceResult) String() string { func (*JoinSpaceResult) ProtoMessage() {} func (x *JoinSpaceResult) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[4] + mi := &file_space_space_user_types_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -261,336 +450,54 @@ func (x *JoinSpaceResult) ProtoReflect() protoreflect.Message { // Deprecated: Use JoinSpaceResult.ProtoReflect.Descriptor instead. func (*JoinSpaceResult) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{4} -} - -// 退出空间 -type ExitSpaceParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ExitSpaceParams) Reset() { - *x = ExitSpaceParams{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExitSpaceParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExitSpaceParams) ProtoMessage() {} - -func (x *ExitSpaceParams) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExitSpaceParams.ProtoReflect.Descriptor instead. -func (*ExitSpaceParams) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{5} -} - -type ExitSpaceResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ExitSpaceResult) Reset() { - *x = ExitSpaceResult{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ExitSpaceResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExitSpaceResult) ProtoMessage() {} - -func (x *ExitSpaceResult) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExitSpaceResult.ProtoReflect.Descriptor instead. -func (*ExitSpaceResult) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{6} -} - -// 踢出成员 -type RemoveSpaceUserParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" form:"user_id" json:"user_id" vd:"$ != 0"` -} - -func (x *RemoveSpaceUserParams) Reset() { - *x = RemoveSpaceUserParams{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveSpaceUserParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveSpaceUserParams) ProtoMessage() {} - -func (x *RemoveSpaceUserParams) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveSpaceUserParams.ProtoReflect.Descriptor instead. -func (*RemoveSpaceUserParams) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{7} -} - -func (x *RemoveSpaceUserParams) GetUserId() int64 { - if x != nil { - return x.UserId - } - return 0 -} - -type RemoveSpaceUserResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *RemoveSpaceUserResult) Reset() { - *x = RemoveSpaceUserResult{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveSpaceUserResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveSpaceUserResult) ProtoMessage() {} - -func (x *RemoveSpaceUserResult) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveSpaceUserResult.ProtoReflect.Descriptor instead. -func (*RemoveSpaceUserResult) Descriptor() ([]byte, []int) { return file_space_space_user_types_proto_rawDescGZIP(), []int{8} } -// 获取当前用户的空间信息 -type GetUserSpaceParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetUserSpaceParams) Reset() { - *x = GetUserSpaceParams{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUserSpaceParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserSpaceParams) ProtoMessage() {} - -func (x *GetUserSpaceParams) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserSpaceParams.ProtoReflect.Descriptor instead. -func (*GetUserSpaceParams) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{9} -} - -type GetUserSpaceResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"` - SpaceName string `protobuf:"bytes,2,opt,name=SpaceName,proto3" form:"space_name" json:"space_name"` - InviteCode string `protobuf:"bytes,3,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` - Role int32 `protobuf:"varint,4,opt,name=Role,proto3" form:"role" json:"role"` -} - -func (x *GetUserSpaceResult) Reset() { - *x = GetUserSpaceResult{} - if protoimpl.UnsafeEnabled { - mi := &file_space_space_user_types_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetUserSpaceResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetUserSpaceResult) ProtoMessage() {} - -func (x *GetUserSpaceResult) ProtoReflect() protoreflect.Message { - mi := &file_space_space_user_types_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetUserSpaceResult.ProtoReflect.Descriptor instead. -func (*GetUserSpaceResult) Descriptor() ([]byte, []int) { - return file_space_space_user_types_proto_rawDescGZIP(), []int{10} -} - -func (x *GetUserSpaceResult) GetSpaceId() int64 { - if x != nil { - return x.SpaceId - } - return 0 -} - -func (x *GetUserSpaceResult) GetSpaceName() string { - if x != nil { - return x.SpaceName - } - return "" -} - -func (x *GetUserSpaceResult) GetInviteCode() string { - if x != nil { - return x.InviteCode - } - return "" -} - -func (x *GetUserSpaceResult) GetRole() int32 { - if x != nil { - return x.Role - } - return 0 -} - var File_space_space_user_types_proto protoreflect.FileDescriptor var file_space_space_user_types_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x61, - 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x08, 0x55, - 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xca, - 0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f, - 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, - 0x6f, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x61, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x05, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, - 0x73, 0x65, 0x72, 0x73, 0x22, 0x4d, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xca, 0xbb, 0x18, - 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0xda, 0xbb, 0x18, 0x07, - 0x24, 0x20, 0x21, 0x3d, 0x20, 0x27, 0x27, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, - 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x46, 0x0a, 0x15, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x06, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, - 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, - 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, - 0x65, 0x12, 0x1c, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, - 0x08, 0xca, 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x42, - 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xb2, 0xbb, 0x18, 0x08, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, + 0x22, 0xaa, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, + 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, + 0xb2, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xb2, 0xbb, 0x18, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f, + 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x0f, 0xb2, 0xbb, 0x18, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x76, 0x61, + 0x74, 0x61, 0x72, 0x52, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, + 0x1c, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x08, 0xb2, + 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x3e, 0x0a, + 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, + 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x60, 0x0a, + 0x11, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, + 0x13, 0x0a, 0x11, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x22, 0x39, 0x0a, 0x0f, 0x51, 0x75, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, + 0x11, 0x0a, 0x0f, 0x51, 0x75, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x22, 0x39, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x11, 0x0a, + 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x42, 0x18, 0x5a, 0x16, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -605,19 +512,17 @@ func file_space_space_user_types_proto_rawDescGZIP() []byte { return file_space_space_user_types_proto_rawDescData } -var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_space_space_user_types_proto_goTypes = []interface{}{ - (*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams - (*SpaceUser)(nil), // 1: space.SpaceUser - (*ListSpaceUsersResult)(nil), // 2: space.ListSpaceUsersResult - (*JoinSpaceParams)(nil), // 3: space.JoinSpaceParams - (*JoinSpaceResult)(nil), // 4: space.JoinSpaceResult - (*ExitSpaceParams)(nil), // 5: space.ExitSpaceParams - (*ExitSpaceResult)(nil), // 6: space.ExitSpaceResult - (*RemoveSpaceUserParams)(nil), // 7: space.RemoveSpaceUserParams - (*RemoveSpaceUserResult)(nil), // 8: space.RemoveSpaceUserResult - (*GetUserSpaceParams)(nil), // 9: space.GetUserSpaceParams - (*GetUserSpaceResult)(nil), // 10: space.GetUserSpaceResult + (*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams + (*SpaceUser)(nil), // 1: space.SpaceUser + (*ListSpaceUsersResult)(nil), // 2: space.ListSpaceUsersResult + (*KickOutUserParams)(nil), // 3: space.KickOutUserParams + (*KickOutUserResult)(nil), // 4: space.KickOutUserResult + (*QuitSpaceParams)(nil), // 5: space.QuitSpaceParams + (*QuitSpaceResult)(nil), // 6: space.QuitSpaceResult + (*JoinSpaceParams)(nil), // 7: space.JoinSpaceParams + (*JoinSpaceResult)(nil), // 8: space.JoinSpaceResult } var file_space_space_user_types_proto_depIdxs = []int32{ 1, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser @@ -671,7 +576,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JoinSpaceParams); i { + switch v := v.(*KickOutUserParams); i { case 0: return &v.state case 1: @@ -683,7 +588,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*JoinSpaceResult); i { + switch v := v.(*KickOutUserResult); i { case 0: return &v.state case 1: @@ -695,7 +600,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExitSpaceParams); i { + switch v := v.(*QuitSpaceParams); i { case 0: return &v.state case 1: @@ -707,7 +612,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ExitSpaceResult); i { + switch v := v.(*QuitSpaceResult); i { case 0: return &v.state case 1: @@ -719,7 +624,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveSpaceUserParams); i { + switch v := v.(*JoinSpaceParams); i { case 0: return &v.state case 1: @@ -731,31 +636,7 @@ func file_space_space_user_types_proto_init() { } } file_space_space_user_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveSpaceUserResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_space_space_user_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUserSpaceParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_space_space_user_types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetUserSpaceResult); i { + switch v := v.(*JoinSpaceResult); i { case 0: return &v.state case 1: @@ -773,7 +654,7 @@ func file_space_space_user_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_space_space_user_types_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/code/allapp/allapp-go/biz/model/user/user.pb.go b/code/allapp/allapp-go/biz/model/user/user.pb.go new file mode 100644 index 00000000..ed4ec004 --- /dev/null +++ b/code/allapp/allapp-go/biz/model/user/user.pb.go @@ -0,0 +1,77 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v4.25.3 +// source: user.proto + +package user + +import ( + _ "allapp/biz/model/api" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var File_user_proto protoreflect.FileDescriptor + +var file_user_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73, + 0x65, 0x72, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x75, + 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x69, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x1a, 0x1a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x10, 0xca, + 0xc1, 0x18, 0x0c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x42, + 0x17, 0x5a, 0x15, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_user_proto_goTypes = []interface{}{ + (*ListUserSpacesParams)(nil), // 0: user.ListUserSpacesParams + (*ListUserSpacesResult)(nil), // 1: user.ListUserSpacesResult +} +var file_user_proto_depIdxs = []int32{ + 0, // 0: user.UserService.ListUserSpaces:input_type -> user.ListUserSpacesParams + 1, // 1: user.UserService.ListUserSpaces:output_type -> user.ListUserSpacesResult + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_user_proto_init() } +func file_user_proto_init() { + if File_user_proto != nil { + return + } + file_user_user_types_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_user_proto_goTypes, + DependencyIndexes: file_user_proto_depIdxs, + }.Build() + File_user_proto = out.File + file_user_proto_rawDesc = nil + file_user_proto_goTypes = nil + file_user_proto_depIdxs = nil +} diff --git a/code/allapp/allapp-go/biz/model/user/user_types.pb.go b/code/allapp/allapp-go/biz/model/user/user_types.pb.go new file mode 100644 index 00000000..45d42cba --- /dev/null +++ b/code/allapp/allapp-go/biz/model/user/user_types.pb.go @@ -0,0 +1,295 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v4.25.3 +// source: user/user_types.proto + +package user + +import ( + _ "allapp/biz/model/api" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// --- 用户下的空间列表 --- +type ListUserSpacesParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListUserSpacesParams) Reset() { + *x = ListUserSpacesParams{} + if protoimpl.UnsafeEnabled { + mi := &file_user_user_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserSpacesParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserSpacesParams) ProtoMessage() {} + +func (x *ListUserSpacesParams) ProtoReflect() protoreflect.Message { + mi := &file_user_user_types_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserSpacesParams.ProtoReflect.Descriptor instead. +func (*ListUserSpacesParams) Descriptor() ([]byte, []int) { + return file_user_user_types_proto_rawDescGZIP(), []int{0} +} + +type UserSpace struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" form:"name" json:"name"` + InviteCode string `protobuf:"bytes,3,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` + Role int32 `protobuf:"varint,4,opt,name=Role,proto3" form:"role" json:"role"` +} + +func (x *UserSpace) Reset() { + *x = UserSpace{} + if protoimpl.UnsafeEnabled { + mi := &file_user_user_types_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserSpace) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserSpace) ProtoMessage() {} + +func (x *UserSpace) ProtoReflect() protoreflect.Message { + mi := &file_user_user_types_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserSpace.ProtoReflect.Descriptor instead. +func (*UserSpace) Descriptor() ([]byte, []int) { + return file_user_user_types_proto_rawDescGZIP(), []int{1} +} + +func (x *UserSpace) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UserSpace) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserSpace) GetInviteCode() string { + if x != nil { + return x.InviteCode + } + return "" +} + +func (x *UserSpace) GetRole() int32 { + if x != nil { + return x.Role + } + return 0 +} + +type ListUserSpacesResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Spaces []*UserSpace `protobuf:"bytes,1,rep,name=Spaces,proto3" form:"spaces" json:"spaces"` +} + +func (x *ListUserSpacesResult) Reset() { + *x = ListUserSpacesResult{} + if protoimpl.UnsafeEnabled { + mi := &file_user_user_types_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUserSpacesResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUserSpacesResult) ProtoMessage() {} + +func (x *ListUserSpacesResult) ProtoReflect() protoreflect.Message { + mi := &file_user_user_types_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUserSpacesResult.ProtoReflect.Descriptor instead. +func (*ListUserSpacesResult) Descriptor() ([]byte, []int) { + return file_user_user_types_proto_rawDescGZIP(), []int{2} +} + +func (x *ListUserSpacesResult) GetSpaces() []*UserSpace { + if x != nil { + return x.Spaces + } + return nil +} + +var File_user_user_types_proto protoreflect.FileDescriptor + +var file_user_user_types_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x09, 0x61, + 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x22, 0x90, 0x01, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, + 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, + 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, + 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x52, + 0x6f, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x33, 0x0a, 0x06, 0x53, + 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x75, 0x73, + 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x42, 0x0a, 0xca, 0xbb, + 0x18, 0x06, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x52, 0x06, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, + 0x42, 0x17, 0x5a, 0x15, 0x61, 0x6c, 0x6c, 0x61, 0x70, 0x70, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_user_user_types_proto_rawDescOnce sync.Once + file_user_user_types_proto_rawDescData = file_user_user_types_proto_rawDesc +) + +func file_user_user_types_proto_rawDescGZIP() []byte { + file_user_user_types_proto_rawDescOnce.Do(func() { + file_user_user_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_user_types_proto_rawDescData) + }) + return file_user_user_types_proto_rawDescData +} + +var file_user_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_user_user_types_proto_goTypes = []interface{}{ + (*ListUserSpacesParams)(nil), // 0: user.ListUserSpacesParams + (*UserSpace)(nil), // 1: user.UserSpace + (*ListUserSpacesResult)(nil), // 2: user.ListUserSpacesResult +} +var file_user_user_types_proto_depIdxs = []int32{ + 1, // 0: user.ListUserSpacesResult.Spaces:type_name -> user.UserSpace + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_user_user_types_proto_init() } +func file_user_user_types_proto_init() { + if File_user_user_types_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_user_user_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserSpacesParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_user_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserSpace); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_user_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUserSpacesResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_user_user_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_user_user_types_proto_goTypes, + DependencyIndexes: file_user_user_types_proto_depIdxs, + MessageInfos: file_user_user_types_proto_msgTypes, + }.Build() + File_user_user_types_proto = out.File + file_user_user_types_proto_rawDesc = nil + file_user_user_types_proto_goTypes = nil + file_user_user_types_proto_depIdxs = nil +} diff --git a/code/allapp/allapp-go/biz/router/middleware/auth.go b/code/allapp/allapp-go/biz/router/middleware/auth.go index 1c85b677..b65f5e1a 100644 --- a/code/allapp/allapp-go/biz/router/middleware/auth.go +++ b/code/allapp/allapp-go/biz/router/middleware/auth.go @@ -3,9 +3,11 @@ package middleware import ( "allapp/utils/jwtx" "allapp/utils/pathx" + "allapp/utils/redisx" "allapp/utils/response" "context" "strconv" + "strings" "github.com/cloudwego/hertz/pkg/app" ) @@ -13,13 +15,14 @@ import ( // 私有 key,防止冲突 type ctxKeyUser struct{} -// ContextUser 保存用户信息,包括 UserID 和 SpaceID +// ContextUser 保存用户信息,包括 UserID、DeviceUUID 和当前 SpaceID type ContextUser struct { - UserID int64 - SpaceID int64 + UserID int64 + DeviceUUID string + SpaceID int64 } -// Auth 中间件,直接在中间件里过滤白名单路径 +// Auth 中间件,支持 header 中传 spaceid 并校验权限 func Auth() app.HandlerFunc { whitelistPaths := []string{ "/auth/login", @@ -35,8 +38,8 @@ func Auth() app.HandlerFunc { return } - token := string(c.GetHeader("token")) - spaceId := string(c.GetHeader("x-space-id")) + // 校验 token + token := strings.TrimSpace(string(c.GetHeader("token"))) if token == "" { response.Fail(c).Code(response.HttpCode.Unauthorized).Send() c.Abort() @@ -44,30 +47,39 @@ func Auth() app.HandlerFunc { } verifyToken, flag := jwtx.VerifyToken(token) - - if flag { - user := &ContextUser{ - UserID: verifyToken.UserID, - SpaceID: 0, - } - if spaceId != "" { - i, err := strconv.ParseInt(spaceId, 10, 64) - if err != nil { - response.Fail(c).Message("Invalid x-space-id").Send() - c.Abort() - return - } - - user.SpaceID = i - } - - ctx = setContextUser(ctx, user) - c.Next(ctx) + if !flag { + response.Fail(c).Code(response.HttpCode.RefreshToken).Send() + c.Abort() return } - response.Fail(c).Code(response.HttpCode.RefreshToken).Send() - c.Abort() + userID := verifyToken.UserID + + // 获取 header 中的 spaceid + spaceIDStr := strings.TrimSpace(string(c.GetHeader("spaceid"))) + spaceID, err := strconv.ParseInt(spaceIDStr, 10, 64) + if err != nil || spaceID == 0 { + response.Fail(c).Message("缺少有效 spaceid").Send() + c.Abort() + return + } + + // 判断用户是否在该空间 + inSpace, err := redisx.HasUserSpace(ctx, userID, spaceID) + if err != nil || !inSpace { + response.Fail(c).Message("无权限访问该空间").Send() + c.Abort() + return + } + + // 设置 context + user := &ContextUser{ + UserID: userID, + SpaceID: spaceID, + } + ctx = setContextUser(ctx, user) + + c.Next(ctx) } } @@ -85,10 +97,9 @@ func GetUserID(ctx context.Context) int64 { return GetContextUser(ctx).UserID } -// GetSpaceID 从 context 获取 space_id,并返回是否有效 -func GetSpaceID(ctx context.Context) (int64, bool) { - spaceID := GetContextUser(ctx).SpaceID - return spaceID, spaceID != 0 +// GetSpaceID 从 context 获取当前 spaceid +func GetSpaceID(ctx context.Context) int64 { + return GetContextUser(ctx).SpaceID } // 内部中间件设置 ContextUser diff --git a/code/allapp/allapp-go/biz/router/register.go b/code/allapp/allapp-go/biz/router/register.go index d6ccdb8e..84205a5b 100644 --- a/code/allapp/allapp-go/biz/router/register.go +++ b/code/allapp/allapp-go/biz/router/register.go @@ -6,12 +6,15 @@ import ( auth "allapp/biz/router/auth" money "allapp/biz/router/money" space "allapp/biz/router/space" + user "allapp/biz/router/user" "github.com/cloudwego/hertz/pkg/app/server" ) // GeneratedRegister registers routers generated by IDL. func GeneratedRegister(r *server.Hertz) { //INSERT_POINT: DO NOT DELETE THIS LINE! + user.Register(r) + space.Register(r) auth.Register(r) diff --git a/code/allapp/allapp-go/biz/router/space/middleware.go b/code/allapp/allapp-go/biz/router/space/middleware.go index cffaab6f..948d7afc 100644 --- a/code/allapp/allapp-go/biz/router/space/middleware.go +++ b/code/allapp/allapp-go/biz/router/space/middleware.go @@ -85,3 +85,28 @@ func _enterspaceMw() []app.HandlerFunc { // your code... return nil } + +func _user0Mw() []app.HandlerFunc { + // your code... + return nil +} + +func _listuserspacesMw() []app.HandlerFunc { + // your code... + return nil +} + +func __7bspaceid_7dMw() []app.HandlerFunc { + // your code... + return nil +} + +func _kickoutuserMw() []app.HandlerFunc { + // your code... + return nil +} + +func _quitspaceMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/code/allapp/allapp-go/biz/router/space/space.go b/code/allapp/allapp-go/biz/router/space/space.go index 6fc94d8f..e757c735 100644 --- a/code/allapp/allapp-go/biz/router/space/space.go +++ b/code/allapp/allapp-go/biz/router/space/space.go @@ -19,15 +19,9 @@ func Register(r *server.Hertz) { root := r.Group("/", rootMw()...) { _space := root.Group("/space", _spaceMw()...) - _space.POST("/dissolve", append(_dissolvespaceMw(), space.DissolveSpace)...) - _space.POST("/enter", append(_enterspaceMw(), space.EnterSpace)...) - { - _user := _space.Group("/user", _userMw()...) - _user.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...) - _user.GET("/get", append(_getuserspaceMw(), space.GetUserSpace)...) - _user.POST("/join", append(_joinspaceMw(), space.JoinSpace)...) - _user.POST("/list", append(_listspaceusersMw(), space.ListSpaceUsers)...) - _user.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...) - } + _space.POST("/join", append(_joinspaceMw(), space.JoinSpace)...) + _space.POST("/kick", append(_kickoutuserMw(), space.KickOutUser)...) + _space.POST("/quit", append(_quitspaceMw(), space.QuitSpace)...) + _space.POST("/users", append(_listspaceusersMw(), space.ListSpaceUsers)...) } } diff --git a/code/allapp/allapp-go/biz/router/user/middleware.go b/code/allapp/allapp-go/biz/router/user/middleware.go new file mode 100644 index 00000000..90fee803 --- /dev/null +++ b/code/allapp/allapp-go/biz/router/user/middleware.go @@ -0,0 +1,22 @@ +// Code generated by hertz generator. + +package user + +import ( + "github.com/cloudwego/hertz/pkg/app" +) + +func rootMw() []app.HandlerFunc { + // your code... + return nil +} + +func _userMw() []app.HandlerFunc { + // your code... + return nil +} + +func _listuserspacesMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/code/allapp/allapp-go/biz/router/user/user.go b/code/allapp/allapp-go/biz/router/user/user.go new file mode 100644 index 00000000..242b7578 --- /dev/null +++ b/code/allapp/allapp-go/biz/router/user/user.go @@ -0,0 +1,24 @@ +// Code generated by hertz generator. DO NOT EDIT. + +package user + +import ( + user "allapp/biz/handler/user" + "github.com/cloudwego/hertz/pkg/app/server" +) + +/* + This file will register all the routes of the services in the master idl. + And it will update automatically when you use the "update" command for the idl. + So don't modify the contents of the file, or your code will be deleted when it is updated. +*/ + +// Register register routes based on the IDL 'api.${HTTP Method}' annotation. +func Register(r *server.Hertz) { + + root := r.Group("/", rootMw()...) + { + _user := root.Group("/user", _userMw()...) + _user.GET("/spaces", append(_listuserspacesMw(), user.ListUserSpaces)...) + } +} diff --git a/code/allapp/allapp-go/db/queries/space.sql b/code/allapp/allapp-go/db/queries/space.sql index 8d6ba46c..4ee14f7b 100644 --- a/code/allapp/allapp-go/db/queries/space.sql +++ b/code/allapp/allapp-go/db/queries/space.sql @@ -1,6 +1,8 @@ -- 新增分享空间 -- name: InsertSpace :exec -INSERT INTO space (id,invite_code) VALUES ($1,$2); +INSERT INTO space ( + id,invite_code,create_time,update_time +) VALUES ($1,$2,NOW(),NOW()); -- 删除分享空间 -- name: DeleteSpace :exec @@ -18,6 +20,6 @@ FROM space s ON s.id = m.space_id WHERE m.user_id = $1; +-- 根据邀请码查询空间 -- name: FindSpaceByInviteCode :one SELECT * FROM space WHERE invite_code = $1; - diff --git a/code/allapp/allapp-go/db/queries/space_user.sql b/code/allapp/allapp-go/db/queries/space_user.sql index 20547de4..4e3c9957 100644 --- a/code/allapp/allapp-go/db/queries/space_user.sql +++ b/code/allapp/allapp-go/db/queries/space_user.sql @@ -1,51 +1,51 @@ --- 加入空间 +-- name: ListUserSpaces :many +SELECT s.id, s.name, s.invite_code, su.role +FROM space s + JOIN space_user su ON s.id = su.space_id +WHERE su.user_id = $1; + +-- name: ListSpaceUsers :many +SELECT + u.id AS user_id, + u.username AS user_name, + u.avatar AS user_avatar, + su.role +FROM space_user su + INNER JOIN "user" u ON su.user_id = u.id +WHERE su.space_id = $1 +ORDER BY su.role DESC, u.username ASC; + +-- name: HasUserInSpace :one +SELECT EXISTS ( + SELECT 1 + FROM space_user + WHERE user_id = $1 AND space_id = $2 +); + +-- 获取空间用户 +-- name: GetSpaceUser :one +SELECT * +FROM space_user +WHERE user_id = $1 AND space_id = $2; + +-- 插入空间用户 -- name: InsertSpaceUser :exec -INSERT INTO space_user(id,space_id,user_id,role) -VALUES ($1,$2,$3,$4); +INSERT INTO space_user(id,space_id,user_id,role,join_time) +VALUES ($1,$2,$3,$4,NOW()); --- 删除空间下的单个用户 +-- 修改空间用户 -- name: DeleteSpaceUser :exec -DELETE FROM space_user WHERE user_id = $1; - --- 删除空间下的所有用户 --- name: DeleteSpaceUserAll :exec -DELETE FROM space_user WHERE space_id = $1; +DELETE FROM space_user +WHERE user_id = $1 AND space_id = $2; -- 修改角色 -- name: UpdateSpaceUserRole :exec UPDATE space_user SET role = $1 -WHERE user_id = $2 - AND space_id = $3; - --- 获取空间下的所有用户信息(按 role, active_time, username 排序) --- name: ListSpaceUsers :many -SELECT - u.id AS user_id, - u.username, - u.active_time, - su.role, - su.join_time -FROM space_user su - JOIN space s ON su.space_id = s.id - JOIN user_info u ON su.user_id = u.id -WHERE s.id = $1 -ORDER BY su.role ASC, - u.active_time DESC, - u.username ASC; - --- name: GetSpaceUserByUserId :one -SELECT * FROM space_user WHERE user_id = $1; - --- name: GetUserSpaceDetail :one -SELECT - s.id AS space_id, - s.name AS space_name, - s.invite_code AS space_invite_code, - su.id AS space_user_id, - su.user_id, - su.role -FROM space_user su - JOIN space s ON su.space_id = s.id -WHERE su.user_id = $1; +WHERE user_id = $2 AND space_id = $3; +-- 获取空间下的人数 +-- name: CountUsersInSpace :one +SELECT COUNT(id) +FROM space_user +WHERE space_id = $1; diff --git a/code/allapp/allapp-go/db/repo/models.go b/code/allapp/allapp-go/db/repo/models.go index d2af97eb..785d949e 100644 --- a/code/allapp/allapp-go/db/repo/models.go +++ b/code/allapp/allapp-go/db/repo/models.go @@ -83,7 +83,6 @@ type UserOauth struct { UserID int64 Type int32 Openid string - Unionid pgtype.Text CreateTime pgtype.Timestamptz UpdateTime pgtype.Timestamptz } diff --git a/code/allapp/allapp-go/db/repo/space.sql.go b/code/allapp/allapp-go/db/repo/space.sql.go index 7541576c..cb622e54 100644 --- a/code/allapp/allapp-go/db/repo/space.sql.go +++ b/code/allapp/allapp-go/db/repo/space.sql.go @@ -23,6 +23,7 @@ const findSpaceByInviteCode = `-- name: FindSpaceByInviteCode :one SELECT id, name, invite_code, create_time, update_time FROM space WHERE invite_code = $1 ` +// 根据邀请码查询空间 func (q *Queries) FindSpaceByInviteCode(ctx context.Context, inviteCode string) (Space, error) { row := q.db.QueryRow(ctx, findSpaceByInviteCode, inviteCode) var i Space @@ -77,7 +78,9 @@ func (q *Queries) GetSpaceByUserId(ctx context.Context, userID int64) (Space, er } const insertSpace = `-- name: InsertSpace :exec -INSERT INTO space (id,invite_code) VALUES ($1,$2) +INSERT INTO space ( + id,invite_code,create_time,update_time +) VALUES ($1,$2,NOW(),NOW()) ` type InsertSpaceParams struct { diff --git a/code/allapp/allapp-go/db/repo/space_user.sql.go b/code/allapp/allapp-go/db/repo/space_user.sql.go index e72a846f..2588c62d 100644 --- a/code/allapp/allapp-go/db/repo/space_user.sql.go +++ b/code/allapp/allapp-go/db/repo/space_user.sql.go @@ -11,32 +11,50 @@ import ( "github.com/jackc/pgx/v5/pgtype" ) +const countUsersInSpace = `-- name: CountUsersInSpace :one +SELECT COUNT(id) +FROM space_user +WHERE space_id = $1 +` + +// 获取空间下的人数 +func (q *Queries) CountUsersInSpace(ctx context.Context, spaceID int64) (int64, error) { + row := q.db.QueryRow(ctx, countUsersInSpace, spaceID) + var count int64 + err := row.Scan(&count) + return count, err +} + const deleteSpaceUser = `-- name: DeleteSpaceUser :exec -DELETE FROM space_user WHERE user_id = $1 +DELETE FROM space_user +WHERE user_id = $1 AND space_id = $2 ` -// 删除空间下的单个用户 -func (q *Queries) DeleteSpaceUser(ctx context.Context, userID int64) error { - _, err := q.db.Exec(ctx, deleteSpaceUser, userID) +type DeleteSpaceUserParams struct { + UserID int64 + SpaceID int64 +} + +// 修改空间用户 +func (q *Queries) DeleteSpaceUser(ctx context.Context, arg DeleteSpaceUserParams) error { + _, err := q.db.Exec(ctx, deleteSpaceUser, arg.UserID, arg.SpaceID) return err } -const deleteSpaceUserAll = `-- name: DeleteSpaceUserAll :exec -DELETE FROM space_user WHERE space_id = $1 +const getSpaceUser = `-- name: GetSpaceUser :one +SELECT id, space_id, user_id, role, join_time +FROM space_user +WHERE user_id = $1 AND space_id = $2 ` -// 删除空间下的所有用户 -func (q *Queries) DeleteSpaceUserAll(ctx context.Context, spaceID int64) error { - _, err := q.db.Exec(ctx, deleteSpaceUserAll, spaceID) - return err +type GetSpaceUserParams struct { + UserID int64 + SpaceID int64 } -const getSpaceUserByUserId = `-- name: GetSpaceUserByUserId :one -SELECT id, space_id, user_id, role, join_time FROM space_user WHERE user_id = $1 -` - -func (q *Queries) GetSpaceUserByUserId(ctx context.Context, userID int64) (SpaceUser, error) { - row := q.db.QueryRow(ctx, getSpaceUserByUserId, userID) +// 获取空间用户 +func (q *Queries) GetSpaceUser(ctx context.Context, arg GetSpaceUserParams) (SpaceUser, error) { + row := q.db.QueryRow(ctx, getSpaceUser, arg.UserID, arg.SpaceID) var i SpaceUser err := row.Scan( &i.ID, @@ -48,45 +66,29 @@ func (q *Queries) GetSpaceUserByUserId(ctx context.Context, userID int64) (Space return i, err } -const getUserSpaceDetail = `-- name: GetUserSpaceDetail :one -SELECT - s.id AS space_id, - s.name AS space_name, - s.invite_code AS space_invite_code, - su.id AS space_user_id, - su.user_id, - su.role -FROM space_user su - JOIN space s ON su.space_id = s.id -WHERE su.user_id = $1 +const hasUserInSpace = `-- name: HasUserInSpace :one +SELECT EXISTS ( + SELECT 1 + FROM space_user + WHERE user_id = $1 AND space_id = $2 +) ` -type GetUserSpaceDetailRow struct { - SpaceID int64 - SpaceName pgtype.Text - SpaceInviteCode string - SpaceUserID int64 - UserID int64 - Role int32 +type HasUserInSpaceParams struct { + UserID int64 + SpaceID int64 } -func (q *Queries) GetUserSpaceDetail(ctx context.Context, userID int64) (GetUserSpaceDetailRow, error) { - row := q.db.QueryRow(ctx, getUserSpaceDetail, userID) - var i GetUserSpaceDetailRow - err := row.Scan( - &i.SpaceID, - &i.SpaceName, - &i.SpaceInviteCode, - &i.SpaceUserID, - &i.UserID, - &i.Role, - ) - return i, err +func (q *Queries) HasUserInSpace(ctx context.Context, arg HasUserInSpaceParams) (bool, error) { + row := q.db.QueryRow(ctx, hasUserInSpace, arg.UserID, arg.SpaceID) + var exists bool + err := row.Scan(&exists) + return exists, err } const insertSpaceUser = `-- name: InsertSpaceUser :exec -INSERT INTO space_user(id,space_id,user_id,role) -VALUES ($1,$2,$3,$4) +INSERT INTO space_user(id,space_id,user_id,role,join_time) +VALUES ($1,$2,$3,$4,NOW()) ` type InsertSpaceUserParams struct { @@ -96,7 +98,7 @@ type InsertSpaceUserParams struct { Role int32 } -// 加入空间 +// 插入空间用户 func (q *Queries) InsertSpaceUser(ctx context.Context, arg InsertSpaceUserParams) error { _, err := q.db.Exec(ctx, insertSpaceUser, arg.ID, @@ -109,31 +111,25 @@ func (q *Queries) InsertSpaceUser(ctx context.Context, arg InsertSpaceUserParams const listSpaceUsers = `-- name: ListSpaceUsers :many SELECT - u.id AS user_id, - u.username, - u.active_time, - su.role, - su.join_time + u.id AS user_id, + u.username AS user_name, + u.avatar AS user_avatar, + su.role FROM space_user su - JOIN space s ON su.space_id = s.id - JOIN user_info u ON su.user_id = u.id -WHERE s.id = $1 -ORDER BY su.role ASC, - u.active_time DESC, - u.username ASC + INNER JOIN "user" u ON su.user_id = u.id +WHERE su.space_id = $1 +ORDER BY su.role DESC, u.username ASC ` type ListSpaceUsersRow struct { UserID int64 - Username pgtype.Text - ActiveTime pgtype.Timestamp + UserName string + UserAvatar string Role int32 - JoinTime pgtype.Timestamp } -// 获取空间下的所有用户信息(按 role, active_time, username 排序) -func (q *Queries) ListSpaceUsers(ctx context.Context, id int64) ([]ListSpaceUsersRow, error) { - rows, err := q.db.Query(ctx, listSpaceUsers, id) +func (q *Queries) ListSpaceUsers(ctx context.Context, spaceID int64) ([]ListSpaceUsersRow, error) { + rows, err := q.db.Query(ctx, listSpaceUsers, spaceID) if err != nil { return nil, err } @@ -143,10 +139,48 @@ func (q *Queries) ListSpaceUsers(ctx context.Context, id int64) ([]ListSpaceUser var i ListSpaceUsersRow if err := rows.Scan( &i.UserID, - &i.Username, - &i.ActiveTime, + &i.UserName, + &i.UserAvatar, + &i.Role, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const listUserSpaces = `-- name: ListUserSpaces :many +SELECT s.id, s.name, s.invite_code, su.role +FROM space s + JOIN space_user su ON s.id = su.space_id +WHERE su.user_id = $1 +` + +type ListUserSpacesRow struct { + ID int64 + Name pgtype.Text + InviteCode string + Role int32 +} + +func (q *Queries) ListUserSpaces(ctx context.Context, userID int64) ([]ListUserSpacesRow, error) { + rows, err := q.db.Query(ctx, listUserSpaces, userID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListUserSpacesRow + for rows.Next() { + var i ListUserSpacesRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.InviteCode, &i.Role, - &i.JoinTime, ); err != nil { return nil, err } @@ -161,8 +195,7 @@ func (q *Queries) ListSpaceUsers(ctx context.Context, id int64) ([]ListSpaceUser const updateSpaceUserRole = `-- name: UpdateSpaceUserRole :exec UPDATE space_user SET role = $1 -WHERE user_id = $2 - AND space_id = $3 +WHERE user_id = $2 AND space_id = $3 ` type UpdateSpaceUserRoleParams struct { diff --git a/code/allapp/allapp-go/db/repo/user.sql.go b/code/allapp/allapp-go/db/repo/user.sql.go index cd0d92f1..d65acfee 100644 --- a/code/allapp/allapp-go/db/repo/user.sql.go +++ b/code/allapp/allapp-go/db/repo/user.sql.go @@ -59,9 +59,10 @@ INSERT INTO "user" ( avatar, status, create_time, - update_time + update_time, + last_login_time ) VALUES ( - $1, $2, $3,$4, NOW(), NOW() + $1, $2, $3,$4, NOW(), NOW(),now() ) RETURNING id ` diff --git a/code/allapp/allapp-go/go.mod b/code/allapp/allapp-go/go.mod index c8367155..966c4f6c 100644 --- a/code/allapp/allapp-go/go.mod +++ b/code/allapp/allapp-go/go.mod @@ -8,6 +8,7 @@ require ( github.com/hertz-contrib/requestid v1.1.0 github.com/jackc/pgx/v5 v5.8.0 github.com/pkg/errors v0.9.1 + github.com/redis/go-redis/v9 v9.17.3 github.com/shopspring/decimal v1.4.0 github.com/spf13/viper v1.21.0 go.uber.org/zap v1.27.1 @@ -16,12 +17,6 @@ require ( ) require ( - ariga.io/atlas v0.38.0 // indirect - entgo.io/ent v0.14.5 // indirect - filippo.io/edwards25519 v1.1.0 // indirect - github.com/agext/levenshtein v1.2.3 // indirect - github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/bmatcuk/doublestar v1.3.4 // indirect github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/sonic v1.15.0 // indirect github.com/bytedance/sonic/loader v0.5.0 // indirect @@ -30,53 +25,27 @@ require ( github.com/cloudwego/gopkg v0.1.8 // indirect github.com/cloudwego/netpoll v0.7.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/elastic/pkcs8 v1.0.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect - github.com/go-errors/errors v1.5.1 // indirect - github.com/go-openapi/inflect v0.21.3 // indirect - github.com/go-sql-driver/mysql v1.9.3 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect - github.com/goccy/go-json v0.10.5 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-cmp v0.7.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/hashicorp/hcl/v2 v2.24.0 // indirect - github.com/hertz-contrib/jwt v1.0.4 // indirect - github.com/hertz-contrib/logger/zap v1.1.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect - github.com/jmoiron/sqlx v1.4.0 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect - github.com/lib/pq v1.10.9 // indirect - github.com/mitchellh/go-wordwrap v1.0.1 // indirect - github.com/nyaruka/phonenumbers v1.6.8 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/redis/go-redis/v9 v9.17.3 // indirect github.com/sagikazarmark/locafero v0.12.0 // indirect - github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/syndtr/goleveldb v1.0.0 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.2.0 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/zclconf/go-cty v1.17.0 // indirect - github.com/zclconf/go-cty-yaml v1.1.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.23.0 // indirect - golang.org/x/crypto v0.47.0 // indirect - golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect - golang.org/x/mod v0.32.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.40.0 // indirect golang.org/x/text v0.33.0 // indirect - golang.org/x/tools v0.41.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect - xorm.io/builder v0.3.13 // indirect - xorm.io/xorm v1.3.11 // indirect ) diff --git a/code/allapp/allapp-go/go.sum b/code/allapp/allapp-go/go.sum index b2ad0abb..492c1a7b 100644 --- a/code/allapp/allapp-go/go.sum +++ b/code/allapp/allapp-go/go.sum @@ -1,30 +1,15 @@ -ariga.io/atlas v0.38.0 h1:MwbtwVtDWJFq+ECyeTAz2ArvewDnpeiw/t/sgNdDsdo= -ariga.io/atlas v0.38.0/go.mod h1:D7XMK6ei3GvfDqvzk+2VId78j77LdqHrqPOWamn51/s= -entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4= -entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U= -filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= -filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= -github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= -github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= -github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0= -github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bytedance/go-tagexpr/v2 v2.9.2/go.mod h1:5qsx05dYOiUXOUgnQ7w3Oz8BYs2qtM/bJokdLb79wRM= github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q= github.com/bytedance/gopkg v0.1.1/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE= -github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980= github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE= github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k= -github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o= -github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE= github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -33,13 +18,9 @@ github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/cloudwego/gopkg v0.1.4/go.mod h1:FQuXsRWRsSqJLsMVd5SYzp8/Z1y5gXKnVvRrWUOsCMI= -github.com/cloudwego/gopkg v0.1.7 h1:P9+HwBwKIayJOg0V6hsxS3WVPzlad5BKxmDlZ8c8EkI= -github.com/cloudwego/gopkg v0.1.7/go.mod h1:FQuXsRWRsSqJLsMVd5SYzp8/Z1y5gXKnVvRrWUOsCMI= github.com/cloudwego/gopkg v0.1.8 h1:ma9oACsY3v6xJwQ8NUc/h19GLV2ZCIjx0P6hqaSIlt4= github.com/cloudwego/gopkg v0.1.8/go.mod h1:FQuXsRWRsSqJLsMVd5SYzp8/Z1y5gXKnVvRrWUOsCMI= github.com/cloudwego/hertz v0.4.2/go.mod h1:K1U0RlU07CDeBINfHNbafH/3j9uSgIW8otbjUys3OPY= -github.com/cloudwego/hertz v0.10.3 h1:NFcQAjouVJsod79XPLC/PaFfHgjMTYbiErmW+vGBi8A= -github.com/cloudwego/hertz v0.10.3/go.mod h1:W5dUFXZPZkyfjMMo3EQrMQbofuvTsctM9IxmhbkuT18= github.com/cloudwego/hertz v0.10.4 h1:xJxomApZYR67cROevam6SrtUBDvhcI4ZZhx/WgvpHwU= github.com/cloudwego/hertz v0.10.4/go.mod h1:tZXEi/4o7R0Ho9yw5V2C+k/wVx3S8+wuuiJGDMopnpg= github.com/cloudwego/netpoll v0.3.1/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E= @@ -51,97 +32,47 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/elastic/pkcs8 v1.0.0 h1:HhitlUKxhN288kcNcYkjW6/ouvuwJWd9ioxpjnD9jVA= -github.com/elastic/pkcs8 v1.0.0/go.mod h1:ipsZToJfq1MxclVTwpG7U/bgeDtf+0HkUiOxebk95+0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= -github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-openapi/inflect v0.21.3 h1:TmQvw+9eLrsNp4X0BBQacEZZtAnzk2z1FaLdQQJsDiU= -github.com/go-openapi/inflect v0.21.3/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw= -github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= -github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= -github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= -github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= -github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= -github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE= -github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM= github.com/henrylee2cn/ameda v1.4.8/go.mod h1:liZulR8DgHxdK+MEwvZIylGnmcjzQ6N6f2PlWe7nEO4= github.com/henrylee2cn/ameda v1.4.10/go.mod h1:liZulR8DgHxdK+MEwvZIylGnmcjzQ6N6f2PlWe7nEO4= github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8/go.mod h1:Nhe/DM3671a5udlv2AdV2ni/MZzgfv2qrPL5nIi3EGQ= -github.com/hertz-contrib/jwt v1.0.4 h1:PHddo1FDBpGHXx9nkhSwXamEyPNCkZCtszYXcRCD3q8= -github.com/hertz-contrib/jwt v1.0.4/go.mod h1:YntlFg4tdWw1CM5mELU00HbO8Gsa92xPd7EyrSYxAcg= -github.com/hertz-contrib/logger/zap v1.1.0 h1:4efINiIDJrXEtAFeEdDJvc3Hye0VFxp+0X4BwaZgxNs= -github.com/hertz-contrib/logger/zap v1.1.0/go.mod h1:D/rJJgsYn+SGaHVfVqWS3vHTbbc7ODAlJO+6smWgTeE= github.com/hertz-contrib/requestid v1.1.0 h1:+y1cuNlNX2KUoEC1SnBJ6M55/TlMTx3M9yxkqi0oTkk= github.com/hertz-contrib/requestid v1.1.0/go.mod h1:+l5CbZl//cSUoos421fnDFKQ6YYlVHcYc3Ri7AS8DUA= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk= -github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo= github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= -github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= -github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= -github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= -github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nyaruka/phonenumbers v1.0.55/go.mod h1:sDaTZ/KPX5f8qyV9qN+hIm+4ZBARJrupC6LuhshJq1U= -github.com/nyaruka/phonenumbers v1.6.7 h1:WmebT8TNEzNaui5QlrGqbccRC6dZkEkYc+MGQoILSSo= -github.com/nyaruka/phonenumbers v1.6.7/go.mod h1:7gjs+Lchqm49adhAKB5cdcng5ZXgt6x7Jgvi0ZorUtU= -github.com/nyaruka/phonenumbers v1.6.8 h1:k7HAJ/LeBkXE0vfbajITzTCZD0z0j+epdBNx43yTygk= -github.com/nyaruka/phonenumbers v1.6.8/go.mod h1:IUu45lj2bSeYXQuxDyyuzOrdV10tyRa1YSsfH8EKN5c= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -150,22 +81,16 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4= github.com/redis/go-redis/v9 v9.17.3/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= -github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= -github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= -github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= @@ -188,8 +113,6 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= @@ -203,12 +126,6 @@ github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0= -github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U= -github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= -github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= -github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0= -github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -224,23 +141,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= -golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= -golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 h1:zfMcR1Cs4KNuomFFgGefv5N0czO2XZpUbxGUy8i8ug0= -golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6/go.mod h1:46edojNIoXTNOhySWIWdix628clX9ODXwPsQuG6hsK0= -golang.org/x/exp v0.0.0-20251125195548-87e1e737ad39 h1:DHNhtq3sNNzrvduZZIiFyXWOL9IWaDPHqTnLJp+rCBY= -golang.org/x/exp v0.0.0-20251125195548-87e1e737ad39/go.mod h1:46edojNIoXTNOhySWIWdix628clX9ODXwPsQuG6hsK0= -golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU= -golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk= -golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= -golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= -golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -248,17 +150,13 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= -golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -270,8 +168,6 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -286,42 +182,26 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ= -golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= -golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= -golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo= -xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= -xorm.io/xorm v1.3.11 h1:i4tlVUASogb0ZZFJHA7dZqoRU2pUpUsutnNdaOlFyMI= -xorm.io/xorm v1.3.11/go.mod h1:cs0ePc8O4a0jD78cNvD+0VFwhqotTvLQZv372QsDw7Q= diff --git a/code/allapp/allapp-go/idl/space/space.proto b/code/allapp/allapp-go/idl/space/space.proto index 814ee573..bbc265cb 100644 --- a/code/allapp/allapp-go/idl/space/space.proto +++ b/code/allapp/allapp-go/idl/space/space.proto @@ -7,37 +7,22 @@ option go_package = "space"; import "api.proto"; import "space/space_types.proto"; -import "space/space_user_types.proto"; service SpaceService { - rpc DissolveSpace(DissolveSpaceParams) returns (DissolveSpaceResult){ - option (api.post) = '/space/dissolve'; - }; - // 进入空间 - rpc EnterSpace(EnterSpaceParams) returns (EnterSpaceResult){ - option (api.post) = '/space/enter'; + // 踢出用户 + rpc KickOutUser(KickOutUserParams) returns (KickOutUserResult) { + option (api.post) = "/space/kick"; } -} - -service SpaceUserService{ - // 获取用户空间 - rpc getUserSpace(GetUserSpaceParams) returns (GetUserSpaceResult){ - option (api.get) = '/space/user/get'; - }; - // 退出空间 - rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){ - option (api.post) = '/space/user/exit'; - }; - // 获取空间用户列表 - rpc ListSpaceUsers(ListSpaceUsersParams) returns (ListSpaceUsersResult){ - option (api.post) = '/space/user/list'; - }; - // 踢出某人 - rpc RemoveSpaceUser(RemoveSpaceUserParams) returns (RemoveSpaceUserResult){ - option (api.post) = '/space/user/remove'; - }; - // 加入空间 + // 用户退出当前空间 + rpc QuitSpace(QuitSpaceParams) returns (QuitSpaceResult) { + option (api.post) = "/space/quit"; + } + // 用户加入其他空间 rpc JoinSpace(JoinSpaceParams) returns (JoinSpaceResult) { - option (api.post) = "/space/user/join"; + option (api.post) = "/space/join"; + } + // 获取某个空间下的用户列表 + rpc ListSpaceUsers(ListSpaceUsersParams) returns (ListSpaceUsersResult) { + option (api.post) = "/space/users"; }; -} \ No newline at end of file +} diff --git a/code/allapp/allapp-go/idl/space/space_types.proto b/code/allapp/allapp-go/idl/space/space_types.proto index dff57608..7528d916 100644 --- a/code/allapp/allapp-go/idl/space/space_types.proto +++ b/code/allapp/allapp-go/idl/space/space_types.proto @@ -6,27 +6,39 @@ option go_package = "space"; import "api.proto"; -// 创建空间 -message CreateSpaceParams { - +// --- 空间用户列表 --- +message ListSpaceUsersParams { + int64 SpaceId = 1 [(api.query) = "space_id"]; } -message CreateSpaceResult { - int64 Id = 1 [(api.body)="id"]; - string InviteCode = 2 [(api.body)="invite_code"]; +message SpaceUser { + int64 UserId = 1 [(api.query) = "user_id"]; + string UserName = 2 [(api.query) = "user_name"]; + string UserAvatar= 3 [(api.query) = "user_avatar"]; + int32 Role = 4 [(api.query) = "role"]; } -// 解散空间 -message DissolveSpaceParams { - +message ListSpaceUsersResult { + repeated SpaceUser users = 1; } -message DissolveSpaceResult { +// 踢出用户 +message KickOutUserParams { + int64 SpaceId = 1 [(api.body) = "space_id"]; + int64 UserId = 2 [(api.body) = "user_id"]; +} +message KickOutUserResult {} +// 退出空间 +message QuitSpaceParams { + int64 SpaceId = 1 [(api.body) = "space_id"]; +} +message QuitSpaceResult {} + +// 加入空间 +message JoinSpaceParams { + string InviteCode = 1 [(api.body) = "invite_code"]; } -message EnterSpaceParams { - int64 SpaceId = 1 [(api.body)="space_id"]; -} -message EnterSpaceResult { -} \ No newline at end of file +message JoinSpaceResult {} + diff --git a/code/allapp/allapp-go/idl/space/space_user_types.proto b/code/allapp/allapp-go/idl/space/space_user_types.proto deleted file mode 100644 index 79cb3596..00000000 --- a/code/allapp/allapp-go/idl/space/space_user_types.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto3"; - -package space; - -option go_package = "space"; - -import "api.proto"; -// 获取空间下的成员 -message ListSpaceUsersParams { -} - -message SpaceUser { - int64 UserId = 1 [(api.body)="user_id"]; - string Username = 2 [(api.body)="username"]; - int32 SpaceRole = 3 [(api.body)="space_role"]; - string ActiveTime = 4 [(api.body)="active_time"]; -} - -message ListSpaceUsersResult { - repeated SpaceUser users = 1; -} - -// 加入空间 -message JoinSpaceParams { - string InviteCode = 1 [(api.body)="invite_code",(api.vd)="$ != ''"]; // 邀请码 -} - -message JoinSpaceResult { - -} - -// 退出空间 -message ExitSpaceParams { - -} - -message ExitSpaceResult { - -} - -// 踢出成员 -message RemoveSpaceUserParams { - int64 UserId = 1 [(api.body) = "user_id",(api.vd)="$ != 0"]; -} - -message RemoveSpaceUserResult { - -} - -// 获取当前用户的空间信息 -message GetUserSpaceParams{ - -} -message GetUserSpaceResult{ - int64 SpaceId = 1[(api.body)="space_id"]; - string SpaceName = 2[(api.body)="space_name"]; - string InviteCode = 3[(api.body)="invite_code"]; - int32 Role = 4[(api.body)="role"]; -} diff --git a/code/allapp/allapp-go/idl/user/user.proto b/code/allapp/allapp-go/idl/user/user.proto new file mode 100644 index 00000000..c5ea84e9 --- /dev/null +++ b/code/allapp/allapp-go/idl/user/user.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package user; + +option go_package = "user"; + +import "api.proto"; + +import "user/user_types.proto"; + +service UserService { + // 获取当前用户所属的所有空间 + rpc ListUserSpaces(ListUserSpacesParams) returns (ListUserSpacesResult) { + option (api.get) = "/user/spaces"; + }; +} diff --git a/code/allapp/allapp-go/idl/user/user_types.proto b/code/allapp/allapp-go/idl/user/user_types.proto new file mode 100644 index 00000000..6e4e76bc --- /dev/null +++ b/code/allapp/allapp-go/idl/user/user_types.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package user; + +option go_package = "user"; + +import "api.proto"; + +// --- 用户下的空间列表 --- +message ListUserSpacesParams {} + +message UserSpace { + int64 Id = 1 [(api.body)="id"]; + string Name = 2 [(api.body)="name"]; + string InviteCode = 3 [(api.body)="invite_code"]; + int32 Role = 4 [(api.body)="role"]; +} + +message ListUserSpacesResult { + repeated UserSpace Spaces = 1 [(api.body)="spaces"]; +} \ No newline at end of file diff --git a/code/allapp/allapp-go/utils/redisx/helper.go b/code/allapp/allapp-go/utils/redisx/helper.go index 91a031ca..4f4c84ca 100644 --- a/code/allapp/allapp-go/utils/redisx/helper.go +++ b/code/allapp/allapp-go/utils/redisx/helper.go @@ -2,26 +2,139 @@ package redisx import ( "context" + "errors" + "fmt" + "strconv" "time" + + "github.com/redis/go-redis/v9" ) -// Set 设置 key -func Set(ctx context.Context, key string, value any, ttl time.Duration) error { - return Client().Set(ctx, key, value, ttl).Err() +// ---------------- 基础方法 ---------------- + +// Set 设置任意 key +func Set(key string, value interface{}, expire time.Duration) error { + return Client().Set(context.Background(), key, value, expire).Err() } -// Get 获取 string -func Get(ctx context.Context, key string) (string, error) { - return Client().Get(ctx, key).Result() +// Get 获取任意 key 的值,返回 string +func Get(key string) (string, error) { + val, err := Client().Get(context.Background(), key).Result() + if errors.Is(err, redis.Nil) { + return "", nil + } + return val, err } -// Del 删除 -func Del(ctx context.Context, keys ...string) error { - return Client().Del(ctx, keys...).Err() +// Delete 删除任意 key +func Delete(key string) error { + return Client().Del(context.Background(), key).Err() } -// Exists 是否存在 -func Exists(ctx context.Context, key string) (bool, error) { - n, err := Client().Exists(ctx, key).Result() - return n > 0, err +// Exists 判断 key 是否存在 +func Exists(key string) (bool, error) { + cnt, err := Client().Exists(context.Background(), key).Result() + if err != nil { + return false, err + } + return cnt > 0, nil +} + +// SetUserSpaces 初始化用户空间列表(spaceID -> role) +func SetUserSpaces(ctx context.Context, userID int64, spaces map[int64]int32) error { + key := fmt.Sprintf("user:%d:spaces", userID) + + pipe := Client().TxPipeline() + + // 1. 先清空旧数据 + pipe.Del(ctx, key) + + // 2. 再写入新数据(如果有) + if len(spaces) > 0 { + data := make(map[string]interface{}, len(spaces)) + for spaceID, role := range spaces { + data[strconv.FormatInt(spaceID, 10)] = role + } + pipe.HSet(ctx, key, data) + } + + // 3. 执行 + _, err := pipe.Exec(ctx) + return err +} + +// AddOrUpdateUserSpace 添加或更新单个空间的角色(增量更新) +func AddOrUpdateUserSpace(ctx context.Context, userID, spaceID int64, role int32) error { + key := fmt.Sprintf("user:%d:spaces", userID) + return Client().HSet(ctx, key, strconv.FormatInt(spaceID, 10), role).Err() +} + +// GetUserSpaces 获取用户所有空间列表和角色 +func GetUserSpaces(ctx context.Context, userID int64) (map[int64]int, error) { + key := fmt.Sprintf("user:%d:spaces", userID) + result, err := Client().HGetAll(ctx, key).Result() + if err != nil { + return nil, err + } + + spaces := make(map[int64]int, len(result)) + for k, v := range result { + spaceID, err1 := strconv.ParseInt(k, 10, 64) + role, err2 := strconv.Atoi(v) + if err1 != nil || err2 != nil { + continue + } + spaces[spaceID] = role + } + + return spaces, nil +} + +// GetUserSpaceRole 获取用户在指定空间的角色 +func GetUserSpaceRole(ctx context.Context, userID int64, spaceID int64) (role int, exists bool, err error) { + key := fmt.Sprintf("user:%d:spaces", userID) + val, err := Client().HGet(ctx, key, strconv.FormatInt(spaceID, 10)).Result() + if err != nil { + if errors.Is(err, redis.Nil) { + return 0, false, nil // 用户不在空间 + } + return 0, false, err + } + + role, err = strconv.Atoi(val) + if err != nil { + return 0, false, err + } + + return role, true, nil +} + +// RemoveUserSpace 从用户缓存中删除一个空间(用户退出或被踢) +func RemoveUserSpace(ctx context.Context, userID int64, spaceID int64) error { + key := fmt.Sprintf("user:%d:spaces", userID) + return Client().HDel(ctx, key, strconv.FormatInt(spaceID, 10)).Err() +} + +// ClearUserSpaces 删除用户的所有空间列表 +func ClearUserSpaces(ctx context.Context, userID int64) error { + key := fmt.Sprintf("user:%d:spaces", userID) + return Client().Del(ctx, key).Err() +} + +func InSpace(ctx context.Context, userID, spaceID int64) (bool, error) { + key := fmt.Sprintf("user:%d:spaces", userID) + return Client().HExists(ctx, key, strconv.FormatInt(spaceID, 10)).Result() +} + +// HasUserSpaces 判断用户是否在 Redis 中有空间缓存 +func HasUserSpaces(ctx context.Context, userID int64) (bool, error) { + key := fmt.Sprintf("user:%d:spaces", userID) + + // HLen 返回 hash 的字段数量 + cnt, err := Client().HLen(ctx, key).Result() + if err != nil { + return false, err + } + + return cnt > 0, nil } diff --git a/code/allapp/allapp-rn/src/request/index.ts b/code/allapp/allapp-rn/src/request/index.ts index 9c71bff7..e1c32c43 100644 --- a/code/allapp/allapp-rn/src/request/index.ts +++ b/code/allapp/allapp-rn/src/request/index.ts @@ -30,8 +30,8 @@ function isWhiteListed(url: string) { } const alovaInstance = createAlova({ - baseURL: 'http://192.168.5.6:8086/app', - // baseURL: 'http://192.168.1.137:8086/app', + // baseURL: 'http://192.168.5.6:8086/app', + baseURL: 'http://192.168.1.137:8086/app', requestAdapter: axiosRequestAdapter(), timeout: 5000, cacheFor: null, diff --git a/code/allapp/allapp-rn/src/types/space/space.ts b/code/allapp/allapp-rn/src/types/space/space.ts index ab5c0d7a..564340df 100644 --- a/code/allapp/allapp-rn/src/types/space/space.ts +++ b/code/allapp/allapp-rn/src/types/space/space.ts @@ -1,17 +1,24 @@ -// 创建空间 -export interface CreateSpaceParams { - -} - -export interface CreateSpaceResult { - id: number +// 加入空间 +export interface JoinSpaceParams { invite_code: string } -// 解散空间 -export interface DissolveSpaceParams { +export interface JoinSpaceResult { } -export interface DissolveSpaceResult { +// 踢出用户 +export interface KickOutUserParams { + space_id: number + user_id: number } + +export interface KickOutUserResult {} + +// 退出空间 +export interface QuitSpaceParams { + space_id: number +} + +export interface QuitSpaceResult {} + diff --git a/code/base-project/go.mod b/code/base-project/go.mod deleted file mode 100644 index 68dec248..00000000 --- a/code/base-project/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module allapp-go - -go 1.25.3 - -require ( - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/redis/go-redis/v9 v9.17.3 // indirect -) diff --git a/code/base-project/go.sum b/code/base-project/go.sum deleted file mode 100644 index cfd379aa..00000000 --- a/code/base-project/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4= -github.com/redis/go-redis/v9 v9.17.3/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=