Repository navigation
Expand file tree
/
Copy pathdatacenter.api
More file actions
313 lines (277 loc) · 7.13 KB
/
Copy pathdatacenter.api
File metadata and controls
313 lines (277 loc) · 7.13 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
info(
title: "中台系统"// TODO: add title
desc: "中台系统"// TODO: add description
author: "jackluo"
email: "net.webjoy@gmail.com"
)
//获取 应用信息
type Beid struct {
Beid int64 `json:"beid"`
}
type Token struct{
Token string `json:"token"`
}
type WxTicket struct{
Ticket string `json:"ticket"`
}
type Application struct {
Sname string `json:"Sname"` //名称
Logo string `json:"logo"` // login
Isclose int64 `json:"isclose"` //是否关闭
Fullwebsite string `json:"fullwebsite"` // 全站名称
}
type SnsReq struct{
Beid
Ptyid int64 `json:"ptyid"` //对应平台
BackUrl string `json:"back_url"` //登陆返回的地址
}
type SnsResp struct{
Beid
Ptyid int64 `json:"ptyid"` //对应平台
Appid string `json:"appid"` //sns 平台的id
Title string `json:"title"` //名称
LoginUrl string `json:"login_url"` //微信登陆的地址
}
type WxShareResp struct {
Appid string `json:"appid"`
Timestamp int64 `json:"timestamp"`
Noncestr string `json:"noncestr"`
Signature string `json:"signature"`
}
@server(
group: user
)
service user-api {
@handler ping
post /user/ping ()
@handler register
post /user/register (RegisterReq) returns (UserReply)
@handler login
post /user/login (LoginReq) returns (UserReply)
@handler wxlogin
post /user/wx/login (WxLoginReq) returns (LoginAppUser)
@handler code2Session
get /user/wx/login () returns (LoginAppUser)
}
@server(
jwt: Auth
group: user
middleware: Usercheck
)
service user-api {
@handler userInfo
get /user/dc/info (UserReq) returns (UserReply)
}
// 投票活动api
type Actid struct {
Actid int64 `json:"actid"` //活动id
}
type VoteReq struct {
Aeid int64 `json:"aeid"` // 作品id
Actid
}
type VoteResp struct {
VoteReq
Votecount int64 `json:"votecount"` //投票票数
Viewcount int64 `json:"viewcount"` //浏览数
}
// 活动返回的参数
type ActivityResp struct {
Actid int64 `json:"actid"`
Title string `json:"title"` //活动名称
Descr string `json:"descr"` //活动描述
StartDate int64 `json:"start_date"` //活动时间
EnrollDate int64 `json:"enroll_date"` //投票时间
EndDate int64 `json:"end_date"` //活动结束时间
Votecount int64 `json:"votecount"` //当前活动的总票数
Viewcount int64 `json:"viewcount"` //当前活动的总浏览数
Type int64 `json:"type"` //投票方式
Num int64 `json:"num"` //投票几票
}
//报名
type EnrollReq struct {
Actid
Name string `json:"name"` // 名称
Address string `json:"address"` //地址
Images []string `json:"images"` //作品图片
Descr string `json:"descr"` // 作品描述
}
// 作品返回
type EnrollResp struct {
Actid
Aeid int64 `json:"aeid"` // 作品id
Name string `json:"name"` // 名称
Address string `json:"address"` //地址
Images []string `json:"images"` //作品图片
Descr string `json:"descr"` // 作品描述
Votecount int64 `json:"votecount"` //当前活动的总票数
Viewcount int64 `json:"viewcount"` //当前活动的总浏览数
}
@server(
group: votes
)
service votes-api {
@doc(
summary: "获取活动的信息"
)
@handler activityInfo
get /votes/activity/info (Actid) returns (ActivityResp)
@doc(
summary: "活动访问+1"
)
@handler activityIcrView
get /votes/activity/view (Actid) returns (ActivityResp)
@doc(
summary: "获取报名的投票作品信息"
)
@handler enrollInfo
get /votes/enroll/info (VoteReq) returns (EnrollResp)
@doc(
summary: "获取报名的投票作品列表"
)
@handler enrollLists
get /votes/enroll/lists (Actid) returns(EnrollResp)
}
@server(
jwt: Auth
group: votes
middleware: Usercheck
)
service votes-api {
@doc(
summary: "投票"
)
@handler vote
post /votes/vote (VoteReq) returns (VoteResp)
@handler enroll
post /votes/enroll (EnrollReq) returns (EnrollResp)
}
type SearchReq struct {
Keyword string `json:"keyword"`
Page string `json:"page"`
Size string `json:"size"`
}
type SearchResp struct {
Data []ArticleReq `json:"data"`
}
type ArticleReq struct{
NewsId string `json:"NewsId"`
NewsTitle string `json:"NewsTitle"`
ImageUrl string `json:"ImageUrl"`
}
@server(
group: search
middleware: Admincheck
)
service search-api {
@doc(
summary: "搜索"
)
@handler article
get /search/article (SearchReq) returns (SearchResp)
@handler articleInit
get /search/articel/init (SearchReq) returns (SearchResp)
@handler articleStore
post /search/articel/store (ArticleReq) returns (ArticleReq)
}
@server(
group: common
)
service datacenter-api {
@doc(
summary: "获取站点的信息"
)
@handler votesVerification
get /MP_verify_NT04cqknJe0em3mT.txt (SnsReq) returns (SnsResp)
@handler appInfo
get /common/appinfo (Beid) returns (Application)
@doc(
summary: "获取站点的社交属性信息"
)
@handler snsInfo
post /common/snsinfo (SnsReq) returns (SnsResp)
//获取分享的
@handler wxTicket
post /common/wx/ticket (SnsReq) returns (WxShareResp)
}
//上传需要登陆
@server(
jwt: Auth
group: common
)
service datacenter-api {
@doc(
summary: "七牛上传凭证"
)
@handler qiuniuToken
post /common/qiuniu/token (Beid) returns (Token)
}
//注册请求
type RegisterReq struct {
// TODO: add members here and delete this comment
Mobile string `json:"mobile"` //基本一个手机号码就完事
Password string `json:"password"`
Smscode string `json:"smscode"` //短信码
}
//登陆请求
type LoginReq struct{
Mobile string `json:"mobile"`
Type int64 `json:"type"` //1.密码登陆,2.短信登陆
Password string `json:"password"`
}
//微信登陆
type WxLoginReq struct {
Beid int64 `json:"beid"` //应用id
Code string `json:"code"` //微信登陆密钥
Ptyid int64 `json:"ptyid"` //对应平台
}
//返回用户信息
type UserReply struct {
Auid int64 `json:"auid"`
Uid int64 `json:"uid"`
Beid int64 `json:"beid"` //应用id
Ptyid int64 `json:"ptyid"` //对应平台
Username string `json:"username"`
Mobile string `json:"mobile"`
Nickname string `json:"nickname"`
Openid string `json:"openid"`
Avator string `json:"avator"`
JwtToken
}
//返回APPUser
type AppUser struct{
Uid int64 `json:"uid"`
Auid int64 `json:"auid"`
Beid int64 `json:"beid"` //应用id
Ptyid int64 `json:"ptyid"` //对应平台
Nickname string `json:"nickname"`
Openid string `json:"openid"`
Avator string `json:"avator"`
}
type LoginAppUser struct{
Uid int64 `json:"uid"`
Auid int64 `json:"auid"`
Beid int64 `json:"beid"` //应用id
Ptyid int64 `json:"ptyid"` //对应平台
Nickname string `json:"nickname"`
Openid string `json:"openid"`
Avator string `json:"avator"`
JwtToken
}
type JwtToken struct {
AccessToken string `json:"access_token,omitempty"`
AccessExpire int64 `json:"access_expire,omitempty"`
RefreshAfter int64 `json:"refresh_after,omitempty"`
}
type UserReq struct{
Auid int64 `json:"auid"`
Uid int64 `json:"uid"`
Beid int64 `json:"beid"` //应用id
Ptyid int64 `json:"ptyid"` //对应平台
}
type Request {
Name string `path:"name,options=you|me"`
}
type Response {
Message string `json:"message"`
}