feat:完善项目
This commit is contained in:
@ -12,9 +12,10 @@ import (
|
||||
|
||||
type Activity struct {
|
||||
*session.Enterprise
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ActivityHandle func(session *session.Enterprise) *Activity
|
||||
type ActivityHandle func(session *session.Enterprise, tenantID uint64) *Activity
|
||||
|
||||
type (
|
||||
// ActivityInfo 活动信息
|
||||
@ -37,7 +38,7 @@ func (c *Activity) Instance(title string, mode, page, pageSize int) (*controller
|
||||
|
||||
var count int64
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
where := []*model2.ModelWhere{model2.NewWhere("a.tenant_id", c.tenantID)}
|
||||
|
||||
if title != "" {
|
||||
where = append(where, model2.NewWhereLike("a.title", title))
|
||||
@ -82,7 +83,7 @@ func (c *Activity) Join(id uint64) error {
|
||||
mActivityInstance := model.NewActivityInstance()
|
||||
|
||||
isExist, err := model2.FirstField(mActivityInstance.ActivityInstance, []string{"id", "mode", "join_deadline"},
|
||||
model2.NewWhere("status", model2.NewWhere("id", id)),
|
||||
model2.NewWhere("id", id), model2.NewWhere("tenant_id", c.tenantID),
|
||||
model2.NewWhere("status", model2.ActivityInstanceStatusForShow))
|
||||
|
||||
if err != nil {
|
||||
@ -115,7 +116,7 @@ func (c *Activity) Join(id uint64) error {
|
||||
}
|
||||
|
||||
func NewActivity() ActivityHandle {
|
||||
return func(session *session.Enterprise) *Activity {
|
||||
return &Activity{session}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Activity {
|
||||
return &Activity{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user