bindbox-game/internal/api/admin/guild_member_delete.go
邹方成 6ee627139c
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat: 新增支付测试小程序与微信支付集成
feat(pay): 添加支付API基础结构
feat(miniapp): 创建支付测试小程序页面与配置
feat(wechatpay): 配置微信支付参数与证书
fix(guild): 修复成员列表查询条件
docs: 更新代码规范文档与需求文档
style: 统一前后端枚举显示与注释格式
refactor(admin): 重构用户奖励发放接口参数处理
test(title): 添加称号效果参数验证测试
2025-11-17 00:42:08 +08:00

39 lines
1.2 KiB
Go

package admin
import (
"net/http"
"strconv"
"bindbox-game/internal/code"
"bindbox-game/internal/pkg/core"
)
type deleteGuildMemberResponse struct {
Message string `json:"message"`
}
func (h *handler) DeleteGuildMember() core.HandlerFunc {
return func(ctx core.Context) {
res := new(deleteGuildMemberResponse)
if ctx.SessionUserInfo().IsSuper != 1 {
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.DeleteGuildError, "禁止操作"))
return
}
guildID, err := strconv.ParseInt(ctx.Param("guild_id"), 10, 64)
if err != nil {
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.ParamBindError, "未传递工会ID"))
return
}
userID, err := strconv.ParseInt(ctx.Param("user_id"), 10, 64)
if err != nil {
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.ParamBindError, "未传递用户ID"))
return
}
if err := h.guild.KickMember(ctx.RequestContext(), guildID, userID); err != nil {
ctx.AbortWithError(core.Error(http.StatusBadRequest, code.DeleteGuildError, err.Error()))
return
}
res.Message = "操作成功"
ctx.Payload(res)
}
}