Documentation ¶
Index ¶
- Constants
- Variables
- func CommentOpen() bool
- func CommentReview() bool
- func CommentSetting() string
- func NeedWithQuoteComment(c echo.Context) bool
- func PureJSONCommentList(c echo.Context) bool
- type Comment
- func (f *Comment) Add() (pk interface{}, err error)
- func (f *Comment) CustomerPendingCount(customerID interface{}) (int64, error)
- func (f *Comment) CustomerPendingTodayCount(customerID interface{}) (int64, error)
- func (f *Comment) CustomerTodayCount(customerID interface{}) (int64, error)
- func (f *Comment) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Comment) DeleteBy(row *dbschema.OfficialCommonComment, top bool) error
- func (f *Comment) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Comment) GetTargetIDs(cond *db.Compounds, limit int, offset int) ([]uint64, error)
- func (f *Comment) ListCond(typ, subType string, id uint64, flat bool, tableAlias ...string) *db.Compounds
- func (f *Comment) ListReplyCond(commentID uint64) *db.Compounds
- func (f *Comment) ListReplyCondMutiRoot(commentIDs []uint64) *db.Compounds
- func (f *Comment) RowNums(targetType, subType string, targetID uint64, ids []uint64) (map[uint64]int, error)
- func (f *Comment) SetCustomerID(customerID uint64)
- func (f *Comment) SetUserID(userID uint)
- func (f *Comment) WithExtra(list []*CommentAndReplyTarget, customer *dbschema.OfficialCustomer, ...) ([]*CommentAndExtra, error)
- type CommentAndCustomer
- type CommentAndExtra
- type CommentAndExtraLite
- type CommentAndReplyTarget
- type CommentConfig
- type CommentLite
Constants ¶
View Source
const (
BehaviorName = `comment`
)
Variables ¶
View Source
var ( //CommentAllowUsers all-所有人;buyer-当前商品买家;author-当前文章作者;admin-管理员;allAgent-所有代理;curAgent-当前产品代理;none-无人;designated-指定人员 CommentAllowUsers = []echo.KV{ {K: `all`, V: `所有人`}, {K: `buyer`, V: `当前商品买家`}, {K: `author`, V: `当前文章作者`}, {K: `curAgent`, V: `当前产品代理商`}, {K: `allAgent`, V: `所有代理商`}, {K: `admin`, V: `管理员`}, {K: `none`, V: `无`}, } //CommentAllowTypes 允许的类型标识 CommentAllowTypes = map[string]*CommentConfig{ `article`: { GetTarget: commentArticleGetTarget, CheckMaster: commentArticleCheck, AfterAdd: commentArticleAfterAdd, AfterDelete: commentArticleAfterDelete, WithTarget: commentArticleWithTarget, Ident: `article`, Label: `文章`, }, `other`: { Ident: `other`, Label: `其它`, }, } )
Functions ¶
func CommentOpen ¶
func CommentOpen() bool
func CommentReview ¶
func CommentReview() bool
func CommentSetting ¶
func CommentSetting() string
func NeedWithQuoteComment ¶
func PureJSONCommentList ¶
Types ¶
type Comment ¶
type Comment struct {
*dbschema.OfficialCommonComment
}
func NewComment ¶
func (*Comment) CustomerPendingCount ¶
func (*Comment) CustomerPendingTodayCount ¶
func (*Comment) CustomerTodayCount ¶
func (*Comment) DeleteBy ¶
func (f *Comment) DeleteBy(row *dbschema.OfficialCommonComment, top bool) error
DeleteBy 删除评论,并遍历删除所有对该评论的回复
func (*Comment) GetTargetIDs ¶
func (*Comment) ListReplyCondMutiRoot ¶
func (*Comment) SetCustomerID ¶
func (*Comment) WithExtra ¶
func (f *Comment) WithExtra(list []*CommentAndReplyTarget, customer *dbschema.OfficialCustomer, user *dbschemaNging.NgingUser, p *pagination.Pagination) ([]*CommentAndExtra, error)
type CommentAndCustomer ¶
type CommentAndCustomer struct { *dbschema.OfficialCommonComment Customer *dbschema.OfficialCustomer }
type CommentAndExtra ¶
type CommentAndExtra struct { *CommentAndReplyTarget FloorNumber int ReplyFloorNumber int Extra echo.H }
type CommentAndExtraLite ¶
type CommentAndExtraLite struct { *CommentLite User *modelAuthor.User `db:"-,relation=id:owner_id|gtZero|eq(owner_type:user),columns=id&username&avatar" json:",omitempty"` Customer *modelAuthor.Customer `db:"-,relation=id:owner_id|gtZero|eq(owner_type:customer),columns=id&name&avatar" json:",omitempty"` }
func (*CommentAndExtraLite) Name_ ¶
func (c *CommentAndExtraLite) Name_() string
type CommentAndReplyTarget ¶
type CommentAndReplyTarget struct { *dbschema.OfficialCommonComment ReplyTarget *CommentAndExtraLite `` /* 145-byte string literal not displayed */ }
type CommentConfig ¶
type CommentConfig struct { SN2ID func(ctx echo.Context, sn string) (uint64, error) // 序列号转ID GetTarget func(ctx echo.Context, targetID uint64) (res echo.H, breadcrumb []echo.KV, detailURL string, err error) CheckMaster func(echo.Context, *dbschema.OfficialCommonComment) error AfterAdd func(echo.Context, *dbschema.OfficialCommonComment) error AfterEdit func(echo.Context, *dbschema.OfficialCommonComment) error AfterDelete func(echo.Context, *dbschema.OfficialCommonComment) error WithTarget func( ctx echo.Context, listx []*CommentAndExtra, productIdOwnerIds map[string]map[string]map[string][]uint64, targets map[string][]uint64, targetObject map[uint64][]int, ) ([]*CommentAndExtra, error) Ident string Label string }
type CommentLite ¶
type CommentLite struct { Id uint64 `db:"id" bson:"id" json:"id" xml:"id"` // 关联值字段不能缺少 OwnerId uint64 `db:"owner_id" bson:"owner_id" comment:"评论者ID" json:"owner_id" xml:"owner_id"` OwnerType string `` /* 135-byte string literal not displayed */ Content string `db:"content" bson:"content" comment:"评论内容" json:"content" xml:"content"` Contype string `db:"contype" bson:"contype" comment:"内容类型" json:"contype" xml:"contype"` Created uint `db:"created" bson:"created" comment:"创建时间" json:"created" xml:"created"` Updated uint `db:"updated" bson:"updated" comment:"编辑时间" json:"updated" xml:"updated"` Display string `db:"display" bson:"display" comment:"显示" json:"display" xml:"display"` }
func (*CommentLite) Name_ ¶
func (c *CommentLite) Name_() string
Click to show internal directories.
Click to hide internal directories.