46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
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)
|
|
}
|
|
}
|