forked from ixre/go2o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.go
53 lines (45 loc) · 970 Bytes
/
page.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Copyright 2015 @ z3q.net.
* name : pag
* author : jarryliu
* date : -- :
* description :
* history :
*/
package content
import (
"go2o/src/core/domain/interface/content"
"time"
)
var _ content.IPage = new(Page)
type Page struct {
_contentRep content.IContentRep
_partnerId int
_value *content.ValuePage
}
func NewPage(partnerId int, rep content.IContentRep, v *content.ValuePage) content.IPage {
return &Page{
_contentRep: rep,
_partnerId: partnerId,
_value: v,
}
}
// 获取领域编号
func (this *Page) GetDomainId() int {
return this._value.Id
}
// 获取值
func (this *Page) GetValue() *content.ValuePage {
return this._value
}
// 设置值
func (this *Page) SetValue(v *content.ValuePage) error {
v.Id = this.GetDomainId()
this._value = v
return nil
}
// 保存
func (this *Page) Save() (int, error) {
this._value.UpdateTime = time.Now().Unix()
return this._contentRep.SavePage(this._partnerId, this._value)
}