biz

package
v0.0.0-...-fa05059 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnderReview uint8 = iota
	Approved
	UnApproved
)

Variables

View Source
var ProviderSet = wire.NewSet(NewCheckBiz)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type Check

type Check struct {
	ID        int64        `gorm:"primaryKey;autoIncrement"`         // 审核ID
	PostID    int64        `gorm:"not null"`                         // 帖子ID
	Content   string       `gorm:"type:text;not null"`               // 审核内容
	Title     string       `gorm:"size:255;not null"`                // 审核标签
	UserID    int64        `gorm:"column:user_id;index"`             // 提交审核的用户ID
	Status    uint8        `gorm:"default:0"`                        // 审核状态
	Remark    string       `gorm:"type:text"`                        // 审核备注
	CreatedAt time.Time    `gorm:"column:created_at;autoCreateTime"` // 创建时间
	UpdatedAt time.Time    `gorm:"column:updated_at;autoUpdateTime"` // 更新时间
	DeletedAt sql.NullTime `gorm:"index"`                            // 删除时间
}

type CheckBiz

type CheckBiz struct {
	CheckData CheckData
}

func NewCheckBiz

func NewCheckBiz(CheckData CheckData) *CheckBiz

func (*CheckBiz) CreateCheck

func (c *CheckBiz) CreateCheck(ctx context.Context, check Check) error

func (*CheckBiz) DeleteCheck

func (c *CheckBiz) DeleteCheck(ctx context.Context, checkID int64, userId int64) error

func (*CheckBiz) GetCheck

func (c *CheckBiz) GetCheck(ctx context.Context, checkID int64) (Check, error)

func (*CheckBiz) ListChecks

func (c *CheckBiz) ListChecks(ctx context.Context, pagination Pagination) ([]Check, error)

func (*CheckBiz) UpdateStatus

func (c *CheckBiz) UpdateStatus(ctx context.Context, checkID int64, remark string, status uint8) error

type CheckData

type CheckData interface {
	Create(ctx context.Context, check Check) error                          // 创建审核记录
	UpdateStatus(ctx context.Context, check Check) error                    // 更新审核状态
	Delete(ctx context.Context, checkId int64, uid int64) error             // 更新审核状态
	ListChecks(ctx context.Context, pagination Pagination) ([]Check, error) // 获取审核列表
	FindByID(ctx context.Context, checkId int64) (Check, error)             // 通过ID获取审核记录
	FindByPostId(ctx context.Context, postId uint) (Check, error)           // 通过帖子ID获取审核记录
	GetCheckCount(ctx context.Context) (int64, error)                       // 获取审核记录数量
}

type Pagination

type Pagination struct {
	Page int    // 当前页码
	Size *int64 // 每页数据
	Uid  int64
	// 以下字段通常在服务端内部使用,不需要客户端传递
	Offset *int64 // 数据偏移量
	Total  *int64 // 总数据量
}

Jump to

Keyboard shortcuts

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