You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.6 KiB
41 lines
1.6 KiB
2 months ago
|
syntax = "proto3";
|
||
|
package feed;
|
||
|
option go_package = "feed";
|
||
|
|
||
|
import "user.proto";
|
||
|
|
||
|
message douyin_feed_request {
|
||
|
int64 latest_time = 1; // 可选参数,限制返回视频的最新投稿时间戳,精确到秒,不填表示当前时间
|
||
|
int64 user_id = 2; // 请求feed流的用户id,若没有则置为0
|
||
|
}
|
||
|
|
||
|
// 例如当前请求的latest_time为9:00,那么返回的视频列表时间戳为[8:55,7:40, 6:30, 6:00]
|
||
|
// 所有这些视频中,最早发布的是 6:00的视频,那么6:00作为下一次请求时的latest_time
|
||
|
// 那么下次请求返回的视频时间戳就会小于6:00
|
||
|
message douyin_feed_response {
|
||
|
int32 status_code = 1; // 状态码,0-成功,其他值-失败
|
||
|
string status_msg = 2; // 返回状态描述
|
||
|
repeated Video video_list = 3; // 视频列表
|
||
|
int64 next_time = 4; // 本次返回的视频中,发布最早的时间,作为下次请求时的latest_time
|
||
|
}
|
||
|
|
||
|
message video_id_request{
|
||
|
int64 video_id = 1 ;
|
||
|
int64 search_id = 2 ;
|
||
|
}
|
||
|
|
||
|
message Video {
|
||
|
int64 id = 1; // 视频唯一标识
|
||
|
user.User author = 2; // 视频作者信息
|
||
|
string play_url = 3; // 视频播放地址
|
||
|
string cover_url = 4; // 视频封面地址
|
||
|
int64 favorite_count = 5; // 视频的点赞总数
|
||
|
int64 comment_count = 6; // 视频的评论总数
|
||
|
bool is_favorite = 7; // true-已点赞,false-未点赞
|
||
|
string title = 8; // 视频标题
|
||
|
}
|
||
|
|
||
|
service FeedService{
|
||
|
rpc GetUserFeed (douyin_feed_request) returns (douyin_feed_response); //返回一个视频列表
|
||
|
rpc GetVideoById (video_id_request) returns (Video); // 根据视频id返回一个视频
|
||
|
}
|