bulletin.go 3.0 KB
package protocol

const (
	BulletinUnRelease = 1 //下架
	BulletinRelease   = 2 //上架
)

const (
	QuestionSingleSelect = 0 //单选
	QuestionMultiSelect  = 1 //多选
)

/*BulletinRelease */
type BulletinReleaseRequest struct {
	Id         int    `json:"id"`
	Type       int    `json:"type" valid:"Required"`
	Title      string `json:"title" valid:"Required"`
	Content    string `json:"content" valid:"Required"`
	AllowClose int    `json:"allow_close"`
	//AllowCondition int      `json:"allow_condition"`
	QuestionSwitch int      `json:"question_switch"`
	Receiver       []string `json:"receiver" valid:"Required"`
	Question       Question `json:"question"`
	Cover          Cover    `json:"cover" valid:"Required"`
}
type Question struct {
	Id      int               `json:"id"`
	Type    int               `json:"type" valid:"Required"`
	Title   string            `json:"title" valid:"Required"`
	Content []QuestionContent `json:"content" valid:"Required"`
}
type QuestionContent struct {
	Id      int    `json:"id" valid:"Required"`
	Content string `json:"content" valid:"Required"`
}
type Cover struct {
	Path string `json:"path" valid:"Required"`
	H    int    `json:"h"`
	W    int    `json:"w"`
}
type BulletinReleaseResponse struct {
}

/*BulletinList */
type BulletinListRequest struct {
	Status   int8 `json:"status"` //1:待上架 2:上架
	Page     int  `json:"page"`
	PageSize int  `json:"page_size"`
}
type BulletinListResponse struct {
	List  []*BulletinItem `json:"list"`
	Total int
}

type BulletinItem struct {
	Id       int        `json:"id"`
	Type     int8       `json:"type"`
	Title    string     `json:"title"`
	Status   int8       `json:"status"`
	Receiver []Receiver `json:"receiver" valid:"Required"`
	CreateAt string     `json:"time"`
}

/*GetBulletin */
type GetBulletinRequest struct {
}
type GetBulletinResponse struct {
	Id         int    `json:"id"`
	Type       int    `json:"type" valid:"Required"`
	Title      string `json:"title" valid:"Required"`
	Content    string `json:"content" valid:"Required"`
	AllowClose int    `json:"allow_close"`
	//AllowCondition int        `json:"allow_condition"`
	QuestionSwitch int        `json:"question_switch"`
	Receiver       []Receiver `json:"receiver" valid:"Required"`
	Question       Question   `json:"question"`
	Cover          Cover      `json:"cover" valid:"Required"`
}

type Receiver struct {
	Id       int64  `json:"id"`
	NickName string `json:"name"`
}

/*UpdateBulletin */
type UpdateBulletinRequest struct {
	Id         int    `json:"id" valid:"Required"`
	Type       int    `json:"type" valid:"Required"`
	Title      string `json:"title" valid:"Required"`
	Content    string `json:"content" valid:"Required"`
	AllowClose int    `json:"allow_close"`
	//AllowCondition int      `json:"allow_condition"`
	QuestionSwitch int      `json:"question_switch"`
	Receiver       []string `json:"receiver" valid:"Required"`
	Question       Question `json:"question"`
	Cover          Cover    `json:"cover" valid:"Required"`
}
type UpdateBulletinResponse struct {
}