mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-02 06:20:24 +08:00
自定义页面支持用户操作
This commit is contained in:
@@ -77,8 +77,9 @@ func (this *HTTPPageDAO) FindEnabledHTTPPage(tx *dbs.Tx, id int64) (*HTTPPage, e
|
||||
}
|
||||
|
||||
// CreatePage 创建Page
|
||||
func (this *HTTPPageDAO) CreatePage(tx *dbs.Tx, statusList []string, bodyType shared.BodyType, url string, body string, newStatus int) (pageId int64, err error) {
|
||||
func (this *HTTPPageDAO) CreatePage(tx *dbs.Tx, userId int64, statusList []string, bodyType shared.BodyType, url string, body string, newStatus int) (pageId int64, err error) {
|
||||
op := NewHTTPPageOperator()
|
||||
op.UserId = userId
|
||||
op.IsOn = true
|
||||
op.State = HTTPPageStateEnabled
|
||||
|
||||
@@ -182,6 +183,26 @@ func (this *HTTPPageDAO) ComposePageConfig(tx *dbs.Tx, pageId int64, cacheMap *u
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// CheckUserPage 检查用户页面
|
||||
func (this *HTTPPageDAO) CheckUserPage(tx *dbs.Tx, userId int64, pageId int64) error {
|
||||
if userId <= 0 || pageId <= 0 {
|
||||
return ErrNotFound
|
||||
}
|
||||
|
||||
b, err := this.Query(tx).
|
||||
Pk(pageId).
|
||||
Attr("userId", userId).
|
||||
State(HTTPPageStateEnabled).
|
||||
Exist()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !b {
|
||||
return ErrNotFound
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NotifyUpdate 通知更新
|
||||
func (this *HTTPPageDAO) NotifyUpdate(tx *dbs.Tx, pageId int64) error {
|
||||
webId, err := SharedHTTPWebDAO.FindEnabledWebIdWithPageId(tx, pageId)
|
||||
|
||||
Reference in New Issue
Block a user