206 lines
9.5 KiB
Plaintext
Executable File
206 lines
9.5 KiB
Plaintext
Executable File
syntax = "v1"
|
||
|
||
info(
|
||
desc: "post gateway服务接口定义"
|
||
)
|
||
|
||
import (
|
||
"git.ixiaochuan.cn/zuiyou_server/service/proto/mproto"
|
||
"git.ixiaochuan.cn/zuiyou_server/zy_service/bizcomm/commfunc"
|
||
"git.ixiaochuan.cn/zuiyou_server/zy_service/types/posttypes"
|
||
"git.ixiaochuan.cn/zuiyou_server/zy_service/types/topicauxtypes"
|
||
)
|
||
|
||
type (
|
||
CreatePostParam {
|
||
Tid int64 `json:"tid"`
|
||
TopicFrom int64 `json:"topic_from"`
|
||
SelectTopics interface{} `json:"select_topics"`
|
||
Content string `json:"content"`
|
||
Link string `json:"link"`
|
||
LinkType int64 `json:"link_type"`
|
||
Pageres *Pagere `json:"pageres"`
|
||
Imgs []int64 `json:"imgs"`
|
||
Videos []interface{} `json:"videos"`
|
||
VoteTitle string `json:"vote_title"`
|
||
Vote []string `json:"vote"`
|
||
Audio *Audio `json:"audio"`
|
||
Ctype int64 `json:"c_type"`
|
||
CampaignID string `json:"campaign_id"`
|
||
From string `json:"from"`
|
||
Poi *Poi `json:"poi"`
|
||
Localid interface{} `json:"localid"`
|
||
Private int64 `json:"private"`
|
||
AtFriends []*posttypes.PostCreateParamAtFriendSt `json:"at_friends"`
|
||
RecTids []int64 `json:"rec_tids"`
|
||
TopicRecommend int64 `json:"is_topic_recommend"`
|
||
AdoptTopicRecommend int64 `json:"is_adopt_recommend"`
|
||
ActivityId int64 `json:"activity_id"`
|
||
PartId int64 `json:"part_id"`
|
||
Original int64 `json:"original"`
|
||
OriginalMid int64 `json:"original_mid"`
|
||
OriginalName string `json:"original_name"`
|
||
Goodthing interface{} `json:"goodthing"`
|
||
LocalInfo []*LocalInfoSt `json:"local_info"`
|
||
DissuadeType *int `json:"dissuade_type,omitempty"`
|
||
Cid int64 `json:"cid"`
|
||
TiTle string `json:"title,omitempty"`
|
||
FromPage string `json:"from_page"`
|
||
CurPage string `json:"cur_page"`
|
||
CollectionId int64 `json:"collection_id"`
|
||
VideoVotes []VideoVoteSt `json:"video_votes"`
|
||
IsSeekHelp int64 `json:"is_seek_help"`
|
||
SeekHelpInfo *SeekHelpInfo `json:"seek_help_info"`
|
||
MateInvisible int64 `json:"mate_invisible"` //找对象卡片创建时可以自己设置可见权限
|
||
RecoverFromPid int64 `json:"recover_from_pid"` // 重新编辑帖子时, 该字段表示被重新编辑的帖子ID
|
||
AutoEnterDaziRoom int32 `json:"auto_enter_dazi_room"`
|
||
IsRoom int32 `json:"is_room"`
|
||
}
|
||
Pagere {
|
||
ThumbID int64 `json:"thumbid"`
|
||
Url string `json:"url"`
|
||
UrlType int64 `json:"url_type"`
|
||
Title string `json:"title"`
|
||
ThumbUrl string `json:"thumburl"`
|
||
ThumbW int64 `json:"thumb_w"`
|
||
ThumbH int64 `json:"thumb_h"`
|
||
ThumbFmt string `json:"thumb_fmt"`
|
||
Desc string `json:"desc"`
|
||
Author string `json:"author"`
|
||
VdUrl string `json:"vd_url"`
|
||
VdDur int64 `json:"vd_dur"`
|
||
Extra string `json:"extra"` //为了支持好物商品卡需求加的透传字段
|
||
}
|
||
Audio {
|
||
Dur int32 `json:"dur"`
|
||
Uri string `json:"uri"`
|
||
VoiceText string `json:"voice_text"`
|
||
}
|
||
Poi {
|
||
PoiId string `json:"poi_id"`
|
||
Name string `json:"name"`
|
||
Address string `json:"address"`
|
||
Province string `json:"province"`
|
||
City string `json:"city"`
|
||
CityCode string `json:"city_code"`
|
||
Lng float64 `json:"lng"`
|
||
Lat float64 `json:"lat"`
|
||
AdName string `json:"ad_name"`
|
||
AdCode string `json:"ad_code"`
|
||
Country string `json:"country"`
|
||
Show int32 `json:"show"`
|
||
}
|
||
LocalInfoSt {
|
||
Id int64 `json:"id"`
|
||
Type string `json:"type"`
|
||
Path string `json:"path"`
|
||
}
|
||
VideoVoteSt {
|
||
Vid int64 `json:"vid"`
|
||
Title string `json:"title"`
|
||
Items []string `json:"items"`
|
||
Start int `json:"start"`
|
||
Dur int `json:"dur"`
|
||
}
|
||
SeekHelpInfo {
|
||
Cid int64 `json:"cid"`
|
||
Cname string `json:"cname"`
|
||
}
|
||
|
||
CreatePostData {
|
||
Post *PostCreateData `json:"post"`
|
||
QuestionInvite *QuestionInviteSt `json:"question_invite"`
|
||
}
|
||
PostCreateData {
|
||
*posttypes.PostStExt
|
||
Topic *mproto.TopicInfo `json:"topic,omitempty"`
|
||
Member *MemberStRecExt `json:"member"`
|
||
Xmember *XMember `json:"xmember,omitempty"`
|
||
Private *int64 `json:"private,omitempty"`
|
||
Advert interface{} `json:"advert,omitempty"`
|
||
Collection *PostCollectionSt `json:"collection,omitempty"`
|
||
AnonymTopic *commfunc.AnonymTopic `json:"anonym_emotion,omitempty"`
|
||
Forum *topicauxtypes.ForumTopicInfoInPostSt `json:"forum"`
|
||
}
|
||
XMember {
|
||
Id int64 `json:"id"`
|
||
Avatar int64 `json:"avatar"`
|
||
Gender int64 `json:"gender"`
|
||
Name string `json:"name"`
|
||
UpName string `json:"up_name"`
|
||
}
|
||
MemberStRecExt {
|
||
*mproto.MemberSt
|
||
Atted *int64 `json:"atted,omitempty"`
|
||
AdminEpaulet *mproto.AdminEpauletSt `json:"admin_epaulet,omitempty"` // 可以使用MedalList完全替代
|
||
MedalList []*mproto.MemberMedalSt `json:"medal_list,omitempty"`
|
||
FriendsStatus int `json:"friends_status"`
|
||
HasReview int `json:"has_review"` //是否评论过
|
||
HasLike int `json:"has_like"` //是否点赞过
|
||
InLivingRoom bool `json:"in_living_room"`
|
||
}
|
||
QuestionInviteSt {
|
||
SectionId int64 `json:"section_id"`
|
||
ItemId int64 `json:"id"`
|
||
InviteCnt int32 `json:"invite_cnt"`
|
||
Enable int `json:"enable"`
|
||
DarenList []*SectionDarenMember `json:"daren_list"`
|
||
DarenCnt int32 `json:"daren_cnt"`
|
||
}
|
||
SectionDarenMember {
|
||
*mproto.MemberSt
|
||
RecReason string `json:"rec_reason,omitempty"`
|
||
}
|
||
)
|
||
|
||
|
||
@server(
|
||
prefix: /post
|
||
group: posts
|
||
check_permission: true
|
||
check_freq: false
|
||
)
|
||
service gateway {
|
||
@handler CreatePostHandler
|
||
post /create, /create_v2 (CreatePostParam) returns (CreatePostData)
|
||
}
|
||
|
||
dag CreatePostHandler (
|
||
// 请求参数预处理:original,tid,img,video,linkurl...; 前置校验是否能发帖
|
||
RequestParamPreprocess ()
|
||
// 好物商品卡帖子计数
|
||
IncrLimitForGoodThingCard (
|
||
dependency [RequestParamPreprocess]
|
||
)
|
||
// 获取匿名用户信息 & 检查树洞封禁状态、是否命中匿名帖自见进审判断
|
||
CheckAnonymousUser ()
|
||
// 获取活动详情
|
||
GetActivityInfo (
|
||
dependency [RequestParamPreprocess]
|
||
)
|
||
// 检查是否有在该话题下发帖权限;获取话题详情
|
||
CheckAndGetTopicInfo (
|
||
dependency [RequestParamPreprocess]
|
||
)
|
||
// 合集数量检查
|
||
CheckCollection ()
|
||
// 获取member信息
|
||
GetMemberInfo (
|
||
dependency [RequestParamPreprocess, comm_CheckPermission, CheckAndGetTopicInfo]
|
||
)
|
||
// 处理去图片,视频,去水印, 网页
|
||
DealImgVideoWatermarkWebPage (
|
||
dependency [RequestParamPreprocess, CheckAndGetTopicInfo, GetMemberInfo]
|
||
)
|
||
// 组装post信息 & 发起create调用
|
||
PostCreate (
|
||
dependency [RequestParamPreprocess, DealImgVideoWatermarkWebPage, GetActivityInfo, CheckAndGetTopicInfo,
|
||
GetMemberInfo]
|
||
)
|
||
// 帖子创建成功后的一些处理: 创建找对象虚拟帖、找搭子帖、动态回调、送审...
|
||
PostCreateLaterMaintenance (
|
||
dependency [RequestParamPreprocess, DealImgVideoWatermarkWebPage, GetMemberInfo, CheckAnonymousUser, PostCreate]
|
||
)
|
||
)
|
||
|