@@ -2,60 +2,136 @@ package v1
22
33import (
44 "github.com/gogf/gf/v2/frame/g"
5+ "github.com/gogf/gf/v2/os/gtime"
56 "github.com/oldme-git/oldme-api/internal/model"
6- "github.com/oldme-git/oldme-api/internal/model/entity"
7- )
8-
9- type CreReq struct {
10- g.Meta `path:"article/create" method:"post" sm:"新增" tags:"文章"`
11- * model.ArticleInput
12- }
13-
14- type CreRes struct {
15- LastId model.Id `json:"lastId"`
16- }
17-
18- type UpdReq struct {
19- g.Meta `path:"article/update/{id}" method:"post" sm:"修改" tags:"文章"`
20- * model.IdInput
21- * model.ArticleInput
22- }
23-
24- type UpdRes struct {
25- }
26-
27- type DelReq struct {
28- g.Meta `path:"article/delete/{id}" method:"post" sm:"删除" tags:"文章"`
29- * model.IdInput
30- IsReal bool `dc:"是否彻底删除"`
31- }
32-
33- type DelRes struct {
34- }
35-
36- type ListReq struct {
37- g.Meta `path:"article/list/*grpId" method:"get" sm:"查询列表" tags:"文章"`
38- * model.ArticleQuery
39- }
40-
41- type ListRes struct {
42- List []model.ArticleList `json:"list"`
43- Total uint `json:"total"`
44- }
45-
46- type ShowReq struct {
47- g.Meta `path:"article/show/{id}" method:"get" sm:"查询详情" tags:"文章"`
48- * model.IdInput
49- }
50-
51- type ShowRes struct {
52- * entity.Article
53- }
54-
55- type ReCreReq struct {
56- g.Meta `path:"article/recreate/{id}" method:"post" sm:"找回文章" tags:"文章"`
57- * model.IdInput
58- }
59-
60- type ReCreRes struct {
61- }
7+ )
8+
9+ type (
10+ CreReq struct {
11+ g.Meta `path:"article/create" method:"post" sm:"新增" tags:"文章"`
12+ GrpId model.Id `json:"grpId" v:"required|integer|between:1,4294967295"`
13+ Title string `json:"title" v:"required|length:2, 100"`
14+ Author string `json:"author" v:"length:2, 30"`
15+ Thumb string `json:"thumb" v:"length:2, 200"`
16+ Tags string `json:"tags" v:"length:2, 200"`
17+ Description string `json:"description" v:"length:2, 200"`
18+ Content string `json:"content" v:"length:2, 100000"`
19+ Order int `json:"order" v:"integer|between:-9999,9999"`
20+ Ontop uint `json:"ontop" v:"boolean"`
21+ Onshow uint `json:"onshow" v:"boolean"`
22+ Hist uint `json:"hist" v:"integer|between:0,999999"`
23+ Post uint `json:"post" v:"integer|between:0,999999"`
24+ }
25+
26+ CreRes struct {
27+ LastId model.Id `json:"lastId"`
28+ }
29+ )
30+
31+ type (
32+ UpdReq struct {
33+ g.Meta `path:"article/update/{id}" method:"post" sm:"修改" tags:"文章"`
34+ * model.IdInput
35+ GrpId model.Id `json:"grpId" v:"required|integer|between:1,4294967295"`
36+ Title string `json:"title" v:"required|length:2, 100"`
37+ Author string `json:"author" v:"length:2, 30"`
38+ Thumb string `json:"thumb" v:"length:2, 200"`
39+ Tags string `json:"tags" v:"length:2, 200"`
40+ Description string `json:"description" v:"length:2, 200"`
41+ Content string `json:"content" v:"length:2, 100000"`
42+ Order int `json:"order" v:"integer|between:-9999,9999"`
43+ Ontop uint `json:"ontop" v:"boolean"`
44+ Onshow uint `json:"onshow" v:"boolean"`
45+ Hist uint `json:"hist" v:"integer|between:0,999999"`
46+ Post uint `json:"post" v:"integer|between:0,999999"`
47+ }
48+
49+ UpdRes struct {}
50+ )
51+
52+ type (
53+ DelReq struct {
54+ g.Meta `path:"article/delete/{id}" method:"post" sm:"删除" tags:"文章"`
55+ * model.IdInput
56+ IsReal bool `dc:"是否彻底删除"`
57+ }
58+
59+ DelRes struct {}
60+ )
61+
62+ type (
63+ ListReq struct {
64+ g.Meta `path:"article/list/*grpId" method:"get" sm:"查询列表" tags:"文章"`
65+ model.Paging
66+ GrpId model.Id `v:"integer|between:1,4294967295" json:"grpId"`
67+ Search string `v:"length: 1,30" json:"search" dc:"查询文本,会检索标题、标签、简介"`
68+ Onshow bool `json:"onshow" dc:"是否查询只发布的文章"`
69+ IsDel bool `json:"isDel" dc:"是否查询删除掉的文章"`
70+ }
71+
72+ ListRes struct {
73+ List []List `json:"list"`
74+ Total uint `json:"total"`
75+ }
76+ )
77+
78+ type (
79+ ShowReq struct {
80+ g.Meta `path:"article/show/{id}" method:"get" sm:"查询详情" tags:"文章"`
81+ * model.IdInput
82+ }
83+
84+ ShowRes struct {
85+ * One
86+ }
87+ )
88+
89+ type (
90+ ReCreReq struct {
91+ g.Meta `path:"article/recreate/{id}" method:"post" sm:"找回文章" tags:"文章"`
92+ * model.IdInput
93+ }
94+
95+ ReCreRes struct {
96+ }
97+ )
98+
99+ type (
100+ List struct {
101+ Id uint `json:"id" description:""`
102+ GrpId uint `json:"grpId" description:"分组id"`
103+ Title string `json:"title" description:"标题"`
104+ Author string `json:"author" description:"作者"`
105+ Thumb string `json:"thumb" description:"图片地址"`
106+ Tags string `json:"tags" description:"标签,依英文逗号隔开"`
107+ Description string `json:"description" description:"简介"`
108+ Order int `json:"order" description:"排序,越大越靠前"`
109+ Ontop uint `json:"ontop" description:"是否置顶"`
110+ Onshow uint `json:"onshow" description:"是否显示"`
111+ Hist uint `json:"hist" description:"点击数"`
112+ Post uint `json:"post" description:"评论数"`
113+ CreatedAt * gtime.Time `json:"createdAt" description:"创建时间"`
114+ UpdatedAt * gtime.Time `json:"updatedAt" description:"更新时间"`
115+ LastedAt * gtime.Time `json:"lastedAt" description:"最后浏览时间"`
116+ }
117+
118+ One struct {
119+ Id uint `json:"id" description:""`
120+ GrpId uint `json:"grpId" description:"分组id"`
121+ Title string `json:"title" description:"标题"`
122+ Author string `json:"author" description:"作者"`
123+ Thumb string `json:"thumb" description:"图片地址"`
124+ Tags string `json:"tags" description:"标签,依英文逗号隔开"`
125+ Description string `json:"description" description:"简介"`
126+ Content string `json:"content" description:"内容"`
127+ Order int `json:"order" description:"排序,越大越靠前"`
128+ Ontop uint `json:"ontop" description:"是否置顶"`
129+ Onshow uint `json:"onshow" description:"是否显示"`
130+ Hist uint `json:"hist" description:"点击数"`
131+ Post uint `json:"post" description:"评论数"`
132+ CreatedAt * gtime.Time `json:"createdAt" description:"创建时间"`
133+ UpdatedAt * gtime.Time `json:"updatedAt" description:"更新时间"`
134+ DeletedAt * gtime.Time `json:"deletedAt" description:"删除时间"`
135+ LastedAt * gtime.Time `json:"lastedAt" description:"最后浏览时间"`
136+ }
137+ )
0 commit comments