announce

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = module.Module{
	ModuleName:    "announce",
	ModuleVersion: "1.0.0",
	ModuleConfig:  announceConfig,
	ModuleDepends: []string{},
	ModuleEnv: map[string]any{
		"orm.model": []any{
			&Announce{},
		},
	},
	ModuleExport: map[string]any{},
	ModulePerm: map[string]string{
		"announce.view":    "查看公告",
		"announce.hit":     "点击公告",
		"announce.create":  "创建公告",
		"announce.update":  "更新公告",
		"announce.delete":  "删除公告",
		"announce.viewall": "查看所有公告",
	},
	EntryPoint: entry,
}

Functions

This section is empty.

Types

type AllAnnounceRequest

type AllAnnounceRequest struct {
	Title     string `json:"title" url:"title" validate:"lte=191"`
	StartTime int64  `json:"start_time" url:"start_time" validate:"gte=-1,lte=253370764799"` // unix timestamp in seconds (UTC); -1代表不限; 含本数
	EndTime   int64  `json:"end_time" url:"end_time" validate:"gte=-1,lte=253370764799"`     // unix timestamp in seconds (UTC); -1代表不限; 含本数
	Inclusive bool   `json:"inclusive" url:"inclusive"`                                      // true: 查询开始时间晚于start,且结束时间早于end的(在某段时间内开始并结束的); false: 查询开始时间早于start,且结束时间晚于end的(在某段时间内都能看到的)
	model.PageParam
}

type Announce

type Announce struct {
	model.BaseModel
	Title     string     `gorm:"not null; unique; size:191; comment:标题"`
	Content   string     `gorm:"not null; comment:内容"`
	StartTime *time.Time `` /* 127-byte string literal not displayed */
	EndTime   *time.Time `` /* 127-byte string literal not displayed */
	Hits      uint       `gorm:"not null; default:0; index; comment:点击数"`
}

type AnnounceJson

type AnnounceJson struct {
	ID        uint   `json:"id"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	StartTime int64  `json:"start_time"` // unix timestamp in seconds (UTC)
	EndTime   int64  `json:"end_time"`   // unix timestamp in seconds (UTC)
	Hits      uint   `json:"hits"`       // 点击数
	CreatedAt int64  `json:"created_at"` // unix timestamp in seconds (UTC)
	UpdatedAt int64  `json:"updated_at"` // unix timestamp in seconds (UTC)
}

type CreateAnnounceRequest

type CreateAnnounceRequest struct {
	Title     string `json:"title" validate:"required,lte=191"`
	Content   string `json:"content" validate:"required,lte=65535"`
	StartTime int64  `json:"start_time" validate:"required,gte=-1,lte=253370764799"`                // unix timestamp in seconds (UTC); -1代表不限; 含本数
	EndTime   int64  `json:"end_time" validate:"required,eq=-1|gtfield=StartTime,lte=253370764799"` // unix timestamp in seconds (UTC); -1代表不限; 含本数; 必须大于start
}

type ModifyAnnounceRequest

type ModifyAnnounceRequest struct {
	Title     string
	Content   string
	StartTime int64
	EndTime   int64
}

type UpdateAnnounceRequest

type UpdateAnnounceRequest struct {
	Title     string `json:"title" validate:"lte=191"`
	Content   string `json:"content" validate:"lte=65535"`
	StartTime int64  `json:"start_time" validate:"required,gte=-1,lte=253370764799"`                // unix timestamp in seconds (UTC); -1代表不限; 含本数
	EndTime   int64  `json:"end_time" validate:"required,eq=-1|gtfield=StartTime,lte=253370764799"` // unix timestamp in seconds (UTC); -1代表不限; 含本数
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL