Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["client.go"],
importpath = "go-common/app/service/live/live_data/api/liverpc",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/live/live_data/api/liverpc/v0:go_default_library",
"//app/service/live/live_data/api/liverpc/v1:go_default_library",
"//library/net/rpc/liverpc:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/service/live/live_data/api/liverpc/v0:all-srcs",
"//app/service/live/live_data/api/liverpc/v1:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,46 @@
// Code generated by liverpcgen, DO NOT EDIT.
// source: *.proto files under this directory
// If you want to change this file, Please see README in go-common/app/tool/liverpc/protoc-gen-liverpc/
package liverpc
import (
"go-common/app/service/live/live_data/api/liverpc/v0"
"go-common/app/service/live/live_data/api/liverpc/v1"
"go-common/library/net/rpc/liverpc"
)
// Client that represents a liverpc live_data service api
type Client struct {
cli *liverpc.Client
// V0Message presents the controller in liverpc
V0Message v0.Message
// V1Record presents the controller in liverpc
V1Record v1.Record
}
// DiscoveryAppId the discovery id is not the tree name
var DiscoveryAppId = "live.livedata"
// New a Client that represents a liverpc live.livedata service api
// conf can be empty, and it will use discovery to find service by default
// conf.AppID will be overwrite by a fixed value DiscoveryAppId
// therefore is no need to set
func New(conf *liverpc.ClientConfig) *Client {
if conf == nil {
conf = &liverpc.ClientConfig{}
}
conf.AppID = DiscoveryAppId
var realCli = liverpc.NewClient(conf)
cli := &Client{cli: realCli}
cli.clientInit(realCli)
return cli
}
func (cli *Client) GetRawCli() *liverpc.Client {
return cli.cli
}
func (cli *Client) clientInit(realCli *liverpc.Client) {
cli.V0Message = v0.NewMessageRpcClient(realCli)
cli.V1Record = v1.NewRecordRpcClient(realCli)
}

View File

@@ -0,0 +1,56 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "v0_proto",
srcs = ["Message.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v0_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/live_data/api/liverpc/v0",
proto = ":v0_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["Message.liverpc.go"],
embed = [":v0_go_proto"],
importpath = "go-common/app/service/live/live_data/api/liverpc/v0",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/net/rpc/liverpc:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,76 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v0/Message.proto
/*
Package v0 is a generated liverpc stub package.
This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
It is generated from these files:
v0/Message.proto
*/
package v0
import context "context"
import proto "github.com/golang/protobuf/proto"
import "go-common/library/net/rpc/liverpc"
var _ proto.Message // generate to suppress unused imports
// Imports only used by utility functions:
// =================
// Message Interface
// =================
type Message interface {
// * 监控队列: topicRoomStatusNotify-T
//
LiveNotify(context.Context, *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error)
// * 监控队列: topicOneLiveRoomAreaChange-T
//
AreaNotify(context.Context, *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error)
}
// =======================
// Message Live Rpc Client
// =======================
type messageRpcClient struct {
client *liverpc.Client
}
// NewMessageRpcClient creates a Rpc client that implements the Message interface.
// It communicates using Rpc and can be configured with a custom HTTPClient.
func NewMessageRpcClient(client *liverpc.Client) Message {
return &messageRpcClient{
client: client,
}
}
func (c *messageRpcClient) LiveNotify(ctx context.Context, in *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error) {
out := new(MessageLiveNotifyResp)
err := doRpcRequest(ctx, c.client, 0, "Message.liveNotify", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *messageRpcClient) AreaNotify(ctx context.Context, in *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error) {
out := new(MessageAreaNotifyResp)
err := doRpcRequest(ctx, c.client, 0, "Message.areaNotify", in, out)
if err != nil {
return nil, err
}
return out, nil
}
// =====
// Utils
// =====
func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
err = client.Call(ctx, version, method, in, out)
return
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
syntax = "proto3";
package live_data.v0;
option go_package = "v0";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Message {
/** 监控队列: topicRoomStatusNotify-T
*
*/
rpc liveNotify (MessageLiveNotifyReq) returns (MessageLiveNotifyResp);
/** 监控队列: topicOneLiveRoomAreaChange-T
*
*/
rpc areaNotify (MessageAreaNotifyReq) returns (MessageAreaNotifyResp);
}
message MessageLiveNotifyReq {
}
message MessageLiveNotifyResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message Data {
}
}
message MessageAreaNotifyReq {
}
message MessageAreaNotifyResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message Data {
}
}

View File

