37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package req
|
||
|
||
import (
|
||
"errors"
|
||
)
|
||
|
||
type AppMomentCreate struct {
|
||
ClanID string `gorm:"column:clan_id;type:char(32);not null;comment:家" json:"clan_id"`
|
||
Title string `gorm:"column:title;type:varchar(64);not null;comment:标题" json:"title"`
|
||
TextContent string `gorm:"column:text_content;type:varchar(2048);not null;comment:内容" json:"text_content"`
|
||
Items []AppMomentCreateItem `json:"items"`
|
||
}
|
||
|
||
func (req *AppMomentCreate) Check() (err error) {
|
||
return nil
|
||
}
|
||
|
||
type AppMomentUpdate 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 *AppMomentUpdate) Check() (err error) {
|
||
if len(req.Nickname) == 0 {
|
||
err = errors.New("名称不能为空")
|
||
return
|
||
}
|
||
return nil
|
||
}
|
||
|
||
type AppMomentCreateItem struct {
|
||
Type string `gorm:"column:type;type:varchar(64);not null;comment:类型:PIC=图片" json:"type"`
|
||
Content string `gorm:"column:content;type:varchar(255);not null;comment:内容、如图片id" json:"content"`
|
||
}
|