103 lines
3.5 KiB
Plaintext
Executable File
103 lines
3.5 KiB
Plaintext
Executable File
syntax = "v1"
|
||
|
||
import "git.ixiaochuan.cn/zeus/xczero_util/common/xcproto"
|
||
|
||
import "git.ixiaochuan.cn/pp_server/service_v2/mtypes"
|
||
|
||
info(
|
||
desc: "百科服务"
|
||
)
|
||
|
||
type (
|
||
EncyclopediaUserInfo {
|
||
Id int64 `json:"id"`
|
||
Name string `json:"name"`
|
||
Avatar int64 `json:"avatar"`
|
||
AvatarUrls map[string]*xcproto.ImgUrlSt `json:"avatar_urls,omitempty"`
|
||
}
|
||
EncyclopediaInfo {
|
||
Key string `json:"key"` // 词条
|
||
KeyDesc string `json:"key_desc"` // 词条解释
|
||
Pid int64 `json:"pid"` // 词条出处
|
||
Level int `json:"level"` // 展示级别,数字越大,优先级越高
|
||
Imgs []*xcproto.ImgSt `json:"imgs,omitempty"`
|
||
Videos map[string]*xcproto.VideoSt `json:"videos,omitempty"`
|
||
Author *EncyclopediaUserInfo `json:"author,omitempty"` // 贡献者
|
||
Type string `json:"type"` // 分类
|
||
PostInfo mtypes.PostSt `json:"post_info"` // 词条出处帖子信息
|
||
}
|
||
)
|
||
|
||
type (
|
||
UpdateParam {
|
||
Key string `json:"key"` // 词条
|
||
KeyDesc string `json:"key_desc"` // 词条解释
|
||
Show int `json:"show"` // 客户端显示开关, 0-关闭,1-打开
|
||
Mid int64 `json:"mid"` // 贡献者id
|
||
Pid int64 `json:"pid"` // 词条出处
|
||
Level int `json:"level"` // 展示级别,数字越大,优先级越高
|
||
Type string `json:"type"` // 词条分类 "经典热梗"、"皮皮大事件"
|
||
Imgs []int64 `json:"imgs,omitempty" bson:"imgs,omitempty"`
|
||
}
|
||
UpdateData {
|
||
Data int `json:"data"`
|
||
}
|
||
|
||
GetOneParam {
|
||
Key string `json:"key"` // 词条
|
||
}
|
||
GetOneData {
|
||
*mtypes.EncyclopediaInfo
|
||
}
|
||
|
||
GetListParam {
|
||
Key string `json:"key"` // 词条过滤
|
||
Sort string `json:"sort"` // 返回结果排序顺序,取值: "ut" - 按更新时间排序,"level"-按等级排序
|
||
Show int `json:"show"` // 客户端显示开关, 0-关闭,1-打开
|
||
Offset int `json:"offset"`
|
||
Limit int `json:"limit"`
|
||
Type string `json:"type"` // 词条分类 "经典热梗"、"皮皮大事件"
|
||
}
|
||
GetListData {
|
||
List []*mtypes.EncyclopediaInfo `json:"list"`
|
||
Offset int `json:"offset" bson:"offset"`
|
||
More int `json:"more" bson:"more"`
|
||
}
|
||
|
||
ViewReportParam {
|
||
Mid int64 `json:"mid"` // 用户ID
|
||
Key []string `json:"key"` // 词条
|
||
ViewType string `json:"view_type"` // 浏览类型: "view"-看到词条,"detail"-查看了词条详情
|
||
}
|
||
ViewReportData {
|
||
}
|
||
|
||
CheckUserEncyclopediaParam {
|
||
Mid int64 `json:"mid"` // 用户ID
|
||
List []string `json:"list"` //
|
||
}
|
||
CheckUserEncyclopediaData {
|
||
List []string `json:"list"` // 可展示的关键词列表
|
||
}
|
||
)
|
||
|
||
@server(
|
||
prefix: /encyclopedia/httpapi
|
||
)
|
||
service encyclopedia {
|
||
@handler UpdateHandler
|
||
post /update (UpdateParam) returns (UpdateData) opts (is_resp: true)
|
||
|
||
@handler GetOneHandler
|
||
post /get_one (GetOneParam) returns (GetOneData)
|
||
|
||
@handler GetListHandler
|
||
post /get_list (GetListParam) returns (GetListData)
|
||
|
||
@handler ViewReportHandler
|
||
post /view_report (ViewReportParam) returns (ViewReportData)
|
||
|
||
@handler CheckUserEncyclopediaHandler
|
||
post /check_user_encyclopedia (CheckUserEncyclopediaParam) returns (CheckUserEncyclopediaData)
|
||
}
|