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,62 @@
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 = ["api.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/xanchor/api/grpc/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"api.bm.go",
"client.go",
],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/live/xanchor/api/grpc/v1",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/net/http/blademaster:go_default_library",
"//library/net/http/blademaster/binding:go_default_library",
"//library/net/rpc/warden:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_x_net//context: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,277 @@
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api/grpc/v1/api.proto
/*
Package v1 is a generated blademaster stub package.
This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
It is generated from these files:
api/grpc/v1/api.proto
*/
package v1
import (
"context"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/binding"
)
// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
var _ binding.StructValidator
// =================
// XAnchor Interface
// =================
type XAnchor interface {
// FetchRoomByIDs 查询房间信息
FetchRoomByIDs(ctx context.Context, req *RoomByIDsReq) (resp *RoomByIDsResp, err error)
// RoomOnlineList 在线房间列表
RoomOnlineList(ctx context.Context, req *RoomOnlineListReq) (resp *RoomOnlineListResp, err error)
// RoomCreate 房间创建
RoomCreate(ctx context.Context, req *RoomCreateReq) (resp *RoomCreateResp, err error)
// RoomUpdate 房间信息更新
RoomUpdate(ctx context.Context, req *RoomUpdateReq) (resp *UpdateResp, err error)
// RoomBatchUpdate 房间信息批量更新
RoomBatchUpdate(ctx context.Context, req *RoomBatchUpdateReq) (resp *UpdateResp, err error)
// RoomExtendUpdate 房间扩展信息更新
RoomExtendUpdate(ctx context.Context, req *RoomExtendUpdateReq) (resp *UpdateResp, err error)
// RoomExtendBatchUpdate 房间扩展信息批量更新
RoomExtendBatchUpdate(ctx context.Context, req *RoomExtendBatchUpdateReq) (resp *UpdateResp, err error)
// RoomExtendIncre 房间信息增量更新
RoomExtendIncre(ctx context.Context, req *RoomExtendIncreReq) (resp *UpdateResp, err error)
// RoomExtendBatchIncre 房间信息批量增量更新
RoomExtendBatchIncre(ctx context.Context, req *RoomExtendBatchIncreReq) (resp *UpdateResp, err error)
// RoomTagSet 房间Tag更新
RoomTagSet(ctx context.Context, req *RoomTagSetReq) (resp *UpdateResp, err error)
// AnchorUpdate 主播信息更新
AnchorUpdate(ctx context.Context, req *AnchorUpdateReq) (resp *UpdateResp, err error)
// AnchorBatchUpdate 主播信息批量更新
AnchorBatchUpdate(ctx context.Context, req *AnchorBatchUpdateReq) (resp *UpdateResp, err error)
// AnchorIncre 主播信息增量更新
AnchorIncre(ctx context.Context, req *AnchorIncreReq) (resp *UpdateResp, err error)
// AnchorBatchIncre 主播信息批量增量更新
AnchorBatchIncre(ctx context.Context, req *AnchorBatchIncreReq) (resp *UpdateResp, err error)
// AnchorTagSet 主播Tag更新
AnchorTagSet(ctx context.Context, req *AnchorTagSetReq) (resp *UpdateResp, err error)
}
var v1XAnchorSvc XAnchor
// @params RoomByIDsReq
// @router GET /xlive/xanchor/v1/xAnchor/FetchRoomByIDs
// @response RoomByIDsResp
func xAnchorFetchRoomByIDs(c *bm.Context) {
p := new(RoomByIDsReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.FetchRoomByIDs(c, p)
c.JSON(resp, err)
}
// @params RoomOnlineListReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomOnlineList
// @response RoomOnlineListResp
func xAnchorRoomOnlineList(c *bm.Context) {
p := new(RoomOnlineListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomOnlineList(c, p)
c.JSON(resp, err)
}
// @params RoomCreateReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomCreate
// @response RoomCreateResp
func xAnchorRoomCreate(c *bm.Context) {
p := new(RoomCreateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomCreate(c, p)
c.JSON(resp, err)
}
// @params RoomUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomUpdate
// @response UpdateResp
func xAnchorRoomUpdate(c *bm.Context) {
p := new(RoomUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomUpdate(c, p)
c.JSON(resp, err)
}
// @params RoomBatchUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomBatchUpdate
// @response UpdateResp
func xAnchorRoomBatchUpdate(c *bm.Context) {
p := new(RoomBatchUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomBatchUpdate(c, p)
c.JSON(resp, err)
}
// @params RoomExtendUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomExtendUpdate
// @response UpdateResp
func xAnchorRoomExtendUpdate(c *bm.Context) {
p := new(RoomExtendUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomExtendUpdate(c, p)
c.JSON(resp, err)
}
// @params RoomExtendBatchUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomExtendBatchUpdate
// @response UpdateResp
func xAnchorRoomExtendBatchUpdate(c *bm.Context) {
p := new(RoomExtendBatchUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomExtendBatchUpdate(c, p)
c.JSON(resp, err)
}
// @params RoomExtendIncreReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomExtendIncre
// @response UpdateResp
func xAnchorRoomExtendIncre(c *bm.Context) {
p := new(RoomExtendIncreReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomExtendIncre(c, p)
c.JSON(resp, err)
}
// @params RoomExtendBatchIncreReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomExtendBatchIncre
// @response UpdateResp
func xAnchorRoomExtendBatchIncre(c *bm.Context) {
p := new(RoomExtendBatchIncreReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomExtendBatchIncre(c, p)
c.JSON(resp, err)
}
// @params RoomTagSetReq
// @router GET /xlive/xanchor/v1/xAnchor/RoomTagSet
// @response UpdateResp
func xAnchorRoomTagSet(c *bm.Context) {
p := new(RoomTagSetReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.RoomTagSet(c, p)
c.JSON(resp, err)
}
// @params AnchorUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/AnchorUpdate
// @response UpdateResp
func xAnchorAnchorUpdate(c *bm.Context) {
p := new(AnchorUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.AnchorUpdate(c, p)
c.JSON(resp, err)
}
// @params AnchorBatchUpdateReq
// @router GET /xlive/xanchor/v1/xAnchor/AnchorBatchUpdate
// @response UpdateResp
func xAnchorAnchorBatchUpdate(c *bm.Context) {
p := new(AnchorBatchUpdateReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.AnchorBatchUpdate(c, p)
c.JSON(resp, err)
}
// @params AnchorIncreReq
// @router GET /xlive/xanchor/v1/xAnchor/AnchorIncre
// @response UpdateResp
func xAnchorAnchorIncre(c *bm.Context) {
p := new(AnchorIncreReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.AnchorIncre(c, p)
c.JSON(resp, err)
}
// @params AnchorBatchIncreReq
// @router GET /xlive/xanchor/v1/xAnchor/AnchorBatchIncre
// @response UpdateResp
func xAnchorAnchorBatchIncre(c *bm.Context) {
p := new(AnchorBatchIncreReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.AnchorBatchIncre(c, p)
c.JSON(resp, err)
}
// @params AnchorTagSetReq
// @router GET /xlive/xanchor/v1/xAnchor/AnchorTagSet
// @response UpdateResp
func xAnchorAnchorTagSet(c *bm.Context) {
p := new(AnchorTagSetReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1XAnchorSvc.AnchorTagSet(c, p)
c.JSON(resp, err)
}
// RegisterV1XAnchorService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1XAnchorService(e *bm.Engine, svc XAnchor, midMap map[string]bm.HandlerFunc) {
v1XAnchorSvc = svc
e.GET("/xlive/xanchor/v1/xAnchor/FetchRoomByIDs", xAnchorFetchRoomByIDs)
e.GET("/xlive/xanchor/v1/xAnchor/RoomOnlineList", xAnchorRoomOnlineList)
e.GET("/xlive/xanchor/v1/xAnchor/RoomCreate", xAnchorRoomCreate)
e.GET("/xlive/xanchor/v1/xAnchor/RoomUpdate", xAnchorRoomUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/RoomBatchUpdate", xAnchorRoomBatchUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/RoomExtendUpdate", xAnchorRoomExtendUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/RoomExtendBatchUpdate", xAnchorRoomExtendBatchUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/RoomExtendIncre", xAnchorRoomExtendIncre)
e.GET("/xlive/xanchor/v1/xAnchor/RoomExtendBatchIncre", xAnchorRoomExtendBatchIncre)
e.GET("/xlive/xanchor/v1/xAnchor/RoomTagSet", xAnchorRoomTagSet)
e.GET("/xlive/xanchor/v1/xAnchor/AnchorUpdate", xAnchorAnchorUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/AnchorBatchUpdate", xAnchorAnchorBatchUpdate)
e.GET("/xlive/xanchor/v1/xAnchor/AnchorIncre", xAnchorAnchorIncre)
e.GET("/xlive/xanchor/v1/xAnchor/AnchorBatchIncre", xAnchorAnchorBatchIncre)
e.GET("/xlive/xanchor/v1/xAnchor/AnchorTagSet", xAnchorAnchorTagSet)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,231 @@
syntax = "proto3";
package live.xanchor.v1;
option go_package = "v1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message ExpData {
int64 level = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 next_level = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 level_color = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 exp = 4 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 current_level_exp = 5 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 next_level_exp = 6 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
}
message TagData {
int64 tag_id = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_type = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_value = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string tag_attribute = 4 [(gogoproto.moretags) = "validate:\"required\""];
}
message RoomData {
int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 short_id = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string title = 4 [(gogoproto.moretags) = "validate:\"required\""];
string cover = 5;
string tags = 6;
string background = 7;
string description = 8;
int64 live_status = 9 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 live_start_time = 10 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 live_screen_type = 11 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 live_mark = 12;
int64 lock_status = 13;
int64 lock_time = 14;
int64 hidden_status = 15 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 hidden_time = 16;
int64 area_id = 17 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string area_name = 18 [(gogoproto.moretags) = "validate:\"required\""];
int64 parent_area_id = 19 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string parent_area_name = 20 [(gogoproto.moretags) = "validate:\"required\""];
string keyframe = 21;
int64 popularity_count = 22;
repeated TagData room_tag_list = 23;
repeated TagData anchor_tag_list = 24;
int64 anchor_profile_type = 25;
repeated ExpData anchor_exp = 26;
int64 anchor_round_switch = 27;
int64 anchor_round_status = 28;
int64 anchor_record_switch = 29;
int64 anchor_record_status = 30;
int64 anchor_san = 31;
int64 live_type = 32;
}
message RoomByIDsReq {
repeated int64 room_ids = 1;
repeated int64 uids = 2;
repeated string fields = 3;
int64 default_fields = 4;
}
message RoomByIDsResp {
map<int64, RoomData> room_data_set = 1;
}
message RoomOnlineListReq {
string filter = 1;
string sort = 2;
int64 page = 3;
int64 page_size = 4;
repeated string fields = 5;
}
message RoomOnlineListResp {
map<int64, RoomData> room_data_list = 1;
}
message RoomCreateReq {
int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 room_id = 2;
}
message RoomCreateResp {
int64 room_id = 1;
}
message UpdateResp {
int64 affected_rows = 1;
}
message RoomUpdateReq {
repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string title = 3;
string cover = 4;
string tags = 5;
string background = 6;
string description = 7;
int64 live_start_time = 8;
int64 live_screen_type = 9;
int64 lock_status = 10;
int64 lock_time = 11;
int64 hidden_time = 12;
int64 area_id = 13;
int64 anchor_round_switch = 14;
int64 anchor_record_switch = 15;
int64 live_type = 16;
}
message RoomBatchUpdateReq {
repeated RoomUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}
message AnchorData {
int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 profile_type = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
repeated ExpData exp = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
}
message AnchorUpdateReq {
repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
int64 uid = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 profile_type = 3;
int64 san_score = 4;
int64 round_status = 5;
int64 record_status = 6;
int64 exp = 7;
}
message AnchorBatchUpdateReq {
repeated AnchorUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}
message AnchorIncreReq {
string req_id = 1 [(gogoproto.moretags) = "validate:\"required\""];
repeated string fields = 2 [(gogoproto.moretags) = "validate:\"required\""];
int64 uid = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 san_score = 4;
int64 exp = 5;
}
message AnchorBatchIncreReq {
repeated AnchorIncreReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}
message RoomExtendUpdateReq {
repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string key_frame = 3;
int64 danmu_count = 4;
int64 popularity_count = 5;
int64 audience_count = 6;
int64 gift_count = 7;
int64 gift_gold_amount = 8;
int64 gift_gold_count = 9;
}
message RoomExtendBatchUpdateReq {
repeated RoomExtendUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}
message RoomExtendIncreReq {
string req_id = 1 [(gogoproto.moretags) = "validate:\"required\""];
repeated string fields = 2 [(gogoproto.moretags) = "validate:\"required\""];
int64 room_id = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 danmu_count = 4;
int64 popularity_count = 5;
int64 audience_count = 6;
int64 gift_count = 7;
int64 gift_gold_amount = 8;
int64 gift_gold_count = 9;
}
message RoomExtendBatchIncreReq {
repeated RoomExtendIncreReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}
message RoomTagSetReq {
repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_type = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_value = 4;
string tag_attribute = 5;
int64 tag_expire_at = 6;
}
message AnchorTagSetReq {
repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
int64 anchor_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_type = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 tag_value = 4;
string tag_attribute = 5;
int64 tag_expire_at = 6;
}
service XAnchor {
// FetchRoomByIDs 查询房间信息
rpc FetchRoomByIDs(RoomByIDsReq) returns (RoomByIDsResp);
// RoomOnlineList 在线房间列表
rpc RoomOnlineList(RoomOnlineListReq) returns (RoomOnlineListResp);
// RoomCreate 房间创建
rpc RoomCreate(RoomCreateReq) returns (RoomCreateResp);
// RoomUpdate 房间信息更新
rpc RoomUpdate(RoomUpdateReq) returns (UpdateResp);
// RoomBatchUpdate 房间信息批量更新
rpc RoomBatchUpdate(RoomBatchUpdateReq) returns (UpdateResp);
// RoomExtendUpdate 房间扩展信息更新
rpc RoomExtendUpdate(RoomExtendUpdateReq) returns (UpdateResp);
// RoomExtendBatchUpdate 房间扩展信息批量更新
rpc RoomExtendBatchUpdate(RoomExtendBatchUpdateReq) returns (UpdateResp);
// RoomExtendIncre 房间信息增量更新
rpc RoomExtendIncre(RoomExtendIncreReq) returns (UpdateResp);
// RoomExtendBatchIncre 房间信息批量增量更新
rpc RoomExtendBatchIncre(RoomExtendBatchIncreReq) returns (UpdateResp);
// RoomTagSet 房间Tag更新
rpc RoomTagSet(RoomTagSetReq) returns (UpdateResp);
// AnchorUpdate 主播信息更新
rpc AnchorUpdate(AnchorUpdateReq) returns (UpdateResp);
// AnchorBatchUpdate 主播信息批量更新
rpc AnchorBatchUpdate(AnchorBatchUpdateReq) returns (UpdateResp);
// AnchorIncre 主播信息增量更新
rpc AnchorIncre(AnchorIncreReq) returns (UpdateResp);
// AnchorBatchIncre 主播信息批量增量更新
rpc AnchorBatchIncre(AnchorBatchIncreReq) returns (UpdateResp);
// AnchorTagSet 主播Tag更新
rpc AnchorTagSet(AnchorTagSetReq) returns (UpdateResp);
}

View File

@@ -0,0 +1,556 @@
## FetchRoomByIDs 查询房间信息
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/FetchRoomByIDs`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|room_ids|否|多个integer||
|uids|否|多个integer||
|fields|否|多个string||
|default_fields|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"room_data_set": {
"1": {
"uid": 0,
"room_id": 0,
"short_id": 0,
"title": "",
"cover": "",
"tags": "",
"background": "",
"description": "",
"live_status": 0,
"live_start_time": 0,
"live_screen_type": 0,
"live_mark": 0,
"lock_status": 0,
"lock_time": 0,
"hidden_status": 0,
"hidden_time": 0,
"area_id": 0,
"area_name": "",
"parent_area_id": 0,
"parent_area_name": "",
"keyframe": "",
"popularity_count": 0,
"room_tag_list": [
{
"tag_id": 0,
"tag_type": 0,
"tag_value": 0,
"tag_attribute": ""
}
],
"anchor_tag_list": [
{
"tag_id": 0,
"tag_type": 0,
"tag_value": 0,
"tag_attribute": ""
}
],
"anchor_profile_type": 0,
"anchor_exp": [
{
"level": 0,
"next_level": 0,
"level_color": 0,
"exp": 0,
"current_level_exp": 0,
"next_level_exp": 0
}
],
"anchor_round_switch": 0,
"anchor_round_status": 0,
"anchor_record_switch": 0,
"anchor_record_status": 0,
"anchor_san": 0,
"live_type": 0
}
}
}
}
```
## RoomOnlineList 在线房间列表
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomOnlineList`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|filter|否|string||
|sort|否|string||
|page|否|integer||
|page_size|否|integer||
|fields|否|多个string||
```json
{
"code": 0,
"message": "ok",
"data": {
"room_data_list": {
"1": {
"uid": 0,
"room_id": 0,
"short_id": 0,
"title": "",
"cover": "",
"tags": "",
"background": "",
"description": "",
"live_status": 0,
"live_start_time": 0,
"live_screen_type": 0,
"live_mark": 0,
"lock_status": 0,
"lock_time": 0,
"hidden_status": 0,
"hidden_time": 0,
"area_id": 0,
"area_name": "",
"parent_area_id": 0,
"parent_area_name": "",
"keyframe": "",
"popularity_count": 0,
"room_tag_list": [
{
"tag_id": 0,
"tag_type": 0,
"tag_value": 0,
"tag_attribute": ""
}
],
"anchor_tag_list": [
{
"tag_id": 0,
"tag_type": 0,
"tag_value": 0,
"tag_attribute": ""
}
],
"anchor_profile_type": 0,
"anchor_exp": [
{
"level": 0,
"next_level": 0,
"level_color": 0,
"exp": 0,
"current_level_exp": 0,
"next_level_exp": 0
}
],
"anchor_round_switch": 0,
"anchor_round_status": 0,
"anchor_record_switch": 0,
"anchor_record_status": 0,
"anchor_san": 0,
"live_type": 0
}
}
}
}
```
## RoomCreate 房间创建
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomCreate`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|是|integer||
|room_id|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"room_id": 0
}
}
```
## RoomUpdate 房间信息更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomUpdate`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|fields|是|多个string||
|room_id|是|integer||
|title|否|string||
|cover|否|string||
|tags|否|string||
|background|否|string||
|description|否|string||
|live_start_time|否|integer||
|live_screen_type|否|integer||
|lock_status|否|integer||
|lock_time|否|integer||
|hidden_time|否|integer||
|area_id|否|integer||
|anchor_round_switch|否|integer||
|anchor_record_switch|否|integer||
|live_type|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomBatchUpdate 房间信息批量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomBatchUpdate`
### 请求参数
```json
{
"reqs": [
{
"fields": [
""
],
"room_id": 0,
"title": "",
"cover": "",
"tags": "",
"background": "",
"description": "",
"live_start_time": 0,
"live_screen_type": 0,
"lock_status": 0,
"lock_time": 0,
"hidden_time": 0,
"area_id": 0,
"anchor_round_switch": 0,
"anchor_record_switch": 0,
"live_type": 0
}
]
}
```
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomExtendUpdate 房间扩展信息更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomExtendUpdate`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|fields|是|多个string||
|room_id|是|integer||
|key_frame|否|string||
|danmu_count|否|integer||
|popularity_count|否|integer||
|audience_count|否|integer||
|gift_count|否|integer||
|gift_gold_amount|否|integer||
|gift_gold_count|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomExtendBatchUpdate 房间扩展信息批量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomExtendBatchUpdate`
### 请求参数
```json
{
"reqs": [
{
"fields": [
""
],
"room_id": 0,
"key_frame": "",
"danmu_count": 0,
"popularity_count": 0,
"audience_count": 0,
"gift_count": 0,
"gift_gold_amount": 0,
"gift_gold_count": 0
}
]
}
```
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomExtendIncre 房间信息增量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomExtendIncre`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|req_id|是|string||
|fields|是|多个string||
|room_id|是|integer||
|danmu_count|否|integer||
|popularity_count|否|integer||
|audience_count|否|integer||
|gift_count|否|integer||
|gift_gold_amount|否|integer||
|gift_gold_count|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomExtendBatchIncre 房间信息批量增量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomExtendBatchIncre`
### 请求参数
```json
{
"reqs": [
{
"req_id": "",
"fields": [
""
],
"room_id": 0,
"danmu_count": 0,
"popularity_count": 0,
"audience_count": 0,
"gift_count": 0,
"gift_gold_amount": 0,
"gift_gold_count": 0
}
]
}
```
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## RoomTagSet 房间Tag更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/RoomTagSet`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|fields|是|多个string||
|room_id|是|integer||
|tag_type|是|integer||
|tag_value|否|integer||
|tag_attribute|否|string||
|tag_expire_at|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## AnchorUpdate 主播信息更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/AnchorUpdate`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|fields|是|多个string||
|uid|是|integer||
|profile_type|否|integer||
|san_score|否|integer||
|round_status|否|integer||
|record_status|否|integer||
|exp|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## AnchorBatchUpdate 主播信息批量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/AnchorBatchUpdate`
### 请求参数
```json
{
"reqs": [
{
"fields": [
""
],
"uid": 0,
"profile_type": 0,
"san_score": 0,
"round_status": 0,
"record_status": 0,
"exp": 0
}
]
}
```
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## AnchorIncre 主播信息增量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/AnchorIncre`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|req_id|是|string||
|fields|是|多个string||
|uid|是|integer||
|san_score|否|integer||
|exp|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## AnchorBatchIncre 主播信息批量增量更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/AnchorBatchIncre`
### 请求参数
```json
{
"reqs": [
{
"req_id": "",
"fields": [
""
],
"uid": 0,
"san_score": 0,
"exp": 0
}
]
}
```
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```
## AnchorTagSet 主播Tag更新
`GET http://api.live.bilibili.com/xlive/xanchor/v1/xAnchor/AnchorTagSet`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|fields|是|多个string||
|anchor_id|是|integer||
|tag_type|是|integer||
|tag_value|否|integer||
|tag_attribute|否|string||
|tag_expire_at|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"affected_rows": 0
}
}
```

View File

@@ -0,0 +1,27 @@
package v1
import (
"context"
"google.golang.org/grpc"
"go-common/library/net/rpc/warden"
)
const AppID = "live.xanchor"
type Client struct {
XAnchorClient
}
// NewClient new anchor grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (*Client, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
if err != nil {
return nil, err
}
cli := &Client{}
cli.XAnchorClient = NewXAnchorClient(conn)
return cli, nil
}