Files
servicebase/pkg/req/app_user_clan.go
2025-11-18 17:48:20 +08:00

116 lines
2.5 KiB
Go

package req
import (
"errors"
)
type AppClanCreate struct {
Nickname string `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`
Sign string `gorm:"column:sign;type:varchar(255);not null;comment:签名" json:"sign"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`
}
func (req *AppClanCreate) Check() (err error) {
if len(req.Nickname) == 0 {
err = errors.New("名称不能为空")
return
}
return nil
}
type AppClanUpdate struct {
IDBody
Nickname string `gorm:"column:nickname;type:varchar(64);not null;comment:昵称" json:"nickname"`
Sign string `gorm:"column:sign;type:varchar(255);not null;comment:签名" json:"sign"`
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"`
}
func (req *AppClanUpdate) Check() (err error) {
if len(req.Nickname) == 0 {
err = errors.New("名称不能为空")
return
}
return nil
}
type AppClanMemberApplyList struct {
Page
ClanIDBody
Direct string `json:"direct"` // send 发出的申请 receive 收到的申请
}
func (req *AppClanMemberApplyList) Check() (err error) {
req.Page.check()
// if err = req.ClanIDBody.Check(); err != nil {
// return
// }
return nil
}
type AppClanMemberInvite struct {
ClanID string `json:"clan_id"`
UserID string `json:"user_id"`
Message string `json:"message"`
}
func (req *AppClanMemberInvite) Check() (err error) {
if len(req.ClanID) == 0 {
err = errors.New("家不能为空")
return
}
if len(req.UserID) == 0 {
err = errors.New("用户ID不能为空")
return
}
return nil
}
type AppClanMemberInviteAccept struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberInviteAccept) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberInviteRefuse struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberInviteRefuse) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberApply struct {
ClanID string `json:"clan_id"`
Message string `json:"message"`
}
func (req *AppClanMemberApply) Check() (err error) {
if len(req.ClanID) == 0 {
err = errors.New("家不能为空")
return
}
return nil
}
type AppClanMemberApplyAccept struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberApplyAccept) Check() (err error) {
return req.IDBody.Check()
}
type AppClanMemberApplyRefuse struct {
IDBody
Message string `json:"message"`
}
func (req *AppClanMemberApplyRefuse) Check() (err error) {
return req.IDBody.Check()
}