api.proto 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. syntax = "proto3";
  2. package live.recommend.v1;
  3. option go_package = "v1";
  4. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  5. service Recommend {
  6. // 获取n个推荐, 得到的结果是在线的房间
  7. // 去重,不会重复推荐
  8. // 如果没有足够推荐的结果则返回空的结果,调用方需要补位
  9. rpc random_recs_by_user (GetRandomRecReq) returns (GetRandomRecResp);
  10. // 清空推荐缓存,清空推荐过的集合
  11. rpc clear_recommend_cache (ClearRecommendRequest) returns (ClearRecommendResponse);
  12. }
  13. message ClearRecommendRequest {
  14. // 用户uid
  15. int64 uid = 1 [(gogoproto.moretags) = 'validate:"gt=0"'];
  16. }
  17. message ClearRecommendResponse {
  18. }
  19. message GetRandomRecReq {
  20. // 用户uid
  21. int64 uid = 1 [(gogoproto.moretags) = 'validate:"gt=0"'];
  22. // 获取数量
  23. uint32 count = 2 [(gogoproto.moretags) = 'validate:"gt=0"'];
  24. // room_id去重
  25. repeated int64 exist_ids = 3;
  26. }
  27. message GetRandomRecResp {
  28. // 返回数量
  29. uint32 count = 1;
  30. // 房间id
  31. repeated int64 room_ids = 2;
  32. }