@@ -0,0 +1,56 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "v1_proto",
srcs = ["Record.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v1_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/live_data/api/liverpc/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["Record.liverpc.go"],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/live/live_data/api/liverpc/v1",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/net/rpc/liverpc:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,128 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v1/Record.proto
/*
Package v1 is a generated liverpc stub package.
This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
It is generated from these files:
v1/Record.proto
*/
package v1
import context "context"
import proto "github.com/golang/protobuf/proto"
import "go-common/library/net/rpc/liverpc"
var _ proto.Message // generate to suppress unused imports
// Imports only used by utility functions:
// ================
// Record Interface
// ================
type Record interface {
// * sessionid批量获取动态直播卡片详情
//
Session(context.Context, *RecordSessionReq) (*RecordSessionResp, error)
// * roomid批量获取最近开播时间
//
Get(context.Context, *RecordGetReq) (*RecordGetResp, error)
// * roomid批量获取某一时间段的直播记录
//
LiveTime(context.Context, *RecordLiveTimeReq) (*RecordLiveTimeResp, error)
// * 外网:根据登录态获取某月份有直播记录的分区列表;内网需要传roomid
//
Areas(context.Context, *RecordAreasReq) (*RecordAreasResp, error)
// * 外网:根据登录态获取某分区、月份的直播记录;内网需要传roomid
//
AreaLive(context.Context, *RecordAreaLiveReq) (*RecordAreaLiveResp, error)
// * 外网:根据登录态获取某天的直播记录;内网需要传roomid
//
DayLive(context.Context, *RecordDayLiveReq) (*RecordDayLiveResp, error)
}
// ======================
// Record Live Rpc Client
// ======================
type recordRpcClient struct {
client *liverpc.Client
}
// NewRecordRpcClient creates a Rpc client that implements the Record interface.
// It communicates using Rpc and can be configured with a custom HTTPClient.
func NewRecordRpcClient(client *liverpc.Client) Record {
return &recordRpcClient{
client: client,
}
}
func (c *recordRpcClient) Session(ctx context.Context, in *RecordSessionReq) (*RecordSessionResp, error) {
out := new(RecordSessionResp)
err := doRpcRequest(ctx, c.client, 1, "Record.session", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *recordRpcClient) Get(ctx context.Context, in *RecordGetReq) (*RecordGetResp, error) {
out := new(RecordGetResp)
err := doRpcRequest(ctx, c.client, 1, "Record.get", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *recordRpcClient) LiveTime(ctx context.Context, in *RecordLiveTimeReq) (*RecordLiveTimeResp, error) {
out := new(RecordLiveTimeResp)
err := doRpcRequest(ctx, c.client, 1, "Record.liveTime", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *recordRpcClient) Areas(ctx context.Context, in *RecordAreasReq) (*RecordAreasResp, error) {
out := new(RecordAreasResp)
err := doRpcRequest(ctx, c.client, 1, "Record.areas", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *recordRpcClient) AreaLive(ctx context.Context, in *RecordAreaLiveReq) (*RecordAreaLiveResp, error) {
out := new(RecordAreaLiveResp)
err := doRpcRequest(ctx, c.client, 1, "Record.areaLive", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *recordRpcClient) DayLive(ctx context.Context, in *RecordDayLiveReq) (*RecordDayLiveResp, error) {
out := new(RecordDayLiveResp)
err := doRpcRequest(ctx, c.client, 1, "Record.dayLive", in, out)
if err != nil {
return nil, err
}
return out, nil
}
// =====
// Utils
// =====
func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
err = client.Call(ctx, version, method, in, out)
return
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,266 @@
syntax = "proto3";
package live_data.v1;
option go_package = "v1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Record {
/** sessionid批量获取动态直播卡片详情
*
*/
rpc session (RecordSessionReq) returns (RecordSessionResp);
/** roomid批量获取最近开播时间
*
*/
rpc get (RecordGetReq) returns (RecordGetResp);
/** roomid批量获取某一时间段的直播记录
*
*/
rpc liveTime (RecordLiveTimeReq) returns (RecordLiveTimeResp);
/** 外网:根据登录态获取某月份有直播记录的分区列表;内网需要传roomid
*
*/
rpc areas (RecordAreasReq) returns (RecordAreasResp);
/** 外网:根据登录态获取某分区、月份的直播记录;内网需要传roomid
*
*/
rpc areaLive (RecordAreaLiveReq) returns (RecordAreaLiveResp);
/** 外网:根据登录态获取某天的直播记录;内网需要传roomid
*
*/
rpc dayLive (RecordDayLiveReq) returns (RecordDayLiveResp);
}
message RecordSessionReq {
// sessionid
repeated int64 sessionids = 1 [(gogoproto.jsontag) = "sessionids"];
}
message RecordSessionResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
map<int64, LiveInfo> data = 3 [(gogoproto.jsontag) = "data"];
message LiveInfo {
//
int64 id = 1 [(gogoproto.jsontag) = "id"];
//
int64 roomid = 2 [(gogoproto.jsontag) = "roomid"];
//
int64 uid = 3 [(gogoproto.jsontag) = "uid"];
//
string title = 4 [(gogoproto.jsontag) = "title"];
//
string cover = 5 [(gogoproto.jsontag) = "cover"];
//
string user_cover = 6 [(gogoproto.jsontag) = "user_cover"];
//
int64 online = 7 [(gogoproto.jsontag) = "online"];
//
string jump_url = 8 [(gogoproto.jsontag) = "jump_url"];
//
int64 area_v2_id = 9 [(gogoproto.jsontag) = "area_v2_id"];
//
string start_time = 10 [(gogoproto.jsontag) = "start_time"];
//
string end_time = 11 [(gogoproto.jsontag) = "end_time"];
//
int64 sessionid = 12 [(gogoproto.jsontag) = "sessionid"];
}
}
message RecordGetReq {
// 房间id数组
repeated int64 roomids = 1 [(gogoproto.jsontag) = "roomids"];
}
message RecordGetResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
map<string, TimeInfo> data = 3 [(gogoproto.jsontag) = "data"];
message TimeInfo {
// 房间
int64 roomid = 1 [(gogoproto.jsontag) = "roomid"];
// 最近开播时间
string recent_end_time = 2 [(gogoproto.jsontag) = "recent_end_time"];
}
}
message RecordLiveTimeReq {
//
repeated int64 roomids = 1 [(gogoproto.jsontag) = "roomids"];
//
string start_time = 2 [(gogoproto.jsontag) = "start_time"];
//
string end_time = 3 [(gogoproto.jsontag) = "end_time"];
}
message RecordLiveTimeResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
map<int64, LiveInfo> data = 3 [(gogoproto.jsontag) = "data"];
message LiveInfo {
//
int64 roomid = 1 [(gogoproto.jsontag) = "roomid"];
//
int64 uid = 2 [(gogoproto.jsontag) = "uid"];
//
int64 area_v2_id = 3 [(gogoproto.jsontag) = "area_v2_id"];
//
int64 area_v2_parent_id = 4 [(gogoproto.jsontag) = "area_v2_parent_id"];
//
string start_time = 5 [(gogoproto.jsontag) = "start_time"];
//
string end_time = 6 [(gogoproto.jsontag) = "end_time"];
// 该时间段内最大人气
int64 max_online_num = 7 [(gogoproto.jsontag) = "max_online_num"];
// 该时间段内最后关注数
int64 attention = 8 [(gogoproto.jsontag) = "attention"];
// 是否是后台自动切分的记录
int64 is_cut = 9 [(gogoproto.jsontag) = "is_cut"];
}
}
message RecordAreasReq {
// 房间id
int64 roomid = 1 [(gogoproto.jsontag) = "roomid"];
// 月份 2018-09
string date = 2 [(gogoproto.jsontag) = "date"];
}
message RecordAreasResp {
// 返回code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// 返回msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
repeated Data data = 3 [(gogoproto.jsontag) = "data"];
message List {
//
int64 id = 1 [(gogoproto.jsontag) = "id"];
//
string name = 2 [(gogoproto.jsontag) = "name"];
//
int64 parent_id = 3 [(gogoproto.jsontag) = "parent_id"];
}
message Data {
//
int64 id = 1 [(gogoproto.jsontag) = "id"];
//
string name = 2 [(gogoproto.jsontag) = "name"];
//
repeated List list = 3 [(gogoproto.jsontag) = "list"];
}
}
message RecordAreaLiveReq {
// 房间id
int64 roomid = 1 [(gogoproto.jsontag) = "roomid"];
// 月份 2018-09
string date = 2 [(gogoproto.jsontag) = "date"];
// 逗号隔开的分区id组成的字符串
string area_ids = 3 [(gogoproto.jsontag) = "area_ids"];
}
message RecordAreaLiveResp {
// 返回code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// 返回msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message List {
// 日期 2018-09-01
string date = 1 [(gogoproto.jsontag) = "date"];
// 直播时长,分钟
int64 live_time = 2 [(gogoproto.jsontag) = "live_time"];
// 直播次数
int64 live_num = 3 [(gogoproto.jsontag) = "live_num"];
// 该日期下最大人气
int64 max_online = 4 [(gogoproto.jsontag) = "max_online"];
}
message Count {
// 该月直播总时长
string all_live_time = 1 [(gogoproto.jsontag) = "all_live_time"];
// 该月直播总天数(某一天有直播记录就算一天,对直播时长没要求)
int64 all_live_day = 2 [(gogoproto.jsontag) = "all_live_day"];
// 该月最大人气
int64 max_online = 3 [(gogoproto.jsontag) = "max_online"];
}
message Data {
//
repeated List list = 1 [(gogoproto.jsontag) = "list"];
//
Count count = 2 [(gogoproto.jsontag) = "count"];
}
}
message RecordDayLiveReq {
// 房间id
int64 roomid = 1 [(gogoproto.jsontag) = "roomid"];
// 日期 2018-09-01
string day = 2 [(gogoproto.jsontag) = "day"];
}
message RecordDayLiveResp {
// 返回code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// 返回msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message List {
// 日期 2018-09-01
string date = 1 [(gogoproto.jsontag) = "date"];
// 直播时长,分钟
int64 live_time = 2 [(gogoproto.jsontag) = "live_time"];
// 开播时间
string start_time = 3 [(gogoproto.jsontag) = "start_time"];
// 关播时间
string end_time = 4 [(gogoproto.jsontag) = "end_time"];
// 该日期下最大人气
int64 max_online = 5 [(gogoproto.jsontag) = "max_online"];
}
message Data {
//
repeated List list = 1 [(gogoproto.jsontag) = "list"];
}
}