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 = ["roomNotice.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/xuserex/api/grpc/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"roomNotice.bm.go",
],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/live/xuserex/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,29 @@
package v1
import (
"context"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
// AppID unique app id for service discovery
const AppID = "live.xuserex"
// Client client
type Client struct {
RoomNoticeClient
}
// NewClient new resource 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.RoomNoticeClient = NewRoomNoticeClient(conn)
return cli, nil
}

View File

@@ -0,0 +1,80 @@
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: roomNotice.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:
roomNotice.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
var PathRoomNoticeBuyGuard = "/live.xuserex.v1.RoomNotice/buy_guard"
var PathRoomNoticeIsTaskFinish = "/live.xuserex.v1.RoomNotice/is_task_finish"
var PathRoomNoticeSetTaskFinish = "/live.xuserex.v1.RoomNotice/set_task_finish"
// ====================
// RoomNotice Interface
// ====================
// 房间提示 相关服务
type RoomNoticeBMServer interface {
// 是否弹出大航海购买提示
BuyGuard(ctx context.Context, req *RoomNoticeBuyGuardReq) (resp *RoomNoticeBuyGuardResp, err error)
// habse 任务是否结束
IsTaskFinish(ctx context.Context, req *RoomNoticeIsTaskFinishReq) (resp *RoomNoticeIsTaskFinishResp, err error)
// 手动设置base 任务结束
SetTaskFinish(ctx context.Context, req *RoomNoticeSetTaskFinishReq) (resp *RoomNoticeSetTaskFinishResp, err error)
}
var v1RoomNoticeSvc RoomNoticeBMServer
func roomNoticeBuyGuard(c *bm.Context) {
p := new(RoomNoticeBuyGuardReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1RoomNoticeSvc.BuyGuard(c, p)
c.JSON(resp, err)
}
func roomNoticeIsTaskFinish(c *bm.Context) {
p := new(RoomNoticeIsTaskFinishReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1RoomNoticeSvc.IsTaskFinish(c, p)
c.JSON(resp, err)
}
func roomNoticeSetTaskFinish(c *bm.Context) {
p := new(RoomNoticeSetTaskFinishReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1RoomNoticeSvc.SetTaskFinish(c, p)
c.JSON(resp, err)
}
// RegisterRoomNoticeBMServer Register the blademaster route
func RegisterRoomNoticeBMServer(e *bm.Engine, server RoomNoticeBMServer) {
v1RoomNoticeSvc = server
e.GET("/live.xuserex.v1.RoomNotice/buy_guard", roomNoticeBuyGuard)
e.GET("/live.xuserex.v1.RoomNotice/is_task_finish", roomNoticeIsTaskFinish)
e.GET("/live.xuserex.v1.RoomNotice/set_task_finish", roomNoticeSetTaskFinish)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
syntax = "proto3";
package live.xuserex.v1;
option go_package = "v1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// 房间提示 相关服务
service RoomNotice {
// 是否弹出大航海购买提示
rpc buy_guard (RoomNoticeBuyGuardReq) returns (RoomNoticeBuyGuardResp);
// habse 任务是否结束
rpc is_task_finish (RoomNoticeIsTaskFinishReq) returns (RoomNoticeIsTaskFinishResp);
// 手动设置base 任务结束
rpc set_task_finish (RoomNoticeSetTaskFinishReq) returns (RoomNoticeSetTaskFinishResp);
}
message RoomNoticeBuyGuardReq {
// UID
int64 uid = 1 [(gogoproto.moretags) = 'form:"uid" validate:"required"'];
// 主播UID
int64 target_id = 2 [(gogoproto.moretags) = 'form:"target_id" validate:"required"'];
}
message RoomNoticeIsTaskFinishReq {
}
message RoomNoticeSetTaskFinishReq {
// 是否完成
int64 result = 1 [(gogoproto.moretags) = 'form:"result"'];
}
message RoomNoticeBuyGuardResp {
// 是否提示 1:弹出提示,0:不弹出
int64 should_notice = 1;
// 状态有效开始时间
int64 begin = 2;
// 状态有效结束时间
int64 end = 3;
// 当前的时间戳
int64 now = 7;
// 标题
string title = 4;
// 内容
string content = 5;
// 按钮
string button = 6;
}
message RoomNoticeIsTaskFinishResp {
// 是否完成
int64 result = 1;
}
message RoomNoticeSetTaskFinishResp {
// 是否完成
int64 result = 1;
}

View File

@@ -0,0 +1,89 @@
<!-- package=live.xuserex.v1 -->
- [/live.xuserex.v1.RoomNotice/buy_guard](#live.xuserex.v1.RoomNoticebuy_guard) 是否弹出大航海购买提示
- [/live.xuserex.v1.RoomNotice/is_task_finish](#live.xuserex.v1.RoomNoticeis_task_finish) habse 任务是否结束
- [/live.xuserex.v1.RoomNotice/set_task_finish](#live.xuserex.v1.RoomNoticeset_task_finish) 手动设置base 任务结束
## /live.xuserex.v1.RoomNotice/buy_guard
### 是否弹出大航海购买提示
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|是|integer| UID|
|target_id|是|integer| 主播UID|
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
// 是否提示 1:弹出提示,0:不弹出
"should_notice": 0,
// 状态有效开始时间
"begin": 0,
// 状态有效结束时间
"end": 0,
// 当前的时间戳
"now": 0,
// 标题
"title": "",
// 内容
"content": "",
// 按钮
"button": ""
}
}
```
## /live.xuserex.v1.RoomNotice/is_task_finish
### habse 任务是否结束
#### 方法GET
#### 请求参数
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
// 是否完成
"result": 0
}
}
```
## /live.xuserex.v1.RoomNotice/set_task_finish
### 手动设置base 任务结束
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|result|否|integer| 是否完成|
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
// 是否完成
"result": 0
}
}
```

View File

@@ -0,0 +1 @@
# HTTP API文档