Create & Init Project...
This commit is contained in:
35
app/service/live/room_ex/api/liverpc/BUILD
Normal file
35
app/service/live/room_ex/api/liverpc/BUILD
Normal file
@ -0,0 +1,35 @@
|
||||
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/room_ex/api/liverpc",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/service/live/room_ex/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/room_ex/api/liverpc/v1:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
48
app/service/live/room_ex/api/liverpc/client.go
Normal file
48
app/service/live/room_ex/api/liverpc/client.go
Normal file
@ -0,0 +1,48 @@
|
||||
// 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/room_ex/api/liverpc/v1"
|
||||
"go-common/library/net/rpc/liverpc"
|
||||
)
|
||||
|
||||
// Client that represents a liverpc room_ex service api
|
||||
type Client struct {
|
||||
cli *liverpc.Client
|
||||
// V1BannerMng presents the controller in liverpc
|
||||
V1BannerMng v1.BannerMng
|
||||
// V1Banner presents the controller in liverpc
|
||||
V1Banner v1.Banner
|
||||
// V1RoomNews presents the controller in liverpc
|
||||
V1RoomNews v1.RoomNews
|
||||
}
|
||||
|
||||
// DiscoveryAppId the discovery id is not the tree name
|
||||
var DiscoveryAppId = "live.roomex"
|
||||
|
||||
// New a Client that represents a liverpc live.roomex 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.V1BannerMng = v1.NewBannerMngRpcClient(realCli)
|
||||
cli.V1Banner = v1.NewBannerRpcClient(realCli)
|
||||
cli.V1RoomNews = v1.NewRoomNewsRpcClient(realCli)
|
||||
}
|
64
app/service/live/room_ex/api/liverpc/v1/BUILD
Normal file
64
app/service/live/room_ex/api/liverpc/v1/BUILD
Normal file
@ -0,0 +1,64 @@
|
||||
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 = [
|
||||
"Banner.proto",
|
||||
"BannerMng.proto",
|
||||
"RoomNews.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/room_ex/api/liverpc/v1",
|
||||
proto = ":v1_proto",
|
||||
tags = ["automanaged"],
|
||||
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"Banner.liverpc.go",
|
||||
"BannerMng.liverpc.go",
|
||||
"RoomNews.liverpc.go",
|
||||
],
|
||||
embed = [":v1_go_proto"],
|
||||
importpath = "go-common/app/service/live/room_ex/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"],
|
||||
)
|
46
app/service/live/room_ex/api/liverpc/v1/Banner.liverpc.go
Normal file
46
app/service/live/room_ex/api/liverpc/v1/Banner.liverpc.go
Normal file
@ -0,0 +1,46 @@
|
||||
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
||||
// source: v1/Banner.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
|
||||
|
||||
// ================
|
||||
// Banner Interface
|
||||
// ================
|
||||
|
||||
type Banner interface {
|
||||
// * 获取新后台配置的banner
|
||||
//
|
||||
GetNewBanner(context.Context, *BannerGetNewBannerReq) (*BannerGetNewBannerResp, error)
|
||||
}
|
||||
|
||||
// ======================
|
||||
// Banner Live Rpc Client
|
||||
// ======================
|
||||
|
||||
type bannerRpcClient struct {
|
||||
client *liverpc.Client
|
||||
}
|
||||
|
||||
// NewBannerRpcClient creates a Rpc client that implements the Banner interface.
|
||||
// It communicates using Rpc and can be configured with a custom HTTPClient.
|
||||
func NewBannerRpcClient(client *liverpc.Client) Banner {
|
||||
return &bannerRpcClient{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *bannerRpcClient) GetNewBanner(ctx context.Context, in *BannerGetNewBannerReq) (*BannerGetNewBannerResp, error) {
|
||||
out := new(BannerGetNewBannerResp)
|
||||
err := doRpcRequest(ctx, c.client, 1, "Banner.getNewBanner", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
1259
app/service/live/room_ex/api/liverpc/v1/Banner.pb.go
Normal file
1259
app/service/live/room_ex/api/liverpc/v1/Banner.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
58
app/service/live/room_ex/api/liverpc/v1/Banner.proto
Normal file
58
app/service/live/room_ex/api/liverpc/v1/Banner.proto
Normal file
@ -0,0 +1,58 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package room_ex.v1;
|
||||
|
||||
option go_package = "v1";
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
service Banner {
|
||||
|
||||
/** 获取新后台配置的banner
|
||||
*
|
||||
*/
|
||||
rpc getNewBanner (BannerGetNewBannerReq) returns (BannerGetNewBannerResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
message BannerGetNewBannerReq {
|
||||
// 业务id,首页为0,web主站hove为1
|
||||
int64 platform = 1 [(gogoproto.jsontag) = "platform"];
|
||||
// 第几帧,0表示取全部
|
||||
int64 position = 2 [(gogoproto.jsontag) = "position"];
|
||||
// 平台
|
||||
string userPlatform = 3 [(gogoproto.jsontag) = "userPlatform"];
|
||||
// 设备
|
||||
string userDevice = 4 [(gogoproto.jsontag) = "userDevice"];
|
||||
// 版本号
|
||||
int64 build = 5 [(gogoproto.jsontag) = "build"];
|
||||
}
|
||||
|
||||
message BannerGetNewBannerResp {
|
||||
// code
|
||||
int64 code = 1 [(gogoproto.jsontag) = "code"];
|
||||
// msg
|
||||
string msg = 2 [(gogoproto.jsontag) = "msg"];
|
||||
//
|
||||
repeated NewBanner data = 3 [(gogoproto.jsontag) = "data"];
|
||||
|
||||
message NewBanner {
|
||||
// banner id
|
||||
string id = 1 [(gogoproto.jsontag) = "id"];
|
||||
// 图片地址
|
||||
string pic = 2 [(gogoproto.jsontag) = "pic"];
|
||||
// 图片地址
|
||||
string img = 3 [(gogoproto.jsontag) = "img"];
|
||||
// 跳转链接
|
||||
string link = 4 [(gogoproto.jsontag) = "link"];
|
||||
// 标题
|
||||
string title = 5 [(gogoproto.jsontag) = "title"];
|
||||
// 第几帧
|
||||
string position = 6 [(gogoproto.jsontag) = "position"];
|
||||
// 权重
|
||||
string sort_num = 7 [(gogoproto.jsontag) = "sort_num"];
|
||||
// 注释
|
||||
string remark = 8 [(gogoproto.jsontag) = "remark"];
|
||||
}
|
||||
}
|
65
app/service/live/room_ex/api/liverpc/v1/BannerMng.liverpc.go
Normal file
65
app/service/live/room_ex/api/liverpc/v1/BannerMng.liverpc.go
Normal file
@ -0,0 +1,65 @@
|
||||
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
||||
// source: v1/BannerMng.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/BannerMng.proto
|
||||
v1/Banner.proto
|
||||
v1/RoomNews.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:
|
||||
|
||||
// ===================
|
||||
// BannerMng Interface
|
||||
// ===================
|
||||
|
||||
type BannerMng interface {
|
||||
// * 获取新后台配置的banner
|
||||
//
|
||||
GetNewBanner(context.Context, *BannerMngGetNewBannerReq) (*BannerMngGetNewBannerResp, error)
|
||||
}
|
||||
|
||||
// =========================
|
||||
// BannerMng Live Rpc Client
|
||||
// =========================
|
||||
|
||||
type bannerMngRpcClient struct {
|
||||
client *liverpc.Client
|
||||
}
|
||||
|
||||
// NewBannerMngRpcClient creates a Rpc client that implements the BannerMng interface.
|
||||
// It communicates using Rpc and can be configured with a custom HTTPClient.
|
||||
func NewBannerMngRpcClient(client *liverpc.Client) BannerMng {
|
||||
return &bannerMngRpcClient{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *bannerMngRpcClient) GetNewBanner(ctx context.Context, in *BannerMngGetNewBannerReq) (*BannerMngGetNewBannerResp, error) {
|
||||
out := new(BannerMngGetNewBannerResp)
|
||||
err := doRpcRequest(ctx, c.client, 1, "BannerMng.getNewBanner", 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
|
||||
}
|
1297
app/service/live/room_ex/api/liverpc/v1/BannerMng.pb.go
Normal file
1297
app/service/live/room_ex/api/liverpc/v1/BannerMng.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
60
app/service/live/room_ex/api/liverpc/v1/BannerMng.proto
Normal file
60
app/service/live/room_ex/api/liverpc/v1/BannerMng.proto
Normal file
@ -0,0 +1,60 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package room_ex.v1;
|
||||
|
||||
option go_package = "v1";
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
service BannerMng {
|
||||
|
||||
/** 获取新后台配置的banner
|
||||
*
|
||||
*/
|
||||
rpc getNewBanner (BannerMngGetNewBannerReq) returns (BannerMngGetNewBannerResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
message BannerMngGetNewBannerReq {
|
||||
// 业务id,首页为0,web主站hove为1
|
||||
int64 platform = 1 [(gogoproto.jsontag) = "platform"];
|
||||
// 第几帧,0表示取全部
|
||||
int64 position = 2 [(gogoproto.jsontag) = "position"];
|
||||
// 平台
|
||||
string userPlatform = 3 [(gogoproto.jsontag) = "userPlatform"];
|
||||
// 设备
|
||||
string userDevice = 4 [(gogoproto.jsontag) = "userDevice"];
|
||||
// 版本号
|
||||
int64 build = 5 [(gogoproto.jsontag) = "build"];
|
||||
// 是否返回所有版本配置:是,则不论build传的值,全返回banner和版本配置
|
||||
int64 returnBuilds = 6 [(gogoproto.jsontag) = "returnBuilds"];
|
||||
}
|
||||
|
||||
message BannerMngGetNewBannerResp {
|
||||
// code
|
||||
int64 code = 1 [(gogoproto.jsontag) = "code"];
|
||||
// msg
|
||||
string msg = 2 [(gogoproto.jsontag) = "msg"];
|
||||
//
|
||||
repeated NewBanner data = 3 [(gogoproto.jsontag) = "data"];
|
||||
|
||||
message NewBanner {
|
||||
// banner id
|
||||
string id = 1 [(gogoproto.jsontag) = "id"];
|
||||
// 图片地址
|
||||
string pic = 2 [(gogoproto.jsontag) = "pic"];
|
||||
// 图片地址
|
||||
string img = 3 [(gogoproto.jsontag) = "img"];
|
||||
// 跳转链接
|
||||
string link = 4 [(gogoproto.jsontag) = "link"];
|
||||
// 标题
|
||||
string title = 5 [(gogoproto.jsontag) = "title"];
|
||||
// 第几帧
|
||||
string position = 6 [(gogoproto.jsontag) = "position"];
|
||||
// 权重
|
||||
string sort_num = 7 [(gogoproto.jsontag) = "sort_num"];
|
||||
// 注释
|
||||
string remark = 8 [(gogoproto.jsontag) = "remark"];
|
||||
}
|
||||
}
|
46
app/service/live/room_ex/api/liverpc/v1/RoomNews.liverpc.go
Normal file
46
app/service/live/room_ex/api/liverpc/v1/RoomNews.liverpc.go
Normal file
@ -0,0 +1,46 @@
|
||||
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
|
||||
// source: v1/RoomNews.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
|
||||
|
||||
// ==================
|
||||
// RoomNews Interface
|
||||
// ==================
|
||||
|
||||
type RoomNews interface {
|
||||
// * 批量获取直播公告
|
||||
//
|
||||
MultiGet(context.Context, *RoomNewsMultiGetReq) (*RoomNewsMultiGetResp, error)
|
||||
}
|
||||
|
||||
// ========================
|
||||
// RoomNews Live Rpc Client
|
||||
// ========================
|
||||
|
||||
type roomNewsRpcClient struct {
|
||||
client *liverpc.Client
|
||||
}
|
||||
|
||||
// NewRoomNewsRpcClient creates a Rpc client that implements the RoomNews interface.
|
||||
// It communicates using Rpc and can be configured with a custom HTTPClient.
|
||||
func NewRoomNewsRpcClient(client *liverpc.Client) RoomNews {
|
||||
return &roomNewsRpcClient{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *roomNewsRpcClient) MultiGet(ctx context.Context, in *RoomNewsMultiGetReq) (*RoomNewsMultiGetResp, error) {
|
||||
out := new(RoomNewsMultiGetResp)
|
||||
err := doRpcRequest(ctx, c.client, 1, "RoomNews.multiGet", in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
1001
app/service/live/room_ex/api/liverpc/v1/RoomNews.pb.go
Normal file
1001
app/service/live/room_ex/api/liverpc/v1/RoomNews.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
44
app/service/live/room_ex/api/liverpc/v1/RoomNews.proto
Normal file
44
app/service/live/room_ex/api/liverpc/v1/RoomNews.proto
Normal file
@ -0,0 +1,44 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package room_ex.v1;
|
||||
|
||||
option go_package = "v1";
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
service RoomNews {
|
||||
|
||||
/** 批量获取直播公告
|
||||
*
|
||||
*/
|
||||
rpc multiGet (RoomNewsMultiGetReq) returns (RoomNewsMultiGetResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
message RoomNewsMultiGetReq {
|
||||
// 房间id组成的数组
|
||||
repeated int64 room_ids = 1 [(gogoproto.jsontag) = "room_ids"];
|
||||
// 是否需要转码1是0否,默认0
|
||||
int64 is_decoded = 2 [(gogoproto.jsontag) = "is_decoded"];
|
||||
}
|
||||
|
||||
message RoomNewsMultiGetResp {
|
||||
// 返回code
|
||||
int64 code = 1 [(gogoproto.jsontag) = "code"];
|
||||
// 返回msg
|
||||
string msg = 2 [(gogoproto.jsontag) = "msg"];
|
||||
//
|
||||
repeated Data data = 3 [(gogoproto.jsontag) = "data"];
|
||||
|
||||
message Data {
|
||||
// 房间id
|
||||
string roomid = 1 [(gogoproto.jsontag) = "roomid"];
|
||||
// 主播id
|
||||
string uid = 2 [(gogoproto.jsontag) = "uid"];
|
||||
// 公告内容
|
||||
string news_content = 3 [(gogoproto.jsontag) = "news_content"];
|
||||
// 更新时间
|
||||
string ctime = 4 [(gogoproto.jsontag) = "ctime"];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user