forked from ixre/go2o
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.go
82 lines (69 loc) · 1.68 KB
/
content.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Copyright 2015 @ z3q.net.
* name : content
* author : jarryliu
* date : -- :
* description :
* history :
*/
package content
import "go2o/src/core/domain/interface/content"
var _ content.IContent = new(Content)
type Content struct {
_contentRep content.IContentRep
_partnerId int
}
func NewContent(partnerId int, rep content.IContentRep) content.IContent {
return &Content{
_contentRep: rep,
_partnerId: partnerId,
}
}
// 获取聚合根编号
func (this *Content) GetAggregateRootId() int {
return this._partnerId
}
// 创建页面
func (this *Content) CreatePage(v *content.ValuePage) content.IPage {
return NewPage(this.GetAggregateRootId(), this._contentRep, v)
}
// 获取页面
func (this *Content) GetPage(id int) content.IPage {
v := this._contentRep.GetPageById(this.GetAggregateRootId(), id)
if v != nil {
return this.CreatePage(v)
}
return nil
}
// 根据字符串标识获取页面
func (this *Content) GetPageByStringIndent(indent string) content.IPage {
v := this._contentRep.GetPageByStringIndent(this.GetAggregateRootId(), indent)
if v != nil {
return this.CreatePage(v)
}
return nil
}
// 删除页面
func (this *Content) DeletePage(id int) error {
return this._contentRep.DeletePage(this.GetAggregateRootId(), id)
}
// 创建文章
func (this *Content) CreateArticle(*content.ValuePage) content.IArticle {
//todo:
return nil
}
// 获取文章
func (this *Content) GetArticle(id int) content.IArticle {
//todo:
return nil
}
// 获取文章列表
func (this *Content) GetArticleList(categoryId int, start, over int) []content.IArticle {
//todo:
return nil
}
// 删除文章
func (this *Content) DeleteArticle(id int) error {
//todo:
return nil
}