Create & Init Project...

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

View File

@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["client.go"],
importpath = "go-common/app/service/live/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"];
}
}