article_security.go 2.6 KB
package domain

import (
	"context"
	"github.com/silenceper/wechat/v2/miniprogram/security"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)

type ArticleSecurity struct {
	Id                  int64 // 唯一标识
	CompanyId           int64
	ContentKeyWords     []string       // 内容关键字
	ContentType         int            `json:"contentType,omitempty"`  // 内容类型 (1:文章 2:评论)
	ContentId           int64          `json:"contentId,omitempty"`    // 内容ID
	AuthorId            int64          `json:"authorId,omitempty"`     // 发布人
	AuthorName          string         `json:"authorName,omitempty"`   // 发布人
	Reviewer            int64          `json:"reviewer,omitempty"`     // 审核人
	ReviewStatus        int            `json:"reviewStatus,omitempty"` // 审核状态 1:待审核 2:通过 3:拒绝
	Label               string         // 标签
	Prob                int            // 分值
	Suggest             string         // 建议 通过、风险、人工审核
	Detail              MsgCheckDetail `json:"detail,omitempty"`
	AutoReviewAt        int64          `json:"autoReviewAt,omitempty"`        // 自动审核时间
	AutoReviewErrorCode string         `json:"autoReviewErrorCode,omitempty"` // 自动审核错误码
	ReviewAt            int64          `json:"reviewAt,omitempty"`            // 审核时间(人工处置时间)
	CreatedAt           int64          `json:"createdAt,omitempty"`
	UpdatedAt           int64          `json:"updatedAt,omitempty"`
	DeletedAt           int64          `json:"deletedAt,omitempty"`
	Version             int            `json:"version,omitempty"`
}

const (
	ReviewStatusWait = iota + 1
	ReviewStatusPass
	ReviewStatusFail
)

const (
	TypeArticle = 1
	TypeComment = 2
)

type MsgCheckDetail security.MsgCheckResponse

type ArticleSecurityRepository interface {
	Insert(ctx context.Context, conn transaction.Conn, dm *ArticleSecurity) (*ArticleSecurity, error)
	Update(ctx context.Context, conn transaction.Conn, dm *ArticleSecurity) (*ArticleSecurity, error)
	UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleSecurity) (*ArticleSecurity, error)
	Delete(ctx context.Context, conn transaction.Conn, dm *ArticleSecurity) (*ArticleSecurity, error)
	FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSecurity, error)
	Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSecurity, error)
}

func (m *ArticleSecurity) Identify() interface{} {
	if m.Id == 0 {
		return nil
	}
	return m.Id
}