first commit
This commit is contained in:
45
gateway/api/v1/internal/handler/group/change_owner.go
Normal file
45
gateway/api/v1/internal/handler/group/change_owner.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// ChangeOwnerHandler
|
||||
// @Summary 转让群
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.ChangeOwnerReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.ChangeOwnerResp}
|
||||
// @Router /group/app/change-owner [post]
|
||||
func ChangeOwnerHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.ChangeOwnerReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.ChangeOwner(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
35
gateway/api/v1/internal/handler/group/create_group.go
Normal file
35
gateway/api/v1/internal/handler/group/create_group.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
)
|
||||
|
||||
// CreateGroupHandler
|
||||
// @Summary 创建群
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.CreateGroupReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.CreateGroupResp}
|
||||
// @Router /group/app/create-group [post]
|
||||
func CreateGroupHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.CreateGroupReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.CreateGroup(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/get_group_info.go
Normal file
45
gateway/api/v1/internal/handler/group/get_group_info.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GetGroupInfoHandler
|
||||
// @Summary 查询群信息
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetGroupInfoReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetGroupInfoResp}
|
||||
// @Router /group/app/group-info [post]
|
||||
func GetGroupInfoHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetGroupInfoReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetPriGroupInfo(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
29
gateway/api/v1/internal/handler/group/get_group_list.go
Normal file
29
gateway/api/v1/internal/handler/group/get_group_list.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
)
|
||||
|
||||
// GetGroupListHandler
|
||||
// @Summary 查询群列表
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetGroupListReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetGroupListResp}
|
||||
// @Router /app/group-list [post]
|
||||
func GetGroupListHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetGroupListReq{}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetGroupList(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GetGroupMemberInfoHandler
|
||||
// @Summary 查询群成员信息
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群成员信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetGroupMemberInfoReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetGroupMemberInfoResp}
|
||||
// @Router /group/app/group-member-info [post]
|
||||
func GetGroupMemberInfoHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetGroupMemberInfoReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetGroupMemberInfo(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GetGroupMemberListHandler
|
||||
// @Summary 查询群成员列表
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群成员信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetGroupMemberListReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetGroupMemberListResp}
|
||||
// @Router /group/app/group-member-list [post]
|
||||
func GetGroupMemberListHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetGroupMemberListReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetGroupMemberList(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/get_mute_list.go
Normal file
45
gateway/api/v1/internal/handler/group/get_mute_list.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GetMuteListHandler
|
||||
// @Summary 查询群内被禁言成员名单
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 禁言
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetMuteListReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetMuteListResp}
|
||||
// @Router /app/mute-list [post]
|
||||
func GetMuteListHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetMuteListReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetMuteList(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/get_pub_group_info.go
Normal file
45
gateway/api/v1/internal/handler/group/get_pub_group_info.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GetGroupPubInfoHandler
|
||||
// @Summary 查询群公开信息
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GetGroupPubInfoReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GetGroupPubInfoResp}
|
||||
// @Router /group/app/group-pub-info [post]
|
||||
func GetGroupPubInfoHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GetGroupPubInfoReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GetPubGroupInfo(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/group_disband.go
Normal file
45
gateway/api/v1/internal/handler/group/group_disband.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GroupDisbandHandler
|
||||
// @Summary 解散群
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GroupDisbandReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GroupDisbandResp}
|
||||
// @Router /group/app/group-disband [post]
|
||||
func GroupDisbandHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GroupDisbandReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GroupDisband(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/group_exit.go
Normal file
45
gateway/api/v1/internal/handler/group/group_exit.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GroupExitHandler
|
||||
// @Summary 退群
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GroupExitReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GroupExitResp}
|
||||
// @Router /group/app/group-exit [post]
|
||||
func GroupExitHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GroupExitReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GroupExit(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/group_remove.go
Normal file
45
gateway/api/v1/internal/handler/group/group_remove.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// GroupRemoveHandler
|
||||
// @Summary 踢人
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.GroupRemoveReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.GroupRemoveResp}
|
||||
// @Router /group/app/group-remove [post]
|
||||
func GroupRemoveHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.GroupRemoveReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.GroupRemove(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// InviteGroupMembersHandler
|
||||
// @Summary 邀请新群员
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.InviteGroupMembersReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.InviteGroupMembersResp}
|
||||
// @Router /group/app/invite-group-members [post]
|
||||
func InviteGroupMembersHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.InviteGroupMembersReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.InviteGroupMembers(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/join_group.go
Normal file
45
gateway/api/v1/internal/handler/group/join_group.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// JoinGroupHandler
|
||||
// @Summary 直接进群
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群动作
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.JoinGroupReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.JoinGroupResp}
|
||||
// @Router /group/app/join-group [post]
|
||||
func JoinGroupHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.JoinGroupReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.JoinGroup(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/set_admin.go
Normal file
45
gateway/api/v1/internal/handler/group/set_admin.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// SetAdminHandler
|
||||
// @Summary 设置管理员
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群成员信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.SetAdminReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.SetAdminResp}
|
||||
// @Router /group/app/member/type [post]
|
||||
func SetAdminHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.SetAdminReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.SetAdmin(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/update_group_avatar.go
Normal file
45
gateway/api/v1/internal/handler/group/update_group_avatar.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupAvatarHandler
|
||||
// @Summary 更新群头像
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupAvatarReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupAvatarResp}
|
||||
// @Router /group/app/avatar [post]
|
||||
func UpdateGroupAvatarHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupAvatarReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupAvatar(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupFriendTypeHandler
|
||||
// @Summary 更新群内加好友设置
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupFriendTypeReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupFriendTypeResp}
|
||||
// @Router /group/app/friendType [post]
|
||||
func UpdateGroupFriendTypeHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupFriendTypeReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupFriendType(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupJoinTypeHandler
|
||||
// @Summary 更新群内加好友设置
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupJoinTypeReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupJoinTypeResp}
|
||||
// @Router /group/app/joinType [post]
|
||||
func UpdateGroupJoinTypeHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupJoinTypeReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupJoinType(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupMemberMuteTimeHandler
|
||||
// @Summary 更新群成员禁言时间
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 禁言
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupMemberMuteTimeReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupMemberMuteTimeResp}
|
||||
// @Router /group/app/member/muteTime [post]
|
||||
func UpdateGroupMemberMuteTimeHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupMemberMuteTimeReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupMemberMuteTime(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupMemberNameHandler
|
||||
// @Summary 更新群成员昵称
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群成员信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupMemberNameReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupMemberNameResp}
|
||||
// @Router /group/app/member/name [post]
|
||||
func UpdateGroupMemberNameHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupMemberNameReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupMemberName(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupMuteTypeHandler
|
||||
// @Summary 更新群内加好友设置
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupMuteTypeReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupMuteTypeResp}
|
||||
// @Router /group/app/muteType [post]
|
||||
func UpdateGroupMuteTypeHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupMuteTypeReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupMuteType(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
45
gateway/api/v1/internal/handler/group/update_group_name.go
Normal file
45
gateway/api/v1/internal/handler/group/update_group_name.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
logic "gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/logic/group"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/svc"
|
||||
"gitlab.33.cn/chat/dtalk/gateway/api/v1/internal/types"
|
||||
"gitlab.33.cn/chat/dtalk/pkg/api"
|
||||
xerror "gitlab.33.cn/chat/dtalk/pkg/error"
|
||||
"gitlab.33.cn/utils/go-kit/convert"
|
||||
)
|
||||
|
||||
// UpdateGroupNameHandler
|
||||
// @Summary 更新群名称
|
||||
// @Author chy@33.cn
|
||||
// @Tags group 群信息
|
||||
// @Param FZM-SIGNATURE header string true "MOCK"
|
||||
// @Param data body types.UpdateGroupNameReq false "body"
|
||||
// @Success 200 {object} types.GeneralResp{data=types.UpdateGroupNameResp}
|
||||
// @Router /group/app/name [post]
|
||||
func UpdateGroupNameHandler(ctx *svc.ServiceContext) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
req := &types.UpdateGroupNameReq{}
|
||||
err := c.ShouldBind(req)
|
||||
if err != nil {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError).SetExtMessage(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
if req.Id == 0 && req.IdStr == "" {
|
||||
c.Set(api.ReqError, xerror.NewError(xerror.ParamsError))
|
||||
return
|
||||
}
|
||||
|
||||
if req.IdStr != "" {
|
||||
req.Id = convert.ToInt64(req.IdStr)
|
||||
}
|
||||
|
||||
l := logic.NewGroupLogic(c, ctx)
|
||||
res, err := l.UpdateGroupName(req)
|
||||
|
||||
c.Set(api.ReqResult, res)
|
||||
c.Set(api.ReqError, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user