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/gift/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/gift/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,88 @@
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: 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.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 PathGiftRoomGiftList = "/live.xgift.v1.Gift/room_gift_list"
var PathGiftGiftConfig = "/live.xgift.v1.Gift/gift_config"
var PathGiftDiscountGiftList = "/live.xgift.v1.Gift/discount_gift_list"
var PathGiftDailyBag = "/live.xgift.v1.Gift/daily_bag"
// ==============
// Gift Interface
// ==============
type GiftBMServer interface {
RoomGiftList(ctx context.Context, req *RoomGiftListReq) (resp *RoomGiftListResp, err error)
GiftConfig(ctx context.Context, req *GiftConfigReq) (resp *GiftConfigResp, err error)
DiscountGiftList(ctx context.Context, req *DiscountGiftListReq) (resp *DiscountGiftListResp, err error)
DailyBag(ctx context.Context, req *DailyBagReq) (resp *DailyBagResp, err error)
}
var v1GiftSvc GiftBMServer
func giftRoomGiftList(c *bm.Context) {
p := new(RoomGiftListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.RoomGiftList(c, p)
c.JSON(resp, err)
}
func giftGiftConfig(c *bm.Context) {
p := new(GiftConfigReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.GiftConfig(c, p)
c.JSON(resp, err)
}
func giftDiscountGiftList(c *bm.Context) {
p := new(DiscountGiftListReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.DiscountGiftList(c, p)
c.JSON(resp, err)
}
func giftDailyBag(c *bm.Context) {
p := new(DailyBagReq)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1GiftSvc.DailyBag(c, p)
c.JSON(resp, err)
}
// RegisterGiftBMServer Register the blademaster route
func RegisterGiftBMServer(e *bm.Engine, server GiftBMServer) {
e.GET("/live.xgift.v1.Gift/room_gift_list", giftRoomGiftList)
e.GET("/live.xgift.v1.Gift/gift_config", giftGiftConfig)
e.GET("/live.xgift.v1.Gift/discount_gift_list", giftDiscountGiftList)
e.GET("/live.xgift.v1.Gift/daily_bag", giftDailyBag)
}

View File

@@ -0,0 +1,216 @@
<!-- package=live.xgift.v1 -->
- [/live.xgift.v1.Gift/room_gift_list](#live.xgift.v1.Giftroom_gift_list)
- [/live.xgift.v1.Gift/gift_config](#live.xgift.v1.Giftgift_config)
- [/live.xgift.v1.Gift/discount_gift_list](#live.xgift.v1.Giftdiscount_gift_list)
- [/live.xgift.v1.Gift/daily_bag](#live.xgift.v1.Giftdaily_bag)
## /live.xgift.v1.Gift/room_gift_list
### 无标题
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|room_id|否|integer||
|area_v2_parent_id|否|integer||
|area_v2_id|否|integer||
|platform|否|string||
|build|否|integer||
|mobi_app|否|string||
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
"list": [
{
"id": 0,
"position": 0,
"plan_id": 0
}
],
"silver_list": [
{
"id": 0,
"position": 0,
"plan_id": 0
}
],
"show_count_map": 0,
"old_list": [
{
"id": 0,
"name": "",
"price": 0,
"type": 0,
"coin_type": {
"mapKey": ""
},
"img": "",
"gift_url": "",
"count_set": "",
"combo_num": 0,
"super_num": 0,
"count_map": {
"1": ""
}
}
]
}
}
```
## /live.xgift.v1.Gift/gift_config
### 无标题
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|platform|否|string||
|build|否|integer||
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
"data": [
{
"id": 0,
"name": "",
"price": 0,
"type": 0,
"coin_type": "",
"bag_gift": 0,
"effect": 0,
"corner_mark": "",
"broadcast": 0,
"draw": 0,
"stay_time": 0,
"animation_frame_num": 0,
"desc": "",
"rule": "",
"rights": "",
"privilege_required": 0,
"count_map": [
{
"num": 0,
"text": ""
}
],
"img_basic": "",
"img_dynamic": "",
"frame_animation": "",
"gif": "",
"webp": "",
"full_sc_web": "",
"full_sc_horizontal": "",
"full_sc_vertical": "",
"full_sc_horizontal_svga": "",
"full_sc_vertical_svga": "",
"bullet_head": "",
"bullet_tail": "",
"limit_interval": 0
}
]
}
}
```
## /live.xgift.v1.Gift/discount_gift_list
### 无标题
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|否|integer||
|roomid|否|integer||
|area_v2_parent_id|否|integer||
|area_v2_id|否|integer||
|platform|否|string||
|ruid|否|integer||
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
"discount_list": [
{
"gift_id": 0,
"price": 0,
"discount_price": 0,
"corner_mark": "",
"corner_position": 0,
"corner_color": ""
}
]
}
}
```
## /live.xgift.v1.Gift/daily_bag
### 无标题
#### 方法GET
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|否|integer||
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
"bag_status": 0,
"bag_expire_status": 0,
"bag_toast": {
"toast_status": 0,
"toast_message": ""
},
"bag_list": [
{
"type": 0,
"bag_name": "",
"source": {
"medal_id": 0,
"medal_name": "",
"level": 0,
"user_level": 0
},
"gift_list": [
{
"gift_id": "",
"gift_num": 0,
"expire_at": 0
}
]
}
]
}
}
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
syntax = "proto3";
package live.xgift.v1;
option go_package = "v1";
option (gogoproto.goproto_getters_all) = false;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Gift{
rpc room_gift_list(RoomGiftListReq) returns (RoomGiftListResp);
rpc gift_config(GiftConfigReq) returns (GiftConfigResp);
rpc discount_gift_list(DiscountGiftListReq) returns (DiscountGiftListResp);
rpc daily_bag(DailyBagReq) returns (DailyBagResp);
}
message RoomGiftListReq{
int64 room_id = 1;
int64 area_v2_parent_id = 2;
int64 area_v2_id = 3;
string platform = 4;
int64 build = 5;
string mobi_app = 6;
}
message RoomGiftListResp{
repeated List list = 1 [(gogoproto.jsontag)="list"];
message List{
int64 id = 1 [(gogoproto.jsontag)="id"];
int64 position = 2 [(gogoproto.jsontag)="position"];
int64 plan_id = 3 [(gogoproto.jsontag)="plan_id"];
}
repeated List silver_list = 2 [(gogoproto.jsontag)="silver_list"];
int64 show_count_map = 3 [(gogoproto.jsontag)="show_count_map"];
repeated OldList old_list = 4 [(gogoproto.jsontag)="old_list"];
message OldList{
int64 id = 1 [(gogoproto.jsontag)="id"];
string name = 2 [(gogoproto.jsontag)="name"];
int64 price = 3 [(gogoproto.jsontag)="price"];
int64 type = 4 [(gogoproto.jsontag)="type"];
map<string, string> coin_type=5 [(gogoproto.jsontag)="coin_type"];
string img = 6 [(gogoproto.jsontag)="img"];
string gift_url = 7 [(gogoproto.jsontag)="gift_url"];
string count_set = 8 [(gogoproto.jsontag)="count_set"];
int64 combo_num = 9 [(gogoproto.jsontag)="combo_num"];
int64 super_num = 10 [(gogoproto.jsontag)="super_num"];
map<int64, string> count_map = 11 [(gogoproto.jsontag)="count_map"];
}
}
message GiftConfigReq{
string platform = 1;
int64 build = 2;
}
message GiftConfigResp{
repeated Config data = 1 [(gogoproto.jsontag)="data"];
message Config{
int64 id = 1 [(gogoproto.jsontag)="id"];
string name = 2 [(gogoproto.jsontag)="name"];
int64 price = 3 [(gogoproto.jsontag)="price"];
int64 type = 4 [(gogoproto.jsontag)="type"];
string coin_type = 5 [(gogoproto.jsontag)="coin_type"];
int64 bag_gift = 6 [(gogoproto.jsontag)="bag_gift"];
int64 effect = 7 [(gogoproto.jsontag)="effect"];
string corner_mark = 8 [(gogoproto.jsontag)="corner_mark"];
int64 broadcast = 9 [(gogoproto.jsontag)="broadcast"];
int64 draw = 10 [(gogoproto.jsontag)="draw"];
int64 stay_time = 11 [(gogoproto.jsontag)="stay_time"];
int64 animation_frame_num = 12 [(gogoproto.jsontag)="animation_frame_num"];
string desc = 13 [(gogoproto.jsontag)="desc"];
string rule = 14 [(gogoproto.jsontag)="rule"];
string rights = 15 [(gogoproto.jsontag)="rights"];
int64 privilege_required = 16 [(gogoproto.jsontag)="privilege_required"];
repeated CountMap count_map = 17 [(gogoproto.jsontag)="count_map"];
string img_basic = 18 [(gogoproto.jsontag)="img_basic"];
string img_dynamic = 19 [(gogoproto.jsontag)="img_dynamic"];
string frame_animation = 20 [(gogoproto.jsontag)="frame_animation"];
string gif = 21 [(gogoproto.jsontag)="gif"];
string webp = 22 [(gogoproto.jsontag)="webp"];
string full_sc_web = 23 [(gogoproto.jsontag)="full_sc_web"];
string full_sc_horizontal = 24 [(gogoproto.jsontag)="full_sc_horizontal"];
string full_sc_vertical = 25 [(gogoproto.jsontag)="full_sc_vertical"];
string full_sc_horizontal_svga = 26 [(gogoproto.jsontag)="full_sc_horizontal_svga"];
string full_sc_vertical_svga = 27 [(gogoproto.jsontag)="full_sc_vertical_svga"];
string bullet_head = 28 [(gogoproto.jsontag)="bullet_head"];
string bullet_tail = 29 [(gogoproto.jsontag)="bullet_tail"];
int64 limit_interval = 30 [(gogoproto.jsontag)="limit_interval"];
}
message CountMap{
int64 num = 1 [(gogoproto.jsontag)="num"];
string text = 2 [(gogoproto.jsontag)="text"];
}
}
message DiscountGiftListReq{
int64 uid=1;
int64 roomid=2;
int64 area_v2_parent_id=3;
int64 area_v2_id=4;
string platform=5;
int64 ruid=6;
}
message DiscountGiftListResp{
repeated GiftInfo discount_list = 1;
message GiftInfo{
int64 gift_id=1 [(gogoproto.jsontag)="gift_id"];
int64 price=2 [(gogoproto.jsontag)="price"];
int64 discount_price=3 [(gogoproto.jsontag)="discount_price"];
string corner_mark=4 [(gogoproto.jsontag)="corner_mark"];
int64 corner_position=5 [(gogoproto.jsontag)="corner_position"];
string corner_color=6 [(gogoproto.jsontag)="corner_color"];
}
}
message DailyBagReq{
int64 uid = 1;
}
message DailyBagResp{
int64 bag_status=1 [(gogoproto.jsontag)="bag_status"];
int64 bag_expire_status=2 [(gogoproto.jsontag)="bag_expire_status"];
BagToast bag_toast = 3 [(gogoproto.jsontag)="bag_toast"];
message BagToast{
int64 toast_status=1 [(gogoproto.jsontag)="toast_status"];
string toast_message=2 [(gogoproto.jsontag)="toast_message"];
}
repeated BagList bag_list = 4 [(gogoproto.jsontag)="bag_list"];
message BagList{
int64 type=1 [(gogoproto.jsontag)="type"];
string bag_name=2 [(gogoproto.jsontag)="bag_name"];
Source source = 3 [(gogoproto.jsontag)="source"];
message Source{
int64 medal_id = 1 [(gogoproto.jsontag)="medal_id"];
string medal_name = 2 [(gogoproto.jsontag)="medal_name"];
int64 level = 3 [(gogoproto.jsontag)="level"];
int64 user_level = 4 [(gogoproto.jsontag)="user_level"];
}
repeated GiftList gift_list = 4 [(gogoproto.jsontag)="gift_list"];
message GiftList{
string gift_id=1 [(gogoproto.jsontag)="gift_id"];
int64 gift_num=2 [(gogoproto.jsontag)="gift_num"];
int64 expire_at=3 [(gogoproto.jsontag)="expire_at"];
}
}
}

View File

@@ -0,0 +1,24 @@
package v1
import (
"context"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
// AppID unique app id for service discovery
const AppID = "live.xgift"
// NewClient new member grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (GiftClient, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
//conn, err := client.Dial(context.Background(), "127.0.0.1:9000")
if err != nil {
return nil, err
}
return NewGiftClient(conn), nil
}

View File

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

View File

@@ -0,0 +1,187 @@
##
`GET http://api.live.bilibili.com/xlive/gift/v1/gift/room_gift_list`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|room_id|否|integer||
|area_v2_parent_id|否|integer||
|area_v2_id|否|integer||
|platform|否|string||
|build|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"list": [
{
"id": 0,
"position": 0,
"plan_id": 0
}
],
"silver_list": [
{
"id": 0,
"position": 0,
"plan_id": 0
}
],
"show_count_map": 0,
"old_list": [
{
"id": 0,
"name": "",
"price": 0,
"type": 0,
"coin_type": {
"mapKey": ""
},
"img": "",
"gift_url": "",
"count_set": "",
"combo_num": 0,
"super_num": 0,
"count_map": {
"1": ""
}
}
]
}
}
```
##
`GET http://api.live.bilibili.com/xlive/gift/v1/gift/gift_config`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|platform|否|string||
|build|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"data": [
{
"id": 0,
"name": "",
"price": 0,
"type": 0,
"coin_type": "",
"bag_gift": 0,
"effect": 0,
"corner_mark": "",
"broadcast": 0,
"draw": 0,
"stay_time": 0,
"animation_frame_num": 0,
"desc": "",
"rule": "",
"rights": "",
"privilege_required": 0,
"count_map": [
{
"num": 0,
"text": ""
}
],
"img_basic": "",
"img_dynamic": "",
"frame_animation": "",
"gif": "",
"webp": "",
"full_sc_web": "",
"full_sc_horizontal": "",
"full_sc_vertical": "",
"full_sc_horizontal_svga": "",
"full_sc_vertical_svga": "",
"bullet_head": "",
"bullet_tail": ""
}
]
}
}
```
##
`GET http://api.live.bilibili.com/xlive/gift/v1/gift/discount_gift_list`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|否|integer||
|roomid|否|integer||
|area_v2_parent_id|否|integer||
|area_v2_id|否|integer||
|platform|否|string||
|ruid|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"discount_list": [
{
"gift_id": 0,
"price": 0,
"discount_price": 0,
"corner_mark": "",
"corner_position": 0,
"corner_color": ""
}
]
}
}
```
##
`GET http://api.live.bilibili.com/xlive/gift/v1/gift/daily_bag`
### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|uid|否|integer||
```json
{
"code": 0,
"message": "ok",
"data": {
"bag_status": 0,
"bag_expire_status": 0,
"bag_toast": {
"toast_status": 0,
"toast_message": ""
},
"bag_list": [
{
"type": 0,
"bag_name": "",
"gift_list": [
{
"gift_id": 0,
"gift_num": 0,
"expire_at": 0
}
]
}
]
}
}
```

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/gift/api/liverpc",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/live/gift/api/liverpc/v0:go_default_library",
"//app/service/live/gift/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/gift/api/liverpc/v0:all-srcs",
"//app/service/live/gift/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/gift/api/liverpc/v0"
"go-common/app/service/live/gift/api/liverpc/v1"
"go-common/library/net/rpc/liverpc"
)
// Client that represents a liverpc gift service api
type Client struct {
cli *liverpc.Client
// V0Smalltv presents the controller in liverpc
V0Smalltv v0.Smalltv
// V1Gift presents the controller in liverpc
V1Gift v1.Gift
}
// DiscoveryAppId the discovery id is not the tree name
var DiscoveryAppId = "live.gift"
// New a Client that represents a liverpc live.gift 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.V0Smalltv = v0.NewSmalltvRpcClient(realCli)
cli.V1Gift = v1.NewGiftRpcClient(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 = ["Smalltv.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/gift/api/liverpc/v0",
proto = ":v0_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["Smalltv.liverpc.go"],
embed = [":v0_go_proto"],
importpath = "go-common/app/service/live/gift/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,63 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v0/Smalltv.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/Smalltv.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:
// =================
// Smalltv Interface
// =================
type Smalltv interface {
// * 开启抽奖的内部接口
// 返回的是广播的内容列表
Start(context.Context, *SmalltvStartReq) (*SmalltvStartResp, error)
}
// =======================
// Smalltv Live Rpc Client
// =======================
type smalltvRpcClient struct {
client *liverpc.Client
}
// NewSmalltvRpcClient creates a Rpc client that implements the Smalltv interface.
// It communicates using Rpc and can be configured with a custom HTTPClient.
func NewSmalltvRpcClient(client *liverpc.Client) Smalltv {
return &smalltvRpcClient{
client: client,
}
}
func (c *smalltvRpcClient) Start(ctx context.Context, in *SmalltvStartReq) (*SmalltvStartResp, error) {
out := new(SmalltvStartResp)
err := doRpcRequest(ctx, c.client, 0, "Smalltv.start", 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,68 @@
syntax = "proto3";
package gift.v0;
option go_package = "v0";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Smalltv {
/** 开启抽奖的内部接口
* 返回的是广播的内容列表
*/
rpc start (SmalltvStartReq) returns (SmalltvStartResp);
}
message SmalltvStartReq {
// 用户id
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
// 房间号
int64 roomid = 2 [(gogoproto.jsontag) = "roomid"];
// 道具id
int64 gift_id = 3 [(gogoproto.jsontag) = "gift_id"];
// 道具个数
int64 num = 4 [(gogoproto.jsontag) = "num"];
// 业务id
int64 tid = 5 [(gogoproto.jsontag) = "tid"];
// 公告样式id
int64 style_id = 6 [(gogoproto.jsontag) = "style_id"];
}
message SmalltvStartResp {
//
int64 code = 1 [(gogoproto.jsontag) = "code"];
//
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
repeated MSG data = 3 [(gogoproto.jsontag) = "data"];
message MSG {
//
string cmd = 1 [(gogoproto.jsontag) = "cmd"];
//
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
string msg_text = 3 [(gogoproto.jsontag) = "msg_text"];
//
string msg_common = 4 [(gogoproto.jsontag) = "msg_common"];
//
string msg_self = 5 [(gogoproto.jsontag) = "msg_self"];
//
int64 rep = 6 [(gogoproto.jsontag) = "rep"];
//
int64 styleType = 7 [(gogoproto.jsontag) = "styleType"];
//
string url = 8 [(gogoproto.jsontag) = "url"];
//
int64 roomid = 9 [(gogoproto.jsontag) = "roomid"];
//
int64 real_roomid = 10 [(gogoproto.jsontag) = "real_roomid"];
//
int64 rnd = 11 [(gogoproto.jsontag) = "rnd"];
//
int64 broadcast_type = 12 [(gogoproto.jsontag) = "broadcast_type"];
}
}

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 = ["Gift.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/gift/api/liverpc/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["Gift.liverpc.go"],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/live/gift/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,63 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v1/Gift.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/Gift.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:
// ==============
// Gift Interface
// ==============
type Gift interface {
// * 增加包裹道具
//
AddFreeGift(context.Context, *GiftAddFreeGiftReq) (*GiftAddFreeGiftResp, error)
}
// ====================
// Gift Live Rpc Client
// ====================
type giftRpcClient struct {
client *liverpc.Client
}
// NewGiftRpcClient creates a Rpc client that implements the Gift interface.
// It communicates using Rpc and can be configured with a custom HTTPClient.
func NewGiftRpcClient(client *liverpc.Client) Gift {
return &giftRpcClient{
client: client,
}
}
func (c *giftRpcClient) AddFreeGift(ctx context.Context, in *GiftAddFreeGiftReq) (*GiftAddFreeGiftResp, error) {
out := new(GiftAddFreeGiftResp)
err := doRpcRequest(ctx, c.client, 1, "Gift.addFreeGift", 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
}

View File

@@ -0,0 +1,938 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v1/Gift.proto
package v1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type GiftAddFreeGiftReq struct {
// 用户uid
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid"`
// 礼物id
Giftid int64 `protobuf:"varint,2,opt,name=giftid,proto3" json:"giftid"`
// 数量
Num int64 `protobuf:"varint,3,opt,name=num,proto3" json:"num"`
// 过期时间
Expireat int64 `protobuf:"varint,4,opt,name=expireat,proto3" json:"expireat"`
//
Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code"`
//
Caller string `protobuf:"bytes,6,opt,name=caller,proto3" json:"caller"`
}
func (m *GiftAddFreeGiftReq) Reset() { *m = GiftAddFreeGiftReq{} }
func (m *GiftAddFreeGiftReq) String() string { return proto.CompactTextString(m) }
func (*GiftAddFreeGiftReq) ProtoMessage() {}
func (*GiftAddFreeGiftReq) Descriptor() ([]byte, []int) {
return fileDescriptor_Gift_7d77e02c48c2917b, []int{0}
}
func (m *GiftAddFreeGiftReq) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GiftAddFreeGiftReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GiftAddFreeGiftReq.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *GiftAddFreeGiftReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_GiftAddFreeGiftReq.Merge(dst, src)
}
func (m *GiftAddFreeGiftReq) XXX_Size() int {
return m.Size()
}
func (m *GiftAddFreeGiftReq) XXX_DiscardUnknown() {
xxx_messageInfo_GiftAddFreeGiftReq.DiscardUnknown(m)
}
var xxx_messageInfo_GiftAddFreeGiftReq proto.InternalMessageInfo
func (m *GiftAddFreeGiftReq) GetUid() int64 {
if m != nil {
return m.Uid
}
return 0
}
func (m *GiftAddFreeGiftReq) GetGiftid() int64 {
if m != nil {
return m.Giftid
}
return 0
}
func (m *GiftAddFreeGiftReq) GetNum() int64 {
if m != nil {
return m.Num
}
return 0
}
func (m *GiftAddFreeGiftReq) GetExpireat() int64 {
if m != nil {
return m.Expireat
}
return 0
}
func (m *GiftAddFreeGiftReq) GetCode() string {
if m != nil {
return m.Code
}
return ""
}
func (m *GiftAddFreeGiftReq) GetCaller() string {
if m != nil {
return m.Caller
}
return ""
}
type GiftAddFreeGiftResp struct {
//
Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code"`
//
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
//
Data *GiftAddFreeGiftResp_Data `protobuf:"bytes,3,opt,name=data" json:"data"`
}
func (m *GiftAddFreeGiftResp) Reset() { *m = GiftAddFreeGiftResp{} }
func (m *GiftAddFreeGiftResp) String() string { return proto.CompactTextString(m) }
func (*GiftAddFreeGiftResp) ProtoMessage() {}
func (*GiftAddFreeGiftResp) Descriptor() ([]byte, []int) {
return fileDescriptor_Gift_7d77e02c48c2917b, []int{1}
}
func (m *GiftAddFreeGiftResp) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GiftAddFreeGiftResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GiftAddFreeGiftResp.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *GiftAddFreeGiftResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_GiftAddFreeGiftResp.Merge(dst, src)
}
func (m *GiftAddFreeGiftResp) XXX_Size() int {
return m.Size()
}
func (m *GiftAddFreeGiftResp) XXX_DiscardUnknown() {
xxx_messageInfo_GiftAddFreeGiftResp.DiscardUnknown(m)
}
var xxx_messageInfo_GiftAddFreeGiftResp proto.InternalMessageInfo
func (m *GiftAddFreeGiftResp) GetCode() int64 {
if m != nil {
return m.Code
}
return 0
}
func (m *GiftAddFreeGiftResp) GetMsg() string {
if m != nil {
return m.Msg
}
return ""
}
func (m *GiftAddFreeGiftResp) GetData() *GiftAddFreeGiftResp_Data {
if m != nil {
return m.Data
}
return nil
}
type GiftAddFreeGiftResp_Data struct {
//
BagId int64 `protobuf:"varint,1,opt,name=bag_id,json=bagId,proto3" json:"bag_id"`
}
func (m *GiftAddFreeGiftResp_Data) Reset() { *m = GiftAddFreeGiftResp_Data{} }
func (m *GiftAddFreeGiftResp_Data) String() string { return proto.CompactTextString(m) }
func (*GiftAddFreeGiftResp_Data) ProtoMessage() {}
func (*GiftAddFreeGiftResp_Data) Descriptor() ([]byte, []int) {
return fileDescriptor_Gift_7d77e02c48c2917b, []int{1, 0}
}
func (m *GiftAddFreeGiftResp_Data) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *GiftAddFreeGiftResp_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_GiftAddFreeGiftResp_Data.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *GiftAddFreeGiftResp_Data) XXX_Merge(src proto.Message) {
xxx_messageInfo_GiftAddFreeGiftResp_Data.Merge(dst, src)
}
func (m *GiftAddFreeGiftResp_Data) XXX_Size() int {
return m.Size()
}
func (m *GiftAddFreeGiftResp_Data) XXX_DiscardUnknown() {
xxx_messageInfo_GiftAddFreeGiftResp_Data.DiscardUnknown(m)
}
var xxx_messageInfo_GiftAddFreeGiftResp_Data proto.InternalMessageInfo
func (m *GiftAddFreeGiftResp_Data) GetBagId() int64 {
if m != nil {
return m.BagId
}
return 0
}
func init() {
proto.RegisterType((*GiftAddFreeGiftReq)(nil), "gift.v1.GiftAddFreeGiftReq")
proto.RegisterType((*GiftAddFreeGiftResp)(nil), "gift.v1.GiftAddFreeGiftResp")
proto.RegisterType((*GiftAddFreeGiftResp_Data)(nil), "gift.v1.GiftAddFreeGiftResp.Data")
}
func (m *GiftAddFreeGiftReq) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GiftAddFreeGiftReq) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Uid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintGift(dAtA, i, uint64(m.Uid))
}
if m.Giftid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintGift(dAtA, i, uint64(m.Giftid))
}
if m.Num != 0 {
dAtA[i] = 0x18
i++
i = encodeVarintGift(dAtA, i, uint64(m.Num))
}
if m.Expireat != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintGift(dAtA, i, uint64(m.Expireat))
}
if len(m.Code) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintGift(dAtA, i, uint64(len(m.Code)))
i += copy(dAtA[i:], m.Code)
}
if len(m.Caller) > 0 {
dAtA[i] = 0x32
i++
i = encodeVarintGift(dAtA, i, uint64(len(m.Caller)))
i += copy(dAtA[i:], m.Caller)
}
return i, nil
}
func (m *GiftAddFreeGiftResp) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GiftAddFreeGiftResp) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Code != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintGift(dAtA, i, uint64(m.Code))
}
if len(m.Msg) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintGift(dAtA, i, uint64(len(m.Msg)))
i += copy(dAtA[i:], m.Msg)
}
if m.Data != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintGift(dAtA, i, uint64(m.Data.Size()))
n1, err := m.Data.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
return i, nil
}
func (m *GiftAddFreeGiftResp_Data) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *GiftAddFreeGiftResp_Data) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.BagId != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintGift(dAtA, i, uint64(m.BagId))
}
return i, nil
}
func encodeVarintGift(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *GiftAddFreeGiftReq) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Uid != 0 {
n += 1 + sovGift(uint64(m.Uid))
}
if m.Giftid != 0 {
n += 1 + sovGift(uint64(m.Giftid))
}
if m.Num != 0 {
n += 1 + sovGift(uint64(m.Num))
}
if m.Expireat != 0 {
n += 1 + sovGift(uint64(m.Expireat))
}
l = len(m.Code)
if l > 0 {
n += 1 + l + sovGift(uint64(l))
}
l = len(m.Caller)
if l > 0 {
n += 1 + l + sovGift(uint64(l))
}
return n
}
func (m *GiftAddFreeGiftResp) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Code != 0 {
n += 1 + sovGift(uint64(m.Code))
}
l = len(m.Msg)
if l > 0 {
n += 1 + l + sovGift(uint64(l))
}
if m.Data != nil {
l = m.Data.Size()
n += 1 + l + sovGift(uint64(l))
}
return n
}
func (m *GiftAddFreeGiftResp_Data) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.BagId != 0 {
n += 1 + sovGift(uint64(m.BagId))
}
return n
}
func sovGift(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozGift(x uint64) (n int) {
return sovGift(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *GiftAddFreeGiftReq) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GiftAddFreeGiftReq: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GiftAddFreeGiftReq: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType)
}
m.Uid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Uid |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Giftid", wireType)
}
m.Giftid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Giftid |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Num", wireType)
}
m.Num = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Num |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Expireat", wireType)
}
m.Expireat = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Expireat |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGift
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Code = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Caller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGift
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Caller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGift(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGift
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *GiftAddFreeGiftResp) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: GiftAddFreeGiftResp: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: GiftAddFreeGiftResp: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType)
}
m.Code = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Code |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGift
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Msg = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGift
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Data == nil {
m.Data = &GiftAddFreeGiftResp_Data{}
}
if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGift(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGift
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *GiftAddFreeGiftResp_Data) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Data: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BagId", wireType)
}
m.BagId = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGift
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BagId |= (int64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipGift(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGift
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGift(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGift
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGift
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGift
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthGift
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGift
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipGift(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthGift = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGift = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("v1/Gift.proto", fileDescriptor_Gift_7d77e02c48c2917b) }
var fileDescriptor_Gift_7d77e02c48c2917b = []byte{
// 365 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xbd, 0x6e, 0xe2, 0x40,
0x10, 0x66, 0xb1, 0x31, 0x30, 0xdc, 0x35, 0x7b, 0x8d, 0xe1, 0x90, 0x0d, 0x54, 0x5c, 0x71, 0x46,
0x90, 0x07, 0x88, 0x82, 0xa2, 0xfc, 0x74, 0xd1, 0x96, 0x69, 0xa2, 0x35, 0x5e, 0x36, 0x96, 0x30,
0x06, 0x63, 0xa3, 0x3c, 0x46, 0x9e, 0x27, 0x4f, 0x90, 0x92, 0x32, 0x4a, 0x61, 0x45, 0xd0, 0xf9,
0x29, 0xa2, 0x1d, 0x5b, 0x46, 0xca, 0x5f, 0xf3, 0xed, 0xcc, 0x37, 0x9a, 0x6f, 0xbe, 0x19, 0x2d,
0xfc, 0xde, 0x8e, 0x47, 0x97, 0xfe, 0x3c, 0x76, 0x56, 0x51, 0x18, 0x87, 0xb4, 0x2e, 0x55, 0xbc,
0x1d, 0x77, 0xfe, 0x4b, 0x3f, 0xbe, 0x4f, 0x5c, 0x67, 0x16, 0x06, 0x23, 0x19, 0xca, 0x70, 0x84,
0x75, 0x37, 0x99, 0x63, 0x86, 0x09, 0x46, 0x79, 0xdf, 0xe0, 0x95, 0x00, 0x55, 0x32, 0x67, 0x9e,
0x77, 0x11, 0x09, 0xa1, 0x42, 0x26, 0xd6, 0xb4, 0x0d, 0x5a, 0xe2, 0x7b, 0x26, 0xe9, 0x91, 0xa1,
0x36, 0xad, 0x67, 0xa9, 0xad, 0x52, 0xa6, 0x80, 0x0e, 0xc0, 0x50, 0xb3, 0x7c, 0xcf, 0xac, 0x62,
0x15, 0xb2, 0xd4, 0x2e, 0x18, 0x56, 0xbc, 0xaa, 0x7d, 0x99, 0x04, 0xa6, 0x76, 0x6c, 0x5f, 0x26,
0x01, 0x53, 0x40, 0x87, 0xd0, 0x10, 0x0f, 0x2b, 0x3f, 0x12, 0x3c, 0x36, 0x75, 0xac, 0xff, 0xca,
0x52, 0xbb, 0xe4, 0x58, 0x19, 0xd1, 0x2e, 0xe8, 0xb3, 0xd0, 0x13, 0x66, 0xad, 0x47, 0x86, 0xcd,
0x69, 0x23, 0x4b, 0x6d, 0xcc, 0x19, 0xa2, 0xb2, 0x31, 0xe3, 0x8b, 0x85, 0x88, 0x4c, 0x03, 0xeb,
0x68, 0x23, 0x67, 0x58, 0xf1, 0x0e, 0x9e, 0x08, 0xfc, 0xf9, 0xb4, 0xdc, 0x66, 0x55, 0x2a, 0xe7,
0xeb, 0x7d, 0x54, 0x6e, 0x83, 0x16, 0x6c, 0x24, 0x6e, 0xd7, 0xcc, 0xcd, 0x07, 0x1b, 0xc9, 0x14,
0xd0, 0x53, 0xd0, 0x3d, 0x1e, 0x73, 0x5c, 0xac, 0x35, 0xe9, 0x3b, 0xc5, 0xd1, 0x9d, 0x2f, 0x86,
0x38, 0xe7, 0x3c, 0xe6, 0xb9, 0xb6, 0x6a, 0x61, 0x88, 0x9d, 0x7f, 0xa0, 0x2b, 0x9e, 0xf6, 0xc1,
0x70, 0xb9, 0xbc, 0x2b, 0x4f, 0x8c, 0xee, 0x73, 0x86, 0xd5, 0x5c, 0x2e, 0xaf, 0xbd, 0xc9, 0x0d,
0xe8, 0x4a, 0x8b, 0x5e, 0x41, 0x8b, 0x1f, 0xa5, 0xe9, 0xdf, 0xef, 0x87, 0xae, 0x3b, 0xdd, 0x9f,
0x1c, 0x4d, 0xbb, 0xcf, 0x7b, 0x8b, 0xec, 0xf6, 0x16, 0x79, 0xdb, 0x5b, 0xe4, 0xf1, 0x60, 0x55,
0x76, 0x07, 0xab, 0xf2, 0x72, 0xb0, 0x2a, 0xb7, 0xd5, 0xed, 0xd8, 0x35, 0xf0, 0x43, 0x9c, 0xbc,
0x07, 0x00, 0x00, 0xff, 0xff, 0x49, 0xd7, 0x75, 0x4e, 0x59, 0x02, 0x00, 0x00,
}

View File

@@ -0,0 +1,46 @@
syntax = "proto3";
package gift.v1;
option go_package = "v1";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Gift {
/** 增加包裹道具
*
*/
rpc addFreeGift (GiftAddFreeGiftReq) returns (GiftAddFreeGiftResp);
}
message GiftAddFreeGiftReq {
// 用户uid
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
// 礼物id
int64 giftid = 2 [(gogoproto.jsontag) = "giftid"];
// 数量
int64 num = 3 [(gogoproto.jsontag) = "num"];
// 过期时间
int64 expireat = 4 [(gogoproto.jsontag) = "expireat"];
//
string code = 5 [(gogoproto.jsontag) = "code"];
//
string caller = 6 [(gogoproto.jsontag) = "caller"];
}
message GiftAddFreeGiftResp {
//
int64 code = 1 [(gogoproto.jsontag) = "code"];
//
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message Data {
//
int64 bag_id = 1 [(gogoproto.jsontag) = "bag_id"];
}
}