refactor: 粮草版,添加称号,精英单位。

main
NorthLan 3 years ago
parent 93ecc6b393
commit f5f2bc166f

@ -0,0 +1,5 @@
protoc --go_opt=paths=source_relative ^
--go-grpc_opt=paths=source_relative ^
--go-grpc_opt=require_unimplemented_servers=false ^
--go_out=. --go-grpc_out=. --proto_path=. ^
./vars/*.proto ./mq/*.proto

@ -1 +0,0 @@
protoc --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --go-grpc_opt=require_unimplemented_servers=false --go_out=. --go-grpc_out=. --proto_path=. mq.proto

@ -2,13 +2,14 @@
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.4
// source: mq.proto
// source: mq/mq.proto
package pbMq
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
vars "live-service/app/pb/vars"
reflect "reflect"
sync "sync"
)
@ -56,11 +57,11 @@ func (x Platform) String() string {
}
func (Platform) Descriptor() protoreflect.EnumDescriptor {
return file_mq_proto_enumTypes[0].Descriptor()
return file_mq_mq_proto_enumTypes[0].Descriptor()
}
func (Platform) Type() protoreflect.EnumType {
return &file_mq_proto_enumTypes[0]
return &file_mq_mq_proto_enumTypes[0]
}
func (x Platform) Number() protoreflect.EnumNumber {
@ -69,7 +70,134 @@ func (x Platform) Number() protoreflect.EnumNumber {
// Deprecated: Use Platform.Descriptor instead.
func (Platform) EnumDescriptor() ([]byte, []int) {
return file_mq_proto_rawDescGZIP(), []int{0}
return file_mq_mq_proto_rawDescGZIP(), []int{0}
}
type MqGuardBuy struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"`
LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"`
Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"`
Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"`
GuardLevel int32 `protobuf:"varint,5,opt,name=guardLevel,proto3" json:"guardLevel,omitempty"`
Num int32 `protobuf:"varint,6,opt,name=num,proto3" json:"num,omitempty"`
Price int64 `protobuf:"varint,7,opt,name=price,proto3" json:"price,omitempty"`
GiftId int64 `protobuf:"varint,8,opt,name=giftId,proto3" json:"giftId,omitempty"`
GiftName string `protobuf:"bytes,9,opt,name=giftName,proto3" json:"giftName,omitempty"`
StartTime int64 `protobuf:"varint,10,opt,name=startTime,proto3" json:"startTime,omitempty"`
EndTime int64 `protobuf:"varint,11,opt,name=endTime,proto3" json:"endTime,omitempty"`
}
func (x *MqGuardBuy) Reset() {
*x = MqGuardBuy{}
if protoimpl.UnsafeEnabled {
mi := &file_mq_mq_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MqGuardBuy) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MqGuardBuy) ProtoMessage() {}
func (x *MqGuardBuy) ProtoReflect() protoreflect.Message {
mi := &file_mq_mq_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MqGuardBuy.ProtoReflect.Descriptor instead.
func (*MqGuardBuy) Descriptor() ([]byte, []int) {
return file_mq_mq_proto_rawDescGZIP(), []int{0}
}
func (x *MqGuardBuy) GetPlatform() string {
if x != nil {
return x.Platform
}
return ""
}
func (x *MqGuardBuy) GetLiveRoomId() int64 {
if x != nil {
return x.LiveRoomId
}
return 0
}
func (x *MqGuardBuy) GetUid() int64 {
if x != nil {
return x.Uid
}
return 0
}
func (x *MqGuardBuy) GetUname() string {
if x != nil {
return x.Uname
}
return ""
}
func (x *MqGuardBuy) GetGuardLevel() int32 {
if x != nil {
return x.GuardLevel
}
return 0
}
func (x *MqGuardBuy) GetNum() int32 {
if x != nil {
return x.Num
}
return 0
}
func (x *MqGuardBuy) GetPrice() int64 {
if x != nil {
return x.Price
}
return 0
}
func (x *MqGuardBuy) GetGiftId() int64 {
if x != nil {
return x.GiftId
}
return 0
}
func (x *MqGuardBuy) GetGiftName() string {
if x != nil {
return x.GiftName
}
return ""
}
func (x *MqGuardBuy) GetStartTime() int64 {
if x != nil {
return x.StartTime
}
return 0
}
func (x *MqGuardBuy) GetEndTime() int64 {
if x != nil {
return x.EndTime
}
return 0
}
type MqDanmaku struct {
@ -88,7 +216,7 @@ type MqDanmaku struct {
func (x *MqDanmaku) Reset() {
*x = MqDanmaku{}
if protoimpl.UnsafeEnabled {
mi := &file_mq_proto_msgTypes[0]
mi := &file_mq_mq_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -101,7 +229,7 @@ func (x *MqDanmaku) String() string {
func (*MqDanmaku) ProtoMessage() {}
func (x *MqDanmaku) ProtoReflect() protoreflect.Message {
mi := &file_mq_proto_msgTypes[0]
mi := &file_mq_mq_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -114,7 +242,7 @@ func (x *MqDanmaku) ProtoReflect() protoreflect.Message {
// Deprecated: Use MqDanmaku.ProtoReflect.Descriptor instead.
func (*MqDanmaku) Descriptor() ([]byte, []int) {
return file_mq_proto_rawDescGZIP(), []int{0}
return file_mq_mq_proto_rawDescGZIP(), []int{1}
}
func (x *MqDanmaku) GetPlatform() string {
@ -178,7 +306,7 @@ type MqGift struct {
func (x *MqGift) Reset() {
*x = MqGift{}
if protoimpl.UnsafeEnabled {
mi := &file_mq_proto_msgTypes[1]
mi := &file_mq_mq_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -191,7 +319,7 @@ func (x *MqGift) String() string {
func (*MqGift) ProtoMessage() {}
func (x *MqGift) ProtoReflect() protoreflect.Message {
mi := &file_mq_proto_msgTypes[1]
mi := &file_mq_mq_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -204,7 +332,7 @@ func (x *MqGift) ProtoReflect() protoreflect.Message {
// Deprecated: Use MqGift.ProtoReflect.Descriptor instead.
func (*MqGift) Descriptor() ([]byte, []int) {
return file_mq_proto_rawDescGZIP(), []int{1}
return file_mq_mq_proto_rawDescGZIP(), []int{2}
}
func (x *MqGift) GetPlatform() string {
@ -287,7 +415,7 @@ type MqRewardPool struct {
func (x *MqRewardPool) Reset() {
*x = MqRewardPool{}
if protoimpl.UnsafeEnabled {
mi := &file_mq_proto_msgTypes[2]
mi := &file_mq_mq_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -300,7 +428,7 @@ func (x *MqRewardPool) String() string {
func (*MqRewardPool) ProtoMessage() {}
func (x *MqRewardPool) ProtoReflect() protoreflect.Message {
mi := &file_mq_proto_msgTypes[2]
mi := &file_mq_mq_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -313,7 +441,7 @@ func (x *MqRewardPool) ProtoReflect() protoreflect.Message {
// Deprecated: Use MqRewardPool.ProtoReflect.Descriptor instead.
func (*MqRewardPool) Descriptor() ([]byte, []int) {
return file_mq_proto_rawDescGZIP(), []int{2}
return file_mq_mq_proto_rawDescGZIP(), []int{3}
}
func (x *MqRewardPool) GetWelfarePool() int64 {
@ -365,92 +493,229 @@ func (x *MqRewardPool) GetAllRewards() int64 {
return 0
}
var File_mq_proto protoreflect.FileDescriptor
// 用户金币变动通知
type MqUserCoinChanged struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"`
Reason vars.UserCoinChangedReason `protobuf:"varint,4,opt,name=reason,proto3,enum=pb.vars.UserCoinChangedReason" json:"reason,omitempty"` // 变动原因
Change int64 `protobuf:"varint,10,opt,name=change,proto3" json:"change,omitempty"` // 变动量
Current int64 `protobuf:"varint,11,opt,name=current,proto3" json:"current,omitempty"` // 当前量
}
func (x *MqUserCoinChanged) Reset() {
*x = MqUserCoinChanged{}
if protoimpl.UnsafeEnabled {
mi := &file_mq_mq_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MqUserCoinChanged) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MqUserCoinChanged) ProtoMessage() {}
func (x *MqUserCoinChanged) ProtoReflect() protoreflect.Message {
mi := &file_mq_mq_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MqUserCoinChanged.ProtoReflect.Descriptor instead.
func (*MqUserCoinChanged) Descriptor() ([]byte, []int) {
return file_mq_mq_proto_rawDescGZIP(), []int{4}
}
func (x *MqUserCoinChanged) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *MqUserCoinChanged) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *MqUserCoinChanged) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *MqUserCoinChanged) GetReason() vars.UserCoinChangedReason {
if x != nil {
return x.Reason
}
return vars.UserCoinChangedReason(0)
}
func (x *MqUserCoinChanged) GetChange() int64 {
if x != nil {
return x.Change
}
return 0
}
func (x *MqUserCoinChanged) GetCurrent() int64 {
if x != nil {
return x.Current
}
return 0
}
var file_mq_proto_rawDesc = []byte{
0x0a, 0x08, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xa5,
0x01, 0x0a, 0x09, 0x4d, 0x71, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x12, 0x1a, 0x0a, 0x08,
var File_mq_mq_proto protoreflect.FileDescriptor
var file_mq_mq_proto_rawDesc = []byte{
0x0a, 0x0b, 0x6d, 0x71, 0x2f, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
0x62, 0x1a, 0x0f, 0x76, 0x61, 0x72, 0x73, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0xa4, 0x02, 0x0a, 0x0a, 0x4d, 0x71, 0x47, 0x75, 0x61, 0x72, 0x64, 0x42, 0x75,
0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a,
0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a,
0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x4c, 0x65,
0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64,
0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67,
0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03,
0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x09, 0x4d, 0x71,
0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66,
0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66,
0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f,
0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x22, 0xe0, 0x01, 0x0a, 0x06, 0x4d, 0x71, 0x47, 0x69, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x08,
0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65,
0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69,
0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65,
0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65,
0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe0, 0x01, 0x0a, 0x06, 0x4d, 0x71, 0x47, 0x69, 0x66,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a,
0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a,
0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12,
0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a,
0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12,
0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70,
0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28,
0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x22, 0xf2, 0x01, 0x0a, 0x0c, 0x4d, 0x71,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x77, 0x65,
0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0b, 0x77, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x1a, 0x0a, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x69, 0x74,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e,
0x69, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x69, 0x66, 0x74,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x67, 0x69,
0x66, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74,
0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c,
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b,
0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e,
0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01,
0x28, 0x03, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x2a, 0x39,
0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0c, 0x0a, 0x08, 0x62, 0x69,
0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x68, 0x75, 0x79, 0x61,
0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75, 0x79, 0x75, 0x10, 0x02, 0x12, 0x0a, 0x0a,
0x06, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x10, 0x03, 0x42, 0x07, 0x5a, 0x05, 0x2f, 0x70, 0x62,
0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69,
0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69,
0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18,
0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73,
0x50, 0x61, 0x69, 0x64, 0x22, 0xf2, 0x01, 0x0a, 0x0c, 0x4d, 0x71, 0x52, 0x65, 0x77, 0x61, 0x72,
0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x77, 0x65, 0x6c, 0x66, 0x61, 0x72, 0x65,
0x50, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x65, 0x6c, 0x66,
0x61, 0x72, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c,
0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x62, 0x61, 0x74, 0x74, 0x6c,
0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x77,
0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x69, 0x66, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72,
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x67, 0x69, 0x66, 0x74, 0x52, 0x65, 0x77,
0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x77,
0x61, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c,
0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x74,
0x68, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61,
0x6c, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x4d, 0x71,
0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x72,
0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x70, 0x62,
0x2e, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x61,
0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63,
0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x75,
0x72, 0x72, 0x65, 0x6e, 0x74, 0x2a, 0x39, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72,
0x6d, 0x12, 0x0c, 0x0a, 0x08, 0x62, 0x69, 0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12,
0x08, 0x0a, 0x04, 0x68, 0x75, 0x79, 0x61, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75,
0x79, 0x75, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x10, 0x03,
0x42, 0x07, 0x5a, 0x05, 0x2f, 0x70, 0x62, 0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_mq_proto_rawDescOnce sync.Once
file_mq_proto_rawDescData = file_mq_proto_rawDesc
file_mq_mq_proto_rawDescOnce sync.Once
file_mq_mq_proto_rawDescData = file_mq_mq_proto_rawDesc
)
func file_mq_proto_rawDescGZIP() []byte {
file_mq_proto_rawDescOnce.Do(func() {
file_mq_proto_rawDescData = protoimpl.X.CompressGZIP(file_mq_proto_rawDescData)
func file_mq_mq_proto_rawDescGZIP() []byte {
file_mq_mq_proto_rawDescOnce.Do(func() {
file_mq_mq_proto_rawDescData = protoimpl.X.CompressGZIP(file_mq_mq_proto_rawDescData)
})
return file_mq_proto_rawDescData
return file_mq_mq_proto_rawDescData
}
var file_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_mq_proto_goTypes = []interface{}{
var file_mq_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_mq_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_mq_mq_proto_goTypes = []interface{}{
(Platform)(0), // 0: pb.Platform
(*MqDanmaku)(nil), // 1: pb.MqDanmaku
(*MqGift)(nil), // 2: pb.MqGift
(*MqRewardPool)(nil), // 3: pb.MqRewardPool
}
var file_mq_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_mq_proto_init() }
func file_mq_proto_init() {
if File_mq_proto != nil {
(*MqGuardBuy)(nil), // 1: pb.MqGuardBuy
(*MqDanmaku)(nil), // 2: pb.MqDanmaku
(*MqGift)(nil), // 3: pb.MqGift
(*MqRewardPool)(nil), // 4: pb.MqRewardPool
(*MqUserCoinChanged)(nil), // 5: pb.MqUserCoinChanged
(vars.UserCoinChangedReason)(0), // 6: pb.vars.UserCoinChangedReason
}
var file_mq_mq_proto_depIdxs = []int32{
6, // 0: pb.MqUserCoinChanged.reason:type_name -> pb.vars.UserCoinChangedReason
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_mq_mq_proto_init() }
func file_mq_mq_proto_init() {
if File_mq_mq_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_mq_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MqGuardBuy); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mq_mq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MqDanmaku); i {
case 0:
return &v.state
@ -462,7 +727,7 @@ func file_mq_proto_init() {
return nil
}
}
file_mq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_mq_mq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MqGift); i {
case 0:
return &v.state
@ -474,7 +739,7 @@ func file_mq_proto_init() {
return nil
}
}
file_mq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_mq_mq_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MqRewardPool); i {
case 0:
return &v.state
@ -486,24 +751,36 @@ func file_mq_proto_init() {
return nil
}
}
file_mq_mq_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MqUserCoinChanged); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mq_proto_rawDesc,
RawDescriptor: file_mq_mq_proto_rawDesc,
NumEnums: 1,
NumMessages: 3,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mq_proto_goTypes,
DependencyIndexes: file_mq_proto_depIdxs,
EnumInfos: file_mq_proto_enumTypes,
MessageInfos: file_mq_proto_msgTypes,
GoTypes: file_mq_mq_proto_goTypes,
DependencyIndexes: file_mq_mq_proto_depIdxs,
EnumInfos: file_mq_mq_proto_enumTypes,
MessageInfos: file_mq_mq_proto_msgTypes,
}.Build()
File_mq_proto = out.File
file_mq_proto_rawDesc = nil
file_mq_proto_goTypes = nil
file_mq_proto_depIdxs = nil
File_mq_mq_proto = out.File
file_mq_mq_proto_rawDesc = nil
file_mq_mq_proto_goTypes = nil
file_mq_mq_proto_depIdxs = nil
}

@ -2,6 +2,8 @@ syntax = "proto3";
package pb;
import "vars/vars.proto";
option go_package = "/pbMq";
enum Platform {
@ -11,6 +13,20 @@ enum Platform {
douyin = 3; //
}
message MqGuardBuy {
string platform = 1;
int64 liveRoomId = 2;
int64 uid = 3;
string uname = 4;
int32 guardLevel = 5;
int32 num = 6;
int64 price = 7;
int64 giftId = 8;
string giftName = 9;
int64 startTime = 10;
int64 endTime = 11;
}
message MqDanmaku {
string platform = 1;
int64 liveRoomId = 2;
@ -41,3 +57,15 @@ message MqRewardPool {
int64 otherReward = 6; //
int64 allRewards = 10; //
}
//
message MqUserCoinChanged {
int64 userId = 1;
string username = 2;
string avatar = 3;
pb.vars.UserCoinChangedReason reason = 4; //
int64 change = 10; //
int64 current = 11; //
}

@ -0,0 +1,312 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.4
// source: vars/vars.proto
package pbVars
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type UserCoinChangedReason int32
const (
///// 消费
UserCoinChangedReason_Pay UserCoinChangedReason = 0 // 通用消费
UserCoinChangedReason_BuyBattleFood UserCoinChangedReason = 1 // 购买粮草
UserCoinChangedReason_BuyEliteUnit UserCoinChangedReason = 2 // 购买精英单位
UserCoinChangedReason_BuyTitle UserCoinChangedReason = 3 // 购买称号
///// 礼物
UserCoinChangedReason_SendGift UserCoinChangedReason = 4 // 赠送礼物
UserCoinChangedReason_BuyNobility UserCoinChangedReason = 5 // 购买贵族
///// 领取
UserCoinChangedReason_DrawGiftPack UserCoinChangedReason = 10 // 领取礼包
UserCoinChangedReason_CheckIn UserCoinChangedReason = 11 // 签到打卡
///// 游戏事件
UserCoinChangedReason_EventRankSubmit UserCoinChangedReason = 20 // 排行榜结算变动
UserCoinChangedReason_EventBattleEnd UserCoinChangedReason = 21 // 战局结束奖励
///// 其它事件
UserCoinChangedReason_Transfer UserCoinChangedReason = 30 // 转账
)
// Enum value maps for UserCoinChangedReason.
var (
UserCoinChangedReason_name = map[int32]string{
0: "Pay",
1: "BuyBattleFood",
2: "BuyEliteUnit",
3: "BuyTitle",
4: "SendGift",
5: "BuyNobility",
10: "DrawGiftPack",
11: "CheckIn",
20: "EventRankSubmit",
21: "EventBattleEnd",
30: "Transfer",
}
UserCoinChangedReason_value = map[string]int32{
"Pay": 0,
"BuyBattleFood": 1,
"BuyEliteUnit": 2,
"BuyTitle": 3,
"SendGift": 4,
"BuyNobility": 5,
"DrawGiftPack": 10,
"CheckIn": 11,
"EventRankSubmit": 20,
"EventBattleEnd": 21,
"Transfer": 30,
}
)
func (x UserCoinChangedReason) Enum() *UserCoinChangedReason {
p := new(UserCoinChangedReason)
*p = x
return p
}
func (x UserCoinChangedReason) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (UserCoinChangedReason) Descriptor() protoreflect.EnumDescriptor {
return file_vars_vars_proto_enumTypes[0].Descriptor()
}
func (UserCoinChangedReason) Type() protoreflect.EnumType {
return &file_vars_vars_proto_enumTypes[0]
}
func (x UserCoinChangedReason) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use UserCoinChangedReason.Descriptor instead.
func (UserCoinChangedReason) EnumDescriptor() ([]byte, []int) {
return file_vars_vars_proto_rawDescGZIP(), []int{0}
}
type Goods int32
const (
Goods_Title Goods = 0 // 称号
Goods_Elite Goods = 1 // 精英单位
)
// Enum value maps for Goods.
var (
Goods_name = map[int32]string{
0: "Title",
1: "Elite",
}
Goods_value = map[string]int32{
"Title": 0,
"Elite": 1,
}
)
func (x Goods) Enum() *Goods {
p := new(Goods)
*p = x
return p
}
func (x Goods) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Goods) Descriptor() protoreflect.EnumDescriptor {
return file_vars_vars_proto_enumTypes[1].Descriptor()
}
func (Goods) Type() protoreflect.EnumType {
return &file_vars_vars_proto_enumTypes[1]
}
func (x Goods) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Goods.Descriptor instead.
func (Goods) EnumDescriptor() ([]byte, []int) {
return file_vars_vars_proto_rawDescGZIP(), []int{1}
}
type RankType int32
const (
RankType_Unknown RankType = 0
RankType_Damage RankType = 1 // 伤害榜
RankType_DeDamage RankType = 2 // 受伤榜
RankType_General RankType = 3 // 名将榜
RankType_DeGeneral RankType = 4 // 落马榜
RankType_KillUnit RankType = 5 // 小兵击杀
RankType_DeKillUnit RankType = 6 // 小兵被杀
RankType_KillPlayer RankType = 7 // 击杀玩家
RankType_DeKillPlayer RankType = 8 // 被杀榜
RankType_Win RankType = 9 // 获胜榜
RankType_Lost RankType = 10 // 战败榜
RankType_FirstBlood RankType = 11 // 一血榜
RankType_DeFirstBlood RankType = 12 // 被拿一血榜
)
// Enum value maps for RankType.
var (
RankType_name = map[int32]string{
0: "Unknown",
1: "Damage",
2: "DeDamage",
3: "General",
4: "DeGeneral",
5: "KillUnit",
6: "DeKillUnit",
7: "KillPlayer",
8: "DeKillPlayer",
9: "Win",
10: "Lost",
11: "FirstBlood",
12: "DeFirstBlood",
}
RankType_value = map[string]int32{
"Unknown": 0,
"Damage": 1,
"DeDamage": 2,
"General": 3,
"DeGeneral": 4,
"KillUnit": 5,
"DeKillUnit": 6,
"KillPlayer": 7,
"DeKillPlayer": 8,
"Win": 9,
"Lost": 10,
"FirstBlood": 11,
"DeFirstBlood": 12,
}
)
func (x RankType) Enum() *RankType {
p := new(RankType)
*p = x
return p
}
func (x RankType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (RankType) Descriptor() protoreflect.EnumDescriptor {
return file_vars_vars_proto_enumTypes[2].Descriptor()
}
func (RankType) Type() protoreflect.EnumType {
return &file_vars_vars_proto_enumTypes[2]
}
func (x RankType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use RankType.Descriptor instead.
func (RankType) EnumDescriptor() ([]byte, []int) {
return file_vars_vars_proto_rawDescGZIP(), []int{2}
}
var File_vars_vars_proto protoreflect.FileDescriptor
var file_vars_vars_proto_rawDesc = []byte{
0x0a, 0x0f, 0x76, 0x61, 0x72, 0x73, 0x2f, 0x76, 0x61, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x07, 0x70, 0x62, 0x2e, 0x76, 0x61, 0x72, 0x73, 0x2a, 0xc8, 0x01, 0x0a, 0x15, 0x55,
0x73, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x52, 0x65,
0x61, 0x73, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x61, 0x79, 0x10, 0x00, 0x12, 0x11, 0x0a,
0x0d, 0x42, 0x75, 0x79, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x6f, 0x64, 0x10, 0x01,
0x12, 0x10, 0x0a, 0x0c, 0x42, 0x75, 0x79, 0x45, 0x6c, 0x69, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x74,
0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x75, 0x79, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x10, 0x03,
0x12, 0x0c, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x10, 0x04, 0x12, 0x0f,
0x0a, 0x0b, 0x42, 0x75, 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x10, 0x05, 0x12,
0x10, 0x0a, 0x0c, 0x44, 0x72, 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x10,
0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x10, 0x0b, 0x12, 0x13,
0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x53, 0x75, 0x62, 0x6d, 0x69,
0x74, 0x10, 0x14, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x74,
0x6c, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x15, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73,
0x66, 0x65, 0x72, 0x10, 0x1e, 0x2a, 0x1d, 0x0a, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x09,
0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x6c, 0x69,
0x74, 0x65, 0x10, 0x01, 0x2a, 0xc2, 0x01, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70,
0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a,
0x0a, 0x06, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x65,
0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x65,
0x72, 0x61, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72,
0x61, 0x6c, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74,
0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74,
0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x10, 0x08, 0x12, 0x07, 0x0a, 0x03, 0x57, 0x69, 0x6e, 0x10, 0x09, 0x12, 0x08, 0x0a,
0x04, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x69, 0x72, 0x73, 0x74,
0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x10, 0x0b, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x46, 0x69, 0x72,
0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x10, 0x0c, 0x42, 0x21, 0x5a, 0x1f, 0x6c, 0x69, 0x76,
0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x62,
0x2f, 0x76, 0x61, 0x72, 0x73, 0x3b, 0x70, 0x62, 0x56, 0x61, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_vars_vars_proto_rawDescOnce sync.Once
file_vars_vars_proto_rawDescData = file_vars_vars_proto_rawDesc
)
func file_vars_vars_proto_rawDescGZIP() []byte {
file_vars_vars_proto_rawDescOnce.Do(func() {
file_vars_vars_proto_rawDescData = protoimpl.X.CompressGZIP(file_vars_vars_proto_rawDescData)
})
return file_vars_vars_proto_rawDescData
}
var file_vars_vars_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_vars_vars_proto_goTypes = []interface{}{
(UserCoinChangedReason)(0), // 0: pb.vars.UserCoinChangedReason
(Goods)(0), // 1: pb.vars.Goods
(RankType)(0), // 2: pb.vars.RankType
}
var file_vars_vars_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_vars_vars_proto_init() }
func file_vars_vars_proto_init() {
if File_vars_vars_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vars_vars_proto_rawDesc,
NumEnums: 3,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_vars_vars_proto_goTypes,
DependencyIndexes: file_vars_vars_proto_depIdxs,
EnumInfos: file_vars_vars_proto_enumTypes,
}.Build()
File_vars_vars_proto = out.File
file_vars_vars_proto_rawDesc = nil
file_vars_vars_proto_goTypes = nil
file_vars_vars_proto_depIdxs = nil
}

@ -0,0 +1,45 @@
syntax = "proto3";
package pb.vars;
option go_package = "live-service/app/pb/vars;pbVars";
enum UserCoinChangedReason {
/////
Pay = 0; //
BuyBattleFood = 1; //
BuyEliteUnit = 2; //
BuyTitle = 3; //
/////
SendGift = 4; //
BuyNobility = 5; //
/////
DrawGiftPack = 10; //
CheckIn = 11; //
/////
EventRankSubmit = 20; //
EventBattleEnd = 21; //
/////
Transfer = 30; //
}
enum Goods {
Title = 0; //
Elite = 1; //
}
enum RankType {
Unknown = 0;
Damage = 1; //
DeDamage = 2; //
General = 3; //
DeGeneral = 4; //
KillUnit = 5; //
DeKillUnit = 6; //
KillPlayer = 7; //
DeKillPlayer = 8; //
Win = 9; //
Lost = 10; //
FirstBlood = 11; //
DeFirstBlood = 12; //
}

@ -2,7 +2,7 @@
chcp 65001
@echo 开始代码生成
set tables=user_coin
set tables=user_title
set targetDir=.\model
set templateDir=..\..\doc\template

@ -34,9 +34,9 @@ func (m *customGiftModel) FindByPlatformGift(ctx context.Context, platform strin
err := db.Model(&Gift{}).
Where("platform = ? AND gift_id = ?", platform, giftId).
Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*Gift), nil
return &resp, nil
}

@ -42,6 +42,7 @@ type (
Platform string `gorm:"column:platform"` // 平台
PPriceFree int64 `gorm:"column:p_price_free"` // 平台免费价值单价B站: 银瓜子虎牙: 银豆
Price float64 `gorm:"column:price"` // 转换后的礼物价值1RMB:1000(p)
Pic string `gorm:"pic"` // 礼物基本图
CreateTime time.Time `gorm:"column:create_time;default:null"` // 创建时间
PPricePaid int64 `gorm:"column:p_price_paid"` // 平台收费价值单价B站: 金瓜子虎牙: 金豆
}
@ -64,21 +65,21 @@ func (m *defaultGiftModel) Insert(ctx context.Context, tx *gorm.DB, data *Gift)
func (m *defaultGiftModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*Gift, error) {
var resp Gift
err := gormx.WithTx(ctx, m.DB, tx).Model(&Gift{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*Gift), nil
return &resp, nil
}
func (m *defaultGiftModel) FindOneByGiftIdPlatform(ctx context.Context, tx *gorm.DB, giftId string, platform string) (*Gift, error) {
var resp Gift
err := gormx.WithTx(ctx, m.DB, tx).Model(&Gift{}).Where("`gift_id` = ? and `platform` = ?", giftId, platform).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*Gift), nil
return &resp, nil
}
func (m *defaultGiftModel) Update(ctx context.Context, tx *gorm.DB, data *Gift) error {

@ -1,22 +1,24 @@
package model
import "live-service/app/user_center/rpc/pb"
import (
pbVars "live-service/app/pb/vars"
)
var rankAndScoreMap map[pb.RankType]ScoreType
var scoreAndRankMap map[ScoreType]pb.RankType
var rankAndScoreMap map[pbVars.RankType]ScoreType
var scoreAndRankMap map[ScoreType]pbVars.RankType
func ScoreTypeByRankType(rankType pb.RankType) ScoreType {
func ScoreTypeByRankType(rankType pbVars.RankType) ScoreType {
if scoreType, ok := rankAndScoreMap[rankType]; ok {
return scoreType
}
return ScoreTypeDamage
}
func RankTypeByScoreType(scoreType ScoreType) pb.RankType {
func RankTypeByScoreType(scoreType ScoreType) pbVars.RankType {
if rankType, ok := scoreAndRankMap[scoreType]; ok {
return rankType
}
return pb.RankType_Damage
return pbVars.RankType_Damage
}
func AllScoreType() []ScoreType {
@ -27,25 +29,25 @@ func AllScoreType() []ScoreType {
return result
}
func addRankScore(rankType pb.RankType, scoreType ScoreType) {
func addRankScore(rankType pbVars.RankType, scoreType ScoreType) {
rankAndScoreMap[rankType] = scoreType
scoreAndRankMap[scoreType] = rankType
}
func init() {
rankAndScoreMap = make(map[pb.RankType]ScoreType)
scoreAndRankMap = make(map[ScoreType]pb.RankType)
addRankScore(pb.RankType_Damage, ScoreTypeDamage)
addRankScore(pb.RankType_DeDamage, ScoreTypeDeDamage)
addRankScore(pb.RankType_General, ScoreTypeGeneral)
addRankScore(pb.RankType_DeGeneral, ScoreTypeDeGeneral)
addRankScore(pb.RankType_KillUnit, ScoreTypeKillUnit)
addRankScore(pb.RankType_DeKillUnit, ScoreTypeDeKillUnit)
addRankScore(pb.RankType_KillPlayer, ScoreTypeKillPlayer)
addRankScore(pb.RankType_DeKillPlayer, ScoreTypeDeKillPlayer)
addRankScore(pb.RankType_Win, ScoreTypeWin)
addRankScore(pb.RankType_Lost, ScoreTypeLost)
addRankScore(pb.RankType_FirstBlood, ScoreTypeFirstBlood)
addRankScore(pb.RankType_DeFirstBlood, ScoreTypeDeFirstBlood)
rankAndScoreMap = make(map[pbVars.RankType]ScoreType)
scoreAndRankMap = make(map[ScoreType]pbVars.RankType)
addRankScore(pbVars.RankType_Damage, ScoreTypeDamage)
addRankScore(pbVars.RankType_DeDamage, ScoreTypeDeDamage)
addRankScore(pbVars.RankType_General, ScoreTypeGeneral)
addRankScore(pbVars.RankType_DeGeneral, ScoreTypeDeGeneral)
addRankScore(pbVars.RankType_KillUnit, ScoreTypeKillUnit)
addRankScore(pbVars.RankType_DeKillUnit, ScoreTypeDeKillUnit)
addRankScore(pbVars.RankType_KillPlayer, ScoreTypeKillPlayer)
addRankScore(pbVars.RankType_DeKillPlayer, ScoreTypeDeKillPlayer)
addRankScore(pbVars.RankType_Win, ScoreTypeWin)
addRankScore(pbVars.RankType_Lost, ScoreTypeLost)
addRankScore(pbVars.RankType_FirstBlood, ScoreTypeFirstBlood)
addRankScore(pbVars.RankType_DeFirstBlood, ScoreTypeDeFirstBlood)
}

@ -67,11 +67,11 @@ func (m *customRankPvpModel) RankListByType(ctx context.Context, rankType, topN
Where(fmt.Sprintf("%s.user_id > 0 AND rank_type = ?", m.table), rankType).
Limit(int(limit)).
Find(&result).Error
selectResult, err := gormx.WrapSelectResult(err, result)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return selectResult.([]RankPvpWithPlatformUser), nil
return result, nil
}
func (m *customRankPvpModel) UpdateRank(ctx context.Context, rankType int64, data []RankPvp) error {

@ -62,21 +62,21 @@ func (m *defaultRankPvpModel) Insert(ctx context.Context, tx *gorm.DB, data *Ran
func (m *defaultRankPvpModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*RankPvp, error) {
var resp RankPvp
err := gormx.WithTx(ctx, m.DB, tx).Model(&RankPvp{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*RankPvp), nil
return &resp, nil
}
func (m *defaultRankPvpModel) FindOneByUserIdRankType(ctx context.Context, tx *gorm.DB, userId int64, rankType int64) (*RankPvp, error) {
var resp RankPvp
err := gormx.WithTx(ctx, m.DB, tx).Model(&RankPvp{}).Where("`user_id` = ? and `rank_type` = ?", userId, rankType).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*RankPvp), nil
return &resp, nil
}
func (m *defaultRankPvpModel) Update(ctx context.Context, tx *gorm.DB, data *RankPvp) error {

@ -45,13 +45,13 @@ type (
}
UpdateRecordProps struct {
Damage *int64 // 伤害
DeDamage *int64 // 被伤害
KillUnitCount *int64 // 击杀单位数量
DeKillUnitCount *int64 // 被击杀单位被击杀
Damage int64 // 伤害
DeDamage int64 // 被伤害
KillUnitCount int64 // 击杀单位数量
DeKillUnitCount int64 // 被击杀单位被击杀
Win bool // 是否获胜
Lost bool // 是否战败
KillPlayer bool // 是否击杀玩家
KillPlayer int64 // 击杀玩家数量
DeKillPlayer bool // 是否玩家被击杀
General bool // 是否拿到名将
DeGeneral bool // 是否名将罗马
@ -77,17 +77,17 @@ func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, tx *gorm.DB
db = db.Model(&StatisticsPvp{}).Where("user_id = ?", userId)
data := make(map[string]interface{})
if props.Damage != nil {
data["damage"] = gorm.Expr("damage + ?", *props.Damage)
if props.Damage != 0 {
data["damage"] = gorm.Expr("damage + ?", props.Damage)
}
if props.DeDamage != nil {
data["de_damage"] = gorm.Expr("de_damage + ?", *props.DeDamage)
if props.DeDamage != 0 {
data["de_damage"] = gorm.Expr("de_damage + ?", props.DeDamage)
}
if props.KillUnitCount != nil {
data["kill_unit_count"] = gorm.Expr("kill_unit_count + ?", *props.KillUnitCount)
if props.KillUnitCount != 0 {
data["kill_unit_count"] = gorm.Expr("kill_unit_count + ?", props.KillUnitCount)
}
if props.DeKillUnitCount != nil {
data["de_kill_unit_count"] = gorm.Expr("de_kill_unit_count + ?", *props.DeKillUnitCount)
if props.DeKillUnitCount != 0 {
data["de_kill_unit_count"] = gorm.Expr("de_kill_unit_count + ?", props.DeKillUnitCount)
}
if props.Win {
data["win_count"] = gorm.Expr("win_count + 1")
@ -95,8 +95,8 @@ func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, tx *gorm.DB
if props.Lost {
data["lost_count"] = gorm.Expr("lost_count + 1")
}
if props.KillPlayer {
data["kill_player_count"] = gorm.Expr("kill_player_count + 1")
if props.KillPlayer != 0 {
data["kill_player_count"] = gorm.Expr("kill_player_count + ?", props.KillPlayer)
}
if props.DeKillPlayer {
data["de_kill_player_count"] = gorm.Expr("de_kill_player_count + 1")
@ -139,11 +139,11 @@ func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score
Where(whereSql, score).
Order(fmt.Sprintf("%s.%s desc", m.table, scoreType)).
Limit(limit).Find(&result).Error
selectResult, err := gormx.WrapSelectResult(err, result)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return selectResult.([]UserAndScore), nil
return result, nil
}
func (m *customStatisticsPvpModel) FindScoreByType(ctx context.Context, tx *gorm.DB, userId int64, scoreType []ScoreType) (map[string]int64, error) {
@ -157,7 +157,7 @@ func (m *customStatisticsPvpModel) FindScoreByType(ctx context.Context, tx *gorm
err := db.Table(m.table).
Select(selectFields).
Where("user_id = ?", userId).Take(&resp).Error
_, err = gormx.WrapSelectResult(err, resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}

@ -70,11 +70,11 @@ func (m *defaultStatisticsPvpModel) Insert(ctx context.Context, tx *gorm.DB, dat
func (m *defaultStatisticsPvpModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*StatisticsPvp, error) {
var resp StatisticsPvp
err := gormx.WithTx(ctx, m.DB, tx).Model(&StatisticsPvp{}).Where("`user_id` = ?", userId).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*StatisticsPvp), nil
return &resp, nil
}
func (m *defaultStatisticsPvpModel) Update(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error {

@ -40,11 +40,11 @@ func (m *customUserCheckInModel) FindThisWeek(ctx context.Context, tx *gorm.DB,
err := db.Model(&UserCheckIn{}).
Where("user_id = ? AND check_in_time >= ", userId, now.Monday()).
Order("check_in_time ASC").Find(resp).Error
result, err := gormx.WrapSelectResult(err, resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.([]UserCheckIn), nil
return resp, nil
}
func (m *customUserCheckInModel) CheckInToday(ctx context.Context, tx *gorm.DB, userId int64) (bool, error) {

@ -58,11 +58,11 @@ func (m *defaultUserCheckInModel) Insert(ctx context.Context, tx *gorm.DB, data
func (m *defaultUserCheckInModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserCheckIn, error) {
var resp UserCheckIn
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserCheckIn{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserCheckIn), nil
return &resp, nil
}
func (m *defaultUserCheckInModel) Update(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error {

@ -61,11 +61,11 @@ func (m *defaultUserCoinModel) Insert(ctx context.Context, tx *gorm.DB, data *Us
func (m *defaultUserCoinModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserCoin, error) {
var resp UserCoin
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserCoin{}).Where("`user_id` = ?", userId).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserCoin), nil
return &resp, nil
}
func (m *defaultUserCoinModel) Update(ctx context.Context, tx *gorm.DB, data *UserCoin) error {

@ -0,0 +1,132 @@
package model
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"git.noahlan.cn/northlan/ntools-go/uuid"
"github.com/jinzhu/now"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/common/nerr"
"live-service/common/timex"
"time"
)
var _ UserEliteModel = (*customUserEliteModel)(nil)
type (
// UserEliteModel is an interface to be customized, add more methods here,
// and implement the added methods in customUserEliteModel.
UserEliteModel interface {
userEliteModel
// FindMaxSort 寻找当前用户精英单位的最大Sort 最小值2
FindMaxSort(ctx context.Context, tx *gorm.DB, userId int64) int64
// FindOneByUserIdSort 通过用户和排序号找寻精英单位
FindOneByUserIdSort(ctx context.Context, tx *gorm.DB, userId int64, sort int64) (*UserElite, error)
// FindByUserId 查找用户所有列表,按sort升序排列
FindByUserId(ctx context.Context, tx *gorm.DB, userId int64) ([]UserElite, error)
// Addon 添加新的或延长时间
Addon(ctx context.Context, tx *gorm.DB, userId, eliteId int64, duration time.Duration, forever bool) error
}
customUserEliteModel struct {
*defaultUserEliteModel
}
)
// NewUserEliteModel returns a model for the database table.
func NewUserEliteModel(conn *gorm.DB) UserEliteModel {
return &customUserEliteModel{
defaultUserEliteModel: newUserEliteModel(conn),
}
}
func (m *customUserEliteModel) FindMaxSort(ctx context.Context, tx *gorm.DB, userId int64) int64 {
db := gormx.WithTx(ctx, m.DB, tx)
var resp int64 = 1
db.Table(m.table).
Select("MAX(sort)").
Where("user_id = ?", userId).
Where("end_time > ?", now.BeginningOfDay()).Take(&resp)
return resp
}
func (m *customUserEliteModel) FindOneByUserIdSort(ctx context.Context, tx *gorm.DB, userId int64, sort int64) (*UserElite, error) {
db := gormx.WithTx(ctx, m.DB, tx)
var resp UserElite
err := db.Model(&UserElite{}).
Where("user_id = ? and sort = ?", userId, sort).Take(&resp).Error
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return &resp, nil
}
func (m *customUserEliteModel) FindByUserId(ctx context.Context, tx *gorm.DB, userId int64) ([]UserElite, error) {
var resp []UserElite
err := gormx.WithTx(ctx, m.DB, tx).Table(m.table).
Where("user_id = ?", userId).
Order("sort asc").Find(&resp).Error
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return resp, nil
}
func (m *customUserEliteModel) Addon(ctx context.Context, tx *gorm.DB, userId, eliteId int64, duration time.Duration, forever bool) error {
return m.TransactCtx(ctx, tx, func(tx *gorm.DB) error {
userElite, err := m.FindOneByUserIdEliteId(ctx, tx, userId, eliteId)
if err != nil {
if !errors.Is(err, gormx.ErrNotFound) {
return nerr.NewWithCode(nerr.DBError)
}
}
today := now.BeginningOfDay()
if userElite == nil {
// sort
maxSort := m.FindMaxSort(ctx, tx, userId)
err = m.Insert(ctx, tx, &UserElite{
Id: uuid.NextId(),
UserId: userId,
EliteId: eliteId,
Sort: maxSort + 1,
Forever: BitBool(forever),
StartTime: today,
EndTime: today.Add(duration),
})
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
} else {
// update
if !timex.DayExpire(today, userElite.EndTime, bool(userElite.Forever)) {
// 未过期,endTime直接添加1day
userElite.EndTime = userElite.EndTime.Add(duration)
err = m.Update(ctx, tx, userElite)
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
} else {
// 过期,更新日期
err = m.Update(ctx, tx, &UserElite{
Id: userElite.Id,
UserId: userId,
EliteId: eliteId,
Sort: userElite.Sort,
Forever: BitBool(forever),
StartTime: today,
EndTime: today.Add(duration),
})
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
}
}
return nil
})
}

@ -0,0 +1,100 @@
// Code generated by goctl. DO NOT EDIT!
package model
import (
"context"
"strings"
"time"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stringx"
"gorm.io/gorm"
)
var (
userEliteFieldNames = builder.RawFieldNames(&UserElite{})
userEliteRows = strings.Join(userEliteFieldNames, ",")
userEliteRowsExpectAutoSet = strings.Join(stringx.Remove(userEliteFieldNames, "`create_time`", "`update_time`"), ",")
userEliteRowsWithPlaceHolder = strings.Join(stringx.Remove(userEliteFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"
)
type (
userEliteModel interface {
gormx.TxModel
Insert(ctx context.Context, tx *gorm.DB, data *UserElite) error
FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserElite, error)
FindOneByUserIdEliteId(ctx context.Context, tx *gorm.DB, userId int64, eliteId int64) (*UserElite, error)
Update(ctx context.Context, tx *gorm.DB, data *UserElite) error
Delete(ctx context.Context, tx *gorm.DB, id int64) error
}
defaultUserEliteModel struct {
gormx.GormConn
table string
}
UserElite struct {
Id int64 `gorm:"column:id;primaryKey"` // 主键ID
UserId int64 `gorm:"column:user_id"` // 用户ID
EliteId int64 `gorm:"column:elite_id"` // 精英单位ID
Sort int64 `gorm:"column:sort"` // 排序号
Forever BitBool `gorm:"forever"` // 永久
StartTime time.Time `gorm:"column:start_time;default:null"` // 开始时间
EndTime time.Time `gorm:"column:end_time;default:null"` // 结束时间
}
)
var UserEliteTableName = "`user_elite`"
func newUserEliteModel(conn *gorm.DB) *defaultUserEliteModel {
return &defaultUserEliteModel{
GormConn: gormx.NewConn(conn),
table: UserEliteTableName,
}
}
func (m *defaultUserEliteModel) Insert(ctx context.Context, tx *gorm.DB, data *UserElite) error {
err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error
return err
}
func (m *defaultUserEliteModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserElite, error) {
var resp UserElite
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserElite{}).Where("`id` = ?", id).Take(&resp).Error
if err = gormx.WrapSelectErr(err); err != nil {
return nil, err
}
return &resp, nil
}
func (m *defaultUserEliteModel) FindOneByUserIdEliteId(ctx context.Context, tx *gorm.DB, userId int64, eliteId int64) (*UserElite, error) {
var resp UserElite
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserElite{}).Where("`user_id` = ? and `elite_id` = ?", userId, eliteId).Take(&resp).Error
if err = gormx.WrapSelectErr(err); err != nil {
return nil, err
}
return &resp, nil
}
func (m *defaultUserEliteModel) Update(ctx context.Context, tx *gorm.DB, data *UserElite) error {
result := gormx.WithTx(ctx, m.DB, tx).Save(data)
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
}
func (m *defaultUserEliteModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error {
err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserElite{}, id).Error
return err
}
func (m *defaultUserEliteModel) tableName() string {
return m.table
}
func (UserElite) TableName() string {
return UserEliteTableName
}

@ -65,11 +65,11 @@ func (m *defaultUserGiftModel) Insert(ctx context.Context, tx *gorm.DB, data *Us
func (m *defaultUserGiftModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserGift, error) {
var resp UserGift
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserGift{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserGift), nil
return &resp, nil
}
func (m *defaultUserGiftModel) Update(ctx context.Context, tx *gorm.DB, data *UserGift) error {

@ -61,11 +61,11 @@ func (m *defaultUserIntegralModel) Insert(ctx context.Context, tx *gorm.DB, data
func (m *defaultUserIntegralModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserIntegral, error) {
var resp UserIntegral
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserIntegral{}).Where("`user_id` = ?", userId).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserIntegral), nil
return &resp, nil
}
func (m *defaultUserIntegralModel) Update(ctx context.Context, tx *gorm.DB, data *UserIntegral) error {

@ -59,11 +59,11 @@ func (m *defaultUserModel) Insert(ctx context.Context, tx *gorm.DB, data *User)
func (m *defaultUserModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*User, error) {
var resp User
err := gormx.WithTx(ctx, m.DB, tx).Model(&User{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*User), nil
return &resp, nil
}
func (m *defaultUserModel) Update(ctx context.Context, tx *gorm.DB, data *User) error {

@ -62,11 +62,11 @@ func (m *defaultUserNobilityModel) Insert(ctx context.Context, tx *gorm.DB, data
func (m *defaultUserNobilityModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserNobility, error) {
var resp UserNobility
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserNobility{}).Where("`user_id` = ?", userId).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserNobility), nil
return &resp, nil
}
func (m *defaultUserNobilityModel) Update(ctx context.Context, tx *gorm.DB, data *UserNobility) error {

@ -22,15 +22,17 @@ type (
FindEmptyList(ctx context.Context, num int64) ([]UserPlatform, error)
// FindUpdatableList 查询过期需要更新信息的用户
FindUpdatableList(ctx context.Context, duration int64, num int64) ([]UserPlatform, error)
// FindDisplayOneByUserId 查找用户信息,用户展示
FindDisplayOneByUserId(ctx context.Context, uid int64) (*UserPlatformForDisplay, error)
// FindDisplayOneByUserId 查找用户信息,用于展示
FindDisplayOneByUserId(ctx context.Context, uid int64) (*UserForDisplay, error)
// FindDisplayOneByPlatform 查找用户信息,用于展示
FindDisplayOneByPlatform(ctx context.Context, tx *gorm.DB, platform string, pUid string) (*UserForDisplay, error)
// UpdateNobilityByPUid 更新贵族数据
UpdateNobilityByPUid(ctx context.Context, pUid int64, nobility int64) error
// FindUserIdByPlatform 根据平台与平台用户ID获取系统用户ID
FindUserIdByPlatform(ctx context.Context, platform, pUid string) (int64, error)
}
UserPlatformForDisplay struct {
UserForDisplay struct {
UserId int64 // 用户ID
PUname string // 平台用户名
PAvatar string // 平台用户头像地址
@ -59,11 +61,11 @@ func (m *customUserPlatformModel) FindOneByPlatformAndPUid(ctx context.Context,
var resp UserPlatform
err := db.Model(&UserPlatform{}).Where("`platform` = ? AND `p_uid` = ?", platform, pUid).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserPlatform), nil
return &resp, nil
}
func (m *customUserPlatformModel) FindFullByPlatform(ctx context.Context, tx *gorm.DB, platform, pUid string) (*FullUser, error) {
@ -74,11 +76,11 @@ func (m *customUserPlatformModel) FindFullByPlatform(ctx context.Context, tx *go
Joins("UserIntegral").
Where("platform = ? AND p_uid = ?", platform, pUid).
Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*FullUser), nil
return &resp, nil
}
func (m *customUserPlatformModel) FindEmptyList(ctx context.Context, num int64) ([]UserPlatform, error) {
@ -87,11 +89,11 @@ func (m *customUserPlatformModel) FindEmptyList(ctx context.Context, num int64)
Table(m.tableName()).
Where("JSON_LENGTH(`p_info`) = 0 LIMIT ?", num).
Find(&resp).Error
result, err := gormx.WrapSelectResult(err, resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.([]UserPlatform), nil
return resp, nil
}
func (m *customUserPlatformModel) FindUpdatableList(ctx context.Context, duration int64, num int64) ([]UserPlatform, error) {
@ -100,25 +102,39 @@ func (m *customUserPlatformModel) FindUpdatableList(ctx context.Context, duratio
Table(m.tableName()).
Where("`update_time` < (NOW() - INTERVAL ? HOUR) LIMIT ?", duration, num).
Find(&resp).Error
result, err := gormx.WrapSelectResult(err, resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.([]UserPlatform), nil
return resp, nil
}
func (m *customUserPlatformModel) FindDisplayOneByUserId(ctx context.Context, uid int64) (*UserPlatformForDisplay, error) {
var resp UserPlatformForDisplay
func (m *customUserPlatformModel) FindDisplayOneByUserId(ctx context.Context, uid int64) (*UserForDisplay, error) {
var resp UserForDisplay
err := gormx.WithTx(ctx, m.DB, nil).
Table(m.table).
Select(fmt.Sprintf("%s.user_id, %s.p_uname, %s.p_avatar", m.table, m.table, m.table)).
Where("user_id = ?", uid).
Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return &resp, nil
}
func (m *customUserPlatformModel) FindDisplayOneByPlatform(ctx context.Context, tx *gorm.DB, platform string, pUid string) (*UserForDisplay, error) {
var resp UserForDisplay
err := gormx.WithTx(ctx, m.DB, tx).
Table(m.table).
Select(fmt.Sprintf("%s.user_id, %s.p_uname, %s.p_avatar", m.table, m.table, m.table)).
Where("platform = ? AND p_uid = ?", platform, pUid).
Take(&resp).Error
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserPlatformForDisplay), nil
return &resp, nil
}
func (m *customUserPlatformModel) UpdateNobilityByPUid(ctx context.Context, pUid int64, nobility int64) error {
@ -134,7 +150,7 @@ func (m *customUserPlatformModel) FindUserIdByPlatform(ctx context.Context, plat
Table(m.table).
Select(fmt.Sprintf("%s.user_id", m.table)).
Where("platform = ? AND p_uid = ?", platform, pUid).Take(&resp).Error
_, err = gormx.WrapSelectResult(err, resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return 0, err
}

@ -44,7 +44,6 @@ type (
PUname string `gorm:"column:p_uname"` // 平台用户名
PInfo string `gorm:"column:p_info"` // 平台用户原始信息(json)
PAvatar string `gorm:"column:p_avatar"` // 平台用户头像地址
PNobilityLevel int64 `gorm:"column:p_nobility_level"` // 平台贵族等级
CreateTime time.Time `gorm:"column:create_time;default:null"` // 创建时间
UpdateTime time.Time `gorm:"column:update_time;default:null"` // 更新时间
}
@ -67,21 +66,21 @@ func (m *defaultUserPlatformModel) Insert(ctx context.Context, tx *gorm.DB, data
func (m *defaultUserPlatformModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserPlatform, error) {
var resp UserPlatform
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserPlatform{}).Where("`id` = ?", id).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserPlatform), nil
return &resp, nil
}
func (m *defaultUserPlatformModel) FindOneByPlatformPUid(ctx context.Context, tx *gorm.DB, platform string, pUid string) (*UserPlatform, error) {
var resp UserPlatform
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserPlatform{}).Where("`platform` = ? and `p_uid` = ?", platform, pUid).Take(&resp).Error
result, err := gormx.WrapSelectResult(err, &resp)
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return result.(*UserPlatform), nil
return &resp, nil
}
func (m *defaultUserPlatformModel) Update(ctx context.Context, tx *gorm.DB, data *UserPlatform) error {

@ -0,0 +1,140 @@
package model
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"git.noahlan.cn/northlan/ntools-go/uuid"
"github.com/jinzhu/now"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/common/nerr"
"live-service/common/timex"
"time"
)
var _ UserTitleModel = (*customUserTitleModel)(nil)
const (
TitleTypeDefault = "default" // 默认类型 可购买
TitleTypeRank = "rank" // 排行榜类型 不可购买
TitleTypeCustom = "custom" // 自定义类型 不可购买
)
type (
// UserTitleModel is an interface to be customized, add more methods here,
// and implement the added methods in customUserTitleModel.
UserTitleModel interface {
userTitleModel
// FindMaxSort 寻找当前用户的最大Sort 最小值2
FindMaxSort(ctx context.Context, tx *gorm.DB, userId int64) int64
// FindOneByUserIdSort 通过用户和排序号找寻称号
FindOneByUserIdSort(ctx context.Context, tx *gorm.DB, userId int64, sort int64) (*UserTitle, error)
// FindByUserId 查找用户所有列表,按sort升序排列
FindByUserId(ctx context.Context, tx *gorm.DB, userId int64) ([]UserTitle, error)
// Addon 添加新的或延长时间
Addon(ctx context.Context, tx *gorm.DB, userId, titleId int64, titleType string, duration time.Duration, forever bool) error
}
customUserTitleModel struct {
*defaultUserTitleModel
}
)
// NewUserTitleModel returns a model for the database table.
func NewUserTitleModel(conn *gorm.DB) UserTitleModel {
return &customUserTitleModel{
defaultUserTitleModel: newUserTitleModel(conn),
}
}
func (m *customUserTitleModel) FindMaxSort(ctx context.Context, tx *gorm.DB, userId int64) int64 {
db := gormx.WithTx(ctx, m.DB, tx)
var resp int64 = 1
db.Table(m.table).
Select("MAX(sort)").
Where("user_id = ?", userId).
Where("end_time > ?", now.BeginningOfDay()).Take(&resp)
return resp
}
func (m *customUserTitleModel) FindOneByUserIdSort(ctx context.Context, tx *gorm.DB, userId int64, sort int64) (*UserTitle, error) {
db := gormx.WithTx(ctx, m.DB, tx)
var resp UserTitle
err := db.Model(&UserTitle{}).
Where("user_id = ? and sort = ?", userId, sort).Take(&resp).Error
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return &resp, nil
}
func (m *customUserTitleModel) FindByUserId(ctx context.Context, tx *gorm.DB, userId int64) ([]UserTitle, error) {
var resp []UserTitle
err := gormx.WithTx(ctx, m.DB, tx).Table(m.table).
Where("user_id = ?", userId).
Order("sort asc").Find(&resp).Error
err = gormx.WrapSelectErr(err)
if err != nil {
return nil, err
}
return resp, nil
}
func (m *customUserTitleModel) Addon(ctx context.Context, tx *gorm.DB, userId, titleId int64, titleType string, duration time.Duration, forever bool) error {
return m.TransactCtx(ctx, tx, func(tx *gorm.DB) error {
userTitle, err := m.FindOneByUserIdTitleId(ctx, tx, userId, titleId)
if err != nil {
if !errors.Is(err, gormx.ErrNotFound) {
return nerr.NewWithCode(nerr.DBError)
}
}
today := now.BeginningOfDay()
if userTitle == nil {
// sort
maxSort := m.FindMaxSort(ctx, tx, userId)
err = m.Insert(ctx, tx, &UserTitle{
Id: uuid.NextId(),
UserId: userId,
TitleId: titleId,
Sort: maxSort + 1,
Type: titleType,
Forever: BitBool(forever),
StartTime: today,
EndTime: today.Add(duration),
})
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
} else {
// update
if !timex.DayExpire(today, userTitle.EndTime, bool(userTitle.Forever)) {
// 未过期,endTime直接添加1day
userTitle.EndTime = userTitle.EndTime.Add(duration)
err = m.Update(ctx, tx, userTitle)
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
} else {
// 过期,更新日期
err = m.Update(ctx, tx, &UserTitle{
Id: userTitle.Id,
UserId: userId,
TitleId: titleId,
Sort: userTitle.Sort,
Type: titleType,
Forever: BitBool(forever),
StartTime: today,
EndTime: today.Add(duration),
})
if err != nil {
return nerr.NewWithCode(nerr.DBError)
}
}
}
return nil
})
}

@ -0,0 +1,101 @@
// Code generated by goctl. DO NOT EDIT!
package model
import (
"context"
"strings"
"time"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stringx"
"gorm.io/gorm"
)
var (
userTitleFieldNames = builder.RawFieldNames(&UserTitle{})
userTitleRows = strings.Join(userTitleFieldNames, ",")
userTitleRowsExpectAutoSet = strings.Join(stringx.Remove(userTitleFieldNames, "`create_time`", "`update_time`"), ",")
userTitleRowsWithPlaceHolder = strings.Join(stringx.Remove(userTitleFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"
)
type (
userTitleModel interface {
gormx.TxModel
Insert(ctx context.Context, tx *gorm.DB, data *UserTitle) error
FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserTitle, error)
FindOneByUserIdTitleId(ctx context.Context, tx *gorm.DB, userId int64, titleId int64) (*UserTitle, error)
Update(ctx context.Context, tx *gorm.DB, data *UserTitle) error
Delete(ctx context.Context, tx *gorm.DB, id int64) error
}
defaultUserTitleModel struct {
gormx.GormConn
table string
}
UserTitle struct {
Id int64 `gorm:"column:id;primaryKey"` // 主键ID
UserId int64 `gorm:"column:user_id"` // 用户ID
TitleId int64 `gorm:"column:title_id"` // 称号ID
Sort int64 `gorm:"column:sort"` // 排序号
Type string `gorm:"type"` // 称号类型
Forever BitBool `gorm:"forever"` // 永久
StartTime time.Time `gorm:"column:start_time;default:null"` // 开始时间
EndTime time.Time `gorm:"column:end_time;default:null"` // 结束时间
}
)
var UserTitleTableName = "`user_title`"
func newUserTitleModel(conn *gorm.DB) *defaultUserTitleModel {
return &defaultUserTitleModel{
GormConn: gormx.NewConn(conn),
table: UserTitleTableName,
}
}
func (m *defaultUserTitleModel) Insert(ctx context.Context, tx *gorm.DB, data *UserTitle) error {
err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error
return err
}
func (m *defaultUserTitleModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserTitle, error) {
var resp UserTitle
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserTitle{}).Where("`id` = ?", id).Take(&resp).Error
if err = gormx.WrapSelectErr(err); err != nil {
return nil, err
}
return &resp, nil
}
func (m *defaultUserTitleModel) FindOneByUserIdTitleId(ctx context.Context, tx *gorm.DB, userId int64, titleId int64) (*UserTitle, error) {
var resp UserTitle
err := gormx.WithTx(ctx, m.DB, tx).Model(&UserTitle{}).Where("`user_id` = ? and `title_id` = ?", userId, titleId).Take(&resp).Error
if err = gormx.WrapSelectErr(err); err != nil {
return nil, err
}
return &resp, nil
}
func (m *defaultUserTitleModel) Update(ctx context.Context, tx *gorm.DB, data *UserTitle) error {
result := gormx.WithTx(ctx, m.DB, tx).Save(data)
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
}
func (m *defaultUserTitleModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error {
err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserTitle{}, id).Error
return err
}
func (m *defaultUserTitleModel) tableName() string {
return m.table
}
func (UserTitle) TableName() string {
return UserTitleTableName
}

@ -0,0 +1,59 @@
package model
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
var _ ZhgUserDetailsModel = (*customZhgUserDetailsModel)(nil)
type (
// ZhgUserDetailsModel is an interface to be customized, add more methods here,
// and implement the added methods in customZhgUserDetailsModel.
ZhgUserDetailsModel interface {
zhgUserDetailsModel
// Upsert 更新或新增
Upsert(ctx context.Context, tx *gorm.DB, param *UpsertParam) error
}
UpsertParam struct {
UserId int64
Elite *int64
Title *int64
}
customZhgUserDetailsModel struct {
*defaultZhgUserDetailsModel
}
)
// NewZhgUserDetailsModel returns a model for the database table.
func NewZhgUserDetailsModel(conn *gorm.DB) ZhgUserDetailsModel {
return &customZhgUserDetailsModel{
defaultZhgUserDetailsModel: newZhgUserDetailsModel(conn),
}
}
func (m *customZhgUserDetailsModel) Upsert(ctx context.Context, tx *gorm.DB, param *UpsertParam) error {
data := &ZhgUserDetails{UserId: param.UserId}
updateColumns := make([]string, 0)
if param.Title != nil {
updateColumns = append(updateColumns, "title")
data.Title = *param.Title
}
if param.Elite != nil {
updateColumns = append(updateColumns, "elite")
data.Elite = *param.Elite
}
if len(updateColumns) <= 0 {
return errors.New("错误待更新字段数不能小于0")
}
db := gormx.WithTx(ctx, m.DB, tx)
result := db.Clauses(clause.OnConflict{
DoUpdates: clause.AssignmentColumns(updateColumns),
}).Create(&data)
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
}

@ -0,0 +1,85 @@
// Code generated by goctl. DO NOT EDIT!
package model
import (
"context"
"strings"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/zeromicro/go-zero/core/stores/builder"
"github.com/zeromicro/go-zero/core/stringx"
"gorm.io/gorm"
)
var (
zhgUserDetailsFieldNames = builder.RawFieldNames(&ZhgUserDetails{})
zhgUserDetailsRows = strings.Join(zhgUserDetailsFieldNames, ",")
zhgUserDetailsRowsExpectAutoSet = strings.Join(stringx.Remove(zhgUserDetailsFieldNames, "`create_time`", "`update_time`"), ",")
zhgUserDetailsRowsWithPlaceHolder = strings.Join(stringx.Remove(zhgUserDetailsFieldNames, "`user_id`", "`create_time`", "`update_time`"), "=?,") + "=?"
)
type (
zhgUserDetailsModel interface {
gormx.TxModel
Insert(ctx context.Context, tx *gorm.DB, data *ZhgUserDetails) error
FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*ZhgUserDetails, error)
Update(ctx context.Context, tx *gorm.DB, data *ZhgUserDetails) error
Delete(ctx context.Context, tx *gorm.DB, userId int64) error
}
defaultZhgUserDetailsModel struct {
gormx.GormConn
table string
}
ZhgUserDetails struct {
UserId int64 `gorm:"column:user_id;primaryKey"` // 用户ID
Elite int64 `gorm:"column:elite"` // 当前使用的精英单位ID
Title int64 `gorm:"column:title"` // 当前佩戴的称号ID
}
)
var ZhgUserDetailsTableName = "`zhg_user_details`"
func newZhgUserDetailsModel(conn *gorm.DB) *defaultZhgUserDetailsModel {
return &defaultZhgUserDetailsModel{
GormConn: gormx.NewConn(conn),
table: ZhgUserDetailsTableName,
}
}
func (m *defaultZhgUserDetailsModel) Insert(ctx context.Context, tx *gorm.DB, data *ZhgUserDetails) error {
err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error
return err
}
func (m *defaultZhgUserDetailsModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*ZhgUserDetails, error) {
var resp ZhgUserDetails
err := gormx.WithTx(ctx, m.DB, tx).Model(&ZhgUserDetails{}).Where("`user_id` = ?", userId).Take(&resp).Error
if err = gormx.WrapSelectErr(err); err != nil {
return nil, err
}
return &resp, nil
}
func (m *defaultZhgUserDetailsModel) Update(ctx context.Context, tx *gorm.DB, data *ZhgUserDetails) error {
result := gormx.WithTx(ctx, m.DB, tx).Save(data)
return gormx.WrapUpdateErr(result.Error, result.RowsAffected)
}
func (m *defaultZhgUserDetailsModel) Delete(ctx context.Context, tx *gorm.DB, userId int64) error {
err := gormx.WithTx(ctx, m.DB, tx).Delete(&ZhgUserDetails{}, userId).Error
return err
}
func (m *defaultZhgUserDetailsModel) tableName() string {
return m.table
}
func (ZhgUserDetails) TableName() string {
return ZhgUserDetailsTableName
}

@ -1,6 +1,7 @@
Name: usercenter.rpc
ListenOn: 127.0.0.1:40001
Timeout: 5000
Mode: dev
Etcd:
Hosts:
- 127.0.0.1:2379
@ -12,12 +13,11 @@ Log:
KeepDays: 7
Level: info
DB:
#DataSource: root:root@tcp(192.168.1.100:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
DataSource: root:root@tcp(127.0.0.1:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
Kafka:
UserNotify:
UserCoinNotify:
Addr: [ "127.0.0.1:9093" ]
Topic: "notify-user-dev"
Topic: "notify-user-coin-dev"
RankUpdate:
Addr: [ "127.0.0.1:9093" ]
Topic: "rank-update-dev"
@ -27,13 +27,13 @@ Kafka:
UserRetriever:
Enabled: false
UpdateDuration: 720 # 720 hours = 30 Day = 1 Month
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Cron:
PlatformUser: "0 0/5 * * * ?" # 每隔5分钟执行一次
Nobility: "0 0/10 * * * ?" # 每隔10分钟执行一次
NobilityPlatforms: [ "bilibili" ] # 需要获取贵族的平台列表
Bilibili:
RoomId: 8722013
Mid: 6704420
RoomId: 6925399
# Mid: 6704420
RoomShortInfoApi: https://api.live.bilibili.com/room/v1/Room/room_init
TopListApi: https://api.live.bilibili.com/guard/topList
Rank:
@ -47,40 +47,73 @@ GiftCollector:
Cron:
CollectGift: "0 0 0/6 * * ?" # 每隔6小时执行一次
Coin:
# RMB到弹币的转换
RMBToCoin: 100
# 平台礼物到RMB的转换
GiftToRMB:
bilibili: 0.001
# 平台免费礼物到弹币的转换
FreeToCoin:
bilibili: 0.00025
Integral:
# 签到积分配置
# 签到配置
CheckIn:
# 签到积分 一周 0(周日) 1 2 3 4 5 6
Points: [ 15000,3000,3500,5000,6500,8000,10000 ]
Critical: 0.15 # 签到积分暴击率
CriticalRadio: [ 1.3, 1.5, 1.8, 2.0, 2.0, 3.0 ] # 暴击倍率
BattleReport:
GeneralIntegral: 1000 # 名将积分
WinRadio: 0.02 # 伤害量 1/50
LostRadio: 0.008 # 伤害量 1/120
RewardPool:
InitReward: 0
Ratio: 0.7
BattleRatio: 0.75
GiftRatio: 0.5
ReturnRatio: 0.8
WelfareRatio: 0.3
# 签到 一周 0(周日) 1 2 3 4 5 6
Points: [ 60,10,15,20,25,30,50 ]
Critical: 0.08 # 签到暴击率
CriticalRadio: [ 1.2, 1.3, 1.5 ] # 暴击倍率
# RMB到弹币的转换
RMBToIntegral: 100
RMBToCoin: 10
# 平台礼物到RMB的转换
GiftToRMB:
bilibili: 0.001
# 平台免费礼物到弹币的转换
FreeToIntegral:
bilibili: 0.00025
FreeToCoin:
bilibili: 0.01 # 价值1毛
Elite:
LiveDict: { "1": "1001", "2": "1002" }
Default:
Id: 0
Sort: 1
Items:
- Id: 1001
PriceDay: 100
PriceForever: 10000
- Id: 1002
PriceDay: 100
PriceForever: 10000
Title:
LiveDict: { "1": "3" }
Items:
- Id: 99999
Name: 无上意志
Type: custom
- Id: 1
Name: 祁池帝姬
Type: custom
- Id: 2
Name: 废物舰长
Type: custom
- Id: 3
Name: 无用之人
Type: default
PriceDay: 50
PriceForever: 100000
- Id: 1000
Name: 三军统帅 # 名将榜首
Type: rank
RankType: 3
- Id: 1001
Name: 人屠 # 小兵击杀榜首
Type: rank
RankType: 5
- Id: 1002
Name: 破营 # 拆迁榜首
Type: rank
RankType: 7
- Id: 1003
Name: 不败 # 常胜榜首
Type: rank
RankType: 9
- Id: 1004
Name: 勇冠三军 # 一血榜首
Type: rank
RankType: 11
- Id: 1005
Name: 求放过 # 被一血榜首
Type: rank
RankType: 12
GiftPackMap:
- PackType: starter
PackName: 新手礼包
@ -90,7 +123,7 @@ GiftPackMap:
StartTime: "2022-05-21 09:00:00"
EndTime: "2022-05-21 09:00:00"
Content:
Integral: 50000
Coin: 50
- PackType: subsistence
PackName: 低保
Condition:
@ -99,4 +132,4 @@ GiftPackMap:
StartTime: "2022-05-21 09:00:00"
EndTime: "2022-05-21 09:00:00"
Content:
Integrals: [ 10000, 8000, 4000 ]
Coins: [ 10, 15, 20 ]

@ -0,0 +1,153 @@
package coin_manager
import (
"context"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
pbMq "live-service/app/pb/mq"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/mq"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
)
type (
Manager struct {
userCoinModel model.UserCoinModel
userMq *mq.UserMq
logx.Logger
}
ChangeCoinReq struct {
BattleId int64 // 战局ID
UserId int64 // 用户ID
Change int64 // 变化量(负数为减扣)
}
ChangeCoinResp struct {
BattleId int64 // 战局ID
UserId int64 // 用户ID
Change int64 // 变化量(负数为减扣)
Current int64 // 当前量
}
)
func NewCoinManager(mod model.UserCoinModel, userMq *mq.UserMq) *Manager {
return &Manager{
userCoinModel: mod,
userMq: userMq,
Logger: logx.WithContext(context.Background()),
}
}
func (m *Manager) GetUserCoin(ctx context.Context, userId int64) (int64, error) {
resp, err := m.userCoinModel.FindOne(ctx, nil, userId)
if err != nil {
return 0, err
}
return resp.Coin, err
}
func (m *Manager) TransferCoin(ctx context.Context, req *pb.TransferUserCoinReq) (*pb.TransferUserCoinResp, error) {
if req.Transfer < 0 {
req.Transfer = -req.Transfer
}
resp := &pb.TransferUserCoinResp{
UserId: req.UserId,
TargetUserId: req.TargetUserId,
}
if err := m.userCoinModel.TransactCtx(ctx, nil, func(tx *gorm.DB) error {
if req.UserId == 0 {
return nerr.NewError(nerr.RequestParamError, "源用户ID为空")
}
if req.TargetUserId == 0 {
return nerr.NewError(nerr.RequestParamError, "目标用户ID为空")
}
coin, err := m.userCoinModel.ChangeCoin(ctx, tx, req.UserId, -req.Transfer)
if err != nil {
return nerr.NewWithErr(err)
}
targetCoin, err := m.userCoinModel.ChangeCoin(ctx, tx, req.TargetUserId, req.Transfer)
if err != nil {
return nerr.NewWithErr(err)
}
resp.UserCoin = coin
resp.TargetUserCoin = targetCoin
// 通知
go func() {
m.userMq.NotifyUserCoinChanged(&pbMq.MqUserCoinChanged{
UserId: req.UserId,
Change: -req.Transfer,
Current: coin,
Reason: pbVars.UserCoinChangedReason_Transfer,
})
m.userMq.NotifyUserCoinChanged(&pbMq.MqUserCoinChanged{
UserId: req.TargetUserId,
Change: req.Transfer,
Current: targetCoin,
Reason: pbVars.UserCoinChangedReason_Transfer,
})
}()
return nil
}); err != nil {
return nil, err
}
return resp, nil
}
func (m *Manager) ChangeCoin(ctx context.Context, tx *gorm.DB, req *ChangeCoinReq, reason pbVars.UserCoinChangedReason) (*ChangeCoinResp, error) {
coin, err := m.userCoinModel.ChangeCoin(ctx, tx, req.UserId, req.Change)
if err != nil {
return nil, err
}
// 通知
go m.userMq.NotifyUserCoinChanged(&pbMq.MqUserCoinChanged{
UserId: req.UserId,
Change: req.Change,
Current: coin,
Reason: reason,
})
return &ChangeCoinResp{
UserId: req.UserId,
Change: req.Change,
Current: coin,
}, nil
}
func (m *Manager) ChangeCoinBatch(ctx context.Context, req []ChangeCoinReq, reason pbVars.UserCoinChangedReason) (map[int64]ChangeCoinResp, error) {
resp := make(map[int64]ChangeCoinResp)
if err := m.userCoinModel.TransactCtx(ctx, nil, func(tx *gorm.DB) error {
for _, item := range req {
coin, err := m.userCoinModel.ChangeCoin(ctx, tx, item.UserId, item.Change)
if err != nil {
return err
}
resp[item.UserId] = ChangeCoinResp{
BattleId: item.BattleId,
UserId: item.UserId,
Change: item.Change,
Current: coin,
}
}
return nil
}); err != nil {
return resp, err
}
go func() {
for _, coinResp := range resp {
m.userMq.NotifyUserCoinChanged(&pbMq.MqUserCoinChanged{
UserId: coinResp.UserId,
Change: coinResp.Change,
Current: coinResp.Current,
Reason: reason,
})
}
}()
return resp, nil
}

@ -1,132 +0,0 @@
package integral_manager
import (
"context"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/reward_pool"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
)
type (
Manager struct {
cfg Config // 配置
userIntegralModel model.UserIntegralModel
rewardPoolManager *reward_pool.PoolManager
logx.Logger
}
Config struct {
GiftRatio float64
}
ChangeIntegralReq struct {
BattleId int64 // 战局ID
UserId int64 // 用户ID
Change int64 // 变化量(负数为减扣)
Type pb.IntegralType // 积分类型
}
ChangeIntegralResp struct {
BattleId int64 // 战局ID
UserId int64 // 用户ID
Change int64 // 变化量(负数为减扣)
Integral int64 // 剩余积分
}
)
func NewIntegralManager(userIntegralModel model.UserIntegralModel, rewardPoolManager *reward_pool.PoolManager) *Manager {
return &Manager{
userIntegralModel: userIntegralModel,
rewardPoolManager: rewardPoolManager,
Logger: logx.WithContext(context.Background()),
}
}
func (m *Manager) GetUserIntegral(ctx context.Context, userId int64) (int64, error) {
resp, err := m.userIntegralModel.FindOne(ctx, nil, userId)
if err != nil {
return 0, err
}
return resp.Integral, err
}
func (m *Manager) TransferIntegral(ctx context.Context, req *pb.TransferUserIntegralReq) *pb.TransferUserIntegralResp {
resp := &pb.TransferUserIntegralResp{
UserId: req.UserId,
TargetUserId: req.TargetUserId,
}
if err := m.userIntegralModel.TransactCtx(ctx, nil, func(tx *gorm.DB) error {
if req.UserId == 0 {
return nerr.NewError(nerr.RequestParamError, "源用户ID为空")
}
if req.TargetUserId == 0 {
return nerr.NewError(nerr.RequestParamError, "目标用户ID为空")
}
integral, err := m.userIntegralModel.ChangeIntegral(ctx, tx, req.UserId, -req.Transfer)
if err != nil {
return err
}
targetIntegral, err := m.userIntegralModel.ChangeIntegral(ctx, tx, req.TargetUserId, req.Transfer)
if err != nil {
return err
}
resp.Code = int32(nerr.OK)
resp.Msg = "转移成功"
resp.UserIntegral = integral
resp.TargetUserIntegral = targetIntegral
return nil
}); err != nil {
if e, ok := err.(*nerr.Error); ok {
resp.Code = int32(e.Code)
resp.Msg = e.Msg
} else {
resp.Code = int32(nerr.ServerCommonError)
resp.Msg = "转移失败,未知原因"
}
}
return resp
}
func (m *Manager) ChangeIntegral(ctx context.Context, req *ChangeIntegralReq, rewardPool bool) (*ChangeIntegralResp, error) {
integral, err := m.userIntegralModel.ChangeIntegral(ctx, nil, req.UserId, req.Change)
if err != nil {
return nil, err
}
if req.BattleId != 0 && rewardPool {
m.rewardPoolManager.Pool(req.BattleId).Add(req.UserId, req.Change, req.Type)
}
return &ChangeIntegralResp{
UserId: req.UserId,
Change: req.Change,
Integral: integral,
}, nil
}
func (m *Manager) ChangeIntegralBatch(ctx context.Context, req []ChangeIntegralReq, rewardPool bool) (map[int64]ChangeIntegralResp, error) {
resp := make(map[int64]ChangeIntegralResp)
if err := m.userIntegralModel.TransactCtx(ctx, nil, func(tx *gorm.DB) error {
for _, item := range req {
integral, err := m.userIntegralModel.ChangeIntegral(ctx, tx, item.UserId, item.Change)
if err != nil {
return err
}
resp[item.UserId] = ChangeIntegralResp{
BattleId: item.BattleId,
UserId: item.UserId,
Change: item.Change,
Integral: integral,
}
}
return nil
}); err != nil {
return resp, err
}
// 奖池
for _, item := range req {
if item.BattleId != 0 && rewardPool {
m.rewardPoolManager.Pool(item.BattleId).Add(item.UserId, item.Change, item.Type)
}
}
return resp, nil
}

@ -1,9 +1,9 @@
package reward_pool
import (
"git.noahlan.cn/northlan/ntools-go/kafka"
"github.com/shopspring/decimal"
pbMq "live-service/app/pb/mq"
"live-service/app/user_center/rpc/internal/mq"
"live-service/app/user_center/rpc/pb"
"sort"
"sync"
@ -31,7 +31,7 @@ type (
initReward int64 // 初始奖池
ratio Ratio // 比例
producer *kafka.Producer // kafka
rewardPoolMq *mq.RewardPool
mutex sync.Mutex
}
@ -58,12 +58,12 @@ type (
)
// NewRewardPoolManager 构建奖池
func NewRewardPoolManager(initReward int64, ratio Ratio, producer *kafka.Producer) *PoolManager {
func NewRewardPoolManager(initReward int64, ratio Ratio, rewardPoolMq *mq.RewardPool) *PoolManager {
return &PoolManager{
initReward: initReward,
pools: make(map[int64]*pool),
producer: producer,
ratio: ratio,
rewardPoolMq: rewardPoolMq,
}
}
@ -84,7 +84,7 @@ func (p *PoolManager) Draw(battleId int64, req []DrawRequest) *DrawResult {
// 移除奖池
p.Remain(battleId)
// 变动通知
_ = p.producer.SendMessageAsync(&pbMq.MqRewardPool{
p.rewardPoolMq.RewardPoolChanged(&pbMq.MqRewardPool{
WelfarePool: p.welfarePool,
BattleId: battleId,
InitReward: 0,
@ -164,7 +164,6 @@ func (p *pool) draw(req []DrawRequest) *DrawResult {
remainRewards -= tmp
}
// TODO 奖池分的其余用途
// 用户瓜分奖池
for _, item := range req {
// 计算战斗积分分配比例
@ -219,7 +218,7 @@ func (p *pool) Add(userId, val int64, integralType pb.IntegralType) int64 {
}
result := p.Rewards()
// 变动通知
_ = p.manager.producer.SendMessageAsync(&pbMq.MqRewardPool{
p.manager.rewardPoolMq.RewardPoolChanged(&pbMq.MqRewardPool{
WelfarePool: p.manager.initReward,
BattleId: p.id,
InitReward: p.initReward,

@ -1,36 +1,24 @@
package config
import (
"fmt"
"github.com/knadh/koanf"
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/file"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/zrpc"
)
type (
Kafka struct {
KafkaConf struct {
Addr []string // 连接地址
Topic string
}
GiftPack struct {
PackType string // 礼包类型
PackName string // 礼包名称
// Condition 领取条件
Condition struct {
UserLimit int32 // 单人可领取数量
UserResetType string `json:",optional"` // 用户礼包重置类型: 不重置(unset)|每天(daily)|每周(weekly)|每月(monthly)
StartTime string // 可领取时间(开始) 两个时间相等则不限期领取
EndTime string // 可领取时间(结束)
}
// Content 礼包内容
Content struct {
Integral int64 `json:",default=0"` // 积分数
Integrals []int64 `json:",optional"` // 积分数(多次领取,每次不同)
// Title 奖励称号列表
Title []struct {
Id int64 // 称号ID
Duration int64 // 持续时长,单位: 秒 -1无限
} `json:",optional"`
}
KafkaProducer struct {
UserCoinNotify KafkaConf // 用户金币变动通知
RankUpdate KafkaConf // 排行榜更新通知队列
RewardPool KafkaConf // 奖池通知
}
// Config 配置
@ -41,73 +29,48 @@ type (
DataSource string
}
// Kafka 消息队列配置
Kafka struct {
UserNotify Kafka // 用户信息通知队列
RankUpdate Kafka // 排行榜更新通知队列
RewardPool Kafka // 奖池通知
}
UserRetriever struct {
Enabled bool // 是否开启
UpdateDuration int64 // 用户信息更新最短间隔 单位 h
NobilityPlatforms []string // 需要获取贵族的平台
Cron struct {
PlatformUser string
Nobility string
}
Bilibili struct {
RoomId int64 // 直播房间号
Mid int64 `json:",optional"` // 主播UID 不输入就通过API获取
RoomShortInfoApi string // 房间简短信息API
TopListApi string
}
}
Rank struct {
Enabled bool // 是否开启
Cron struct {
Update string // 更新榜单
Persistence string // 持久化
}
Kafka KafkaProducer
}
GiftCollector struct {
Enabled bool // 是否开启
Platforms []string // 需搜集的平台
Cron struct {
CollectGift string
)
var k = koanf.New(".")
func MustLoad(filepath string, v interface{}) {
f := file.Provider(filepath)
err := f.Watch(func(event interface{}, err error) {
if err != nil {
fmt.Printf("配置文件热重载失败: %v\n", err)
return
}
k = koanf.New(".")
err = loadAndUnmarshal(f, v)
if err != nil {
fmt.Printf("配置文件热重载失败: %v\n", err)
return
}
fmt.Printf("重载配置文件: %+v\n", v)
})
if err != nil {
panic(err)
}
// 弹币
Coin struct {
RMBToCoin float64 // RMB到弹币的转换
GiftToRMB map[string]float64 // 平台礼物到RMB的转换
FreeToCoin map[string]float64 // 平台免费礼物到弹币的转换
mustLoadAndUnmarshal(f, v)
}
Integral struct {
// CheckIn 签到
CheckIn struct {
Points []int64 // 签到积分 次数分数
Critical float32 // 暴击率(百分比)
CriticalRadio []float32 // 暴击倍数
func loadAndUnmarshal(f *file.File, v interface{}) (err error) {
err = k.Load(f, yaml.Parser())
if err != nil {
return
}
// 战局积分
BattleReport struct {
GeneralIntegral int64 // 名将积分
WinRadio float64 // 获胜方积分因子 乘法
LostRadio float64 // 失败方积分因子 乘法
err = k.UnmarshalWithConf("", v, koanf.UnmarshalConf{Tag: "cfg"})
if err != nil {
return
}
// 奖池
RewardPool struct {
InitReward int64 // 奖池初始积分
Ratio float64 // 奖池结算比例
GiftRatio float64 // 礼物算入奖池比例
BattleRatio float64 // 战斗消耗积分算入奖池比例
ReturnRatio float64 // 回收积分比例
WelfareRatio float64 // 福利池从奖金扣除比例
return
}
RMBToIntegral float64 // RMB到弹币的转换
GiftToRMB map[string]float64 // 平台礼物到RMB的转换
FreeToIntegral map[string]float64 // 平台免费礼物到弹币的转换
func mustLoadAndUnmarshal(f *file.File, v interface{}) {
if err := loadAndUnmarshal(f, v); err != nil {
panic(err)
}
// GiftPack 礼包配置
GiftPackMap []GiftPack
}
)

@ -0,0 +1,136 @@
package config
import "github.com/pkg/errors"
type (
Elite struct {
LiveDict map[int32]int64 // 直播间序号对应ID
Default struct {
Id int64
Sort int32
} // 默认
Items []EliteItem
}
// EliteItem 精英单位
EliteItem struct {
Id int64 // 单位ID
PriceDay int64 // 每天价格(弹币)
PriceForever int64 // 永久价格
}
Title struct {
LiveDict map[int32]int64 // 直播间序号对应ID
Items []TitleItem
}
// TitleItem 称号
TitleItem struct {
Id int64 // 称号ID
Name string // 称号名
Type string // 称号类型
RankType int32 // 作用的排行榜类型
PriceDay int64 // 每天价格(弹币)
PriceForever int64 // 永久价格(弹币)
}
GiftPack struct {
PackType string // 礼包类型
PackName string // 礼包名称
// Condition 领取条件
Condition struct {
UserLimit int32 // 单人可领取数量
UserResetType string // 用户礼包重置类型: 不重置(unset)|每天(daily)|每周(weekly)|每月(monthly)
StartTime string // 可领取时间(开始) 两个时间相等则不限期领取
EndTime string // 可领取时间(结束)
}
// Content 礼包内容
Content struct {
Coin int64 // 积分数
Coins []int64 // 积分数(多次领取,每次不同)
// Title 奖励称号列表
Title []struct {
Id int64 // 称号ID
Duration int64 // 持续时长,单位: 秒 -1无限
}
}
}
GameConfig struct {
UserRetriever struct {
Enabled bool // 是否开启
UpdateDuration int64 // 用户信息更新最短间隔 单位 h
NobilityPlatforms []string // 需要获取贵族的平台
Cron struct {
PlatformUser string
Nobility string
}
Bilibili struct {
RoomId int64 // 直播房间号
Mid int64 // 主播UID 不输入就通过API获取
RoomShortInfoApi string // 房间简短信息API
TopListApi string
}
}
Rank struct {
Enabled bool // 是否开启
Cron struct {
Update string // 更新榜单
Persistence string // 持久化
}
}
GiftCollector struct {
Enabled bool // 是否开启
Platforms []string // 需搜集的平台
Cron struct {
CollectGift string
}
}
// 弹币
Coin struct {
// CheckIn 签到
CheckIn struct {
Points []int64 // 签到积分 次数分数
Critical float32 // 暴击率(百分比)
CriticalRadio []float32 // 暴击倍数
}
RMBToCoin float64 // RMB到弹币的转换
GiftToRMB map[string]float64 // 平台礼物到RMB的转换
FreeToCoin map[string]float64 // 平台免费礼物到弹币的转换
}
// 精英单位
Elite Elite
// 称号
Title Title
// GiftPack 礼包配置
GiftPackMap []GiftPack
}
)
func (c *Title) FindTitleCfg(id int64) (*TitleItem, error) {
for _, item := range c.Items {
if id == item.Id {
return &item, nil
}
}
return nil, errors.New("未找到ID对应的称号配置")
}
func (c *Title) FindTitleCfgByLive(sort int32) (*TitleItem, error) {
if id, ok := c.LiveDict[sort]; ok {
return c.FindTitleCfg(id)
}
return nil, errors.New("未找到sort对应的称号配置")
}
func (c *Elite) FindEliteCfg(id int64) (*EliteItem, error) {
for _, item := range c.Items {
if id == item.Id {
return &item, nil
}
}
return nil, errors.New("未找到ID对应的精英单位配置")
}
func (c *Elite) FindEliteCfgByLive(sort int32) (*EliteItem, error) {
if id, ok := c.LiveDict[sort]; ok {
return c.FindEliteCfg(id)
}
return nil, errors.New("未找到sort对应的精英单位配置")
}

@ -0,0 +1,41 @@
package coin
import (
"context"
"github.com/pkg/errors"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ChangeCoinLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewChangeCoinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeCoinLogic {
return &ChangeCoinLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// changeCoin 新增或扣减用户弹币
func (l *ChangeCoinLogic) ChangeCoin(in *pb.ChangeCoinReq) (*pb.Empty, error) {
_, err := l.svcCtx.CoinManager.ChangeCoin(l.ctx, nil, &coin_manager.ChangeCoinReq{
BattleId: in.BattleId,
UserId: in.UserId,
Change: in.Change,
}, in.Reason)
if err != nil {
return nil, errors.Wrapf(nerr.NewWithErr(err), "记录弹币失败, err:%+v", err)
}
return &pb.Empty{}, nil
}

@ -0,0 +1,40 @@
package coin
import (
"context"
"github.com/pkg/errors"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type GetUserCoinLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetUserCoinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserCoinLogic {
return &GetUserCoinLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// getUserCoin 获取用户弹币
func (l *GetUserCoinLogic) GetUserCoin(in *pb.UserIdReq) (*pb.GetUserCoinResp, error) {
// 查询当前用户积分
coin, err := l.svcCtx.CoinManager.GetUserCoin(l.ctx, in.UserId)
if err != nil {
return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "查询用户弹币失败, err:%+v", err)
}
return &pb.GetUserCoinResp{
UserId: in.UserId,
Current: coin,
}, nil
}

@ -0,0 +1,44 @@
package coin
import (
"context"
"github.com/pkg/errors"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type TransferUserCoinLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewTransferUserCoinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TransferUserCoinLogic {
return &TransferUserCoinLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// transferUserCoin 转移用户弹币
func (l *TransferUserCoinLogic) TransferUserCoin(in *pb.TransferUserCoinReq) (*pb.TransferUserCoinResp, error) {
transResp, err := l.svcCtx.CoinManager.TransferCoin(l.ctx, in)
if err != nil {
return nil, errors.Wrap(nerr.NewWithErr(err), "转移弹币失败")
}
// 获取 username
if tmp, err := l.svcCtx.UserPlatformModel.FindDisplayOneByUserId(l.ctx, transResp.UserId); err == nil {
transResp.Uname = tmp.PUname
transResp.Avatar = tmp.PAvatar
}
if tmp, err := l.svcCtx.UserPlatformModel.FindDisplayOneByUserId(l.ctx, transResp.TargetUserId); err == nil {
transResp.TargetUname = tmp.PUname
transResp.TargetAvatar = tmp.PAvatar
}
return transResp, nil
}

@ -1,30 +0,0 @@
package draw_pool
import (
"context"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type IncreaseWelfareLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewIncreaseWelfareLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IncreaseWelfareLogic {
return &IncreaseWelfareLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *IncreaseWelfareLogic) IncreaseWelfare(in *pb.IncreaseWelfareReq) (*pb.Empty, error) {
// todo: add your logic here and delete this line
return &pb.Empty{}, nil
}

@ -28,10 +28,10 @@ func NewUserBuyNobilityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U
// UserBuyNobility 用户购买贵族
// 1. 记录送礼 + 新增积分
// 2. 修改贵族
func (l *UserBuyNobilityLogic) UserBuyNobility(in *pb.UserBuyNobilityReq) (*pb.UserBuyNobilityResp, error) {
func (l *UserBuyNobilityLogic) UserBuyNobility(in *pb.UserBuyNobilityReq) (*pb.Empty, error) {
// 记录送礼信息
sendGiftLogic := NewUserSendGiftLogic(l.ctx, l.svcCtx)
integralChanged, err := sendGiftLogic.UserSendGift(&pb.UserSendGiftReq{
_, err := sendGiftLogic.UserSendGift(&pb.UserSendGiftReq{
Platform: in.Platform,
UserId: in.UserId,
PUid: in.PUid,
@ -58,11 +58,5 @@ func (l *UserBuyNobilityLogic) UserBuyNobility(in *pb.UserBuyNobilityReq) (*pb.U
return nil, errors.Wrapf(nerr.NewError(nerr.GiftNobilityUpdateErr, "更新贵族信息失败"), "更新贵族信息失败 err:%v", err)
}
return &pb.UserBuyNobilityResp{
Integral: &pb.ChangeIntegralResp{
UserId: integralChanged.Integral.UserId,
Change: integralChanged.Integral.Change,
Integral: integralChanged.Integral.Integral,
},
}, nil
return &pb.Empty{}, nil
}

@ -3,11 +3,14 @@ package gift
import (
"context"
"git.noahlan.cn/northlan/ntools-go/uuid"
"github.com/pkg/errors"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/integral_manager"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/app/user_center/rpc/internal/logic/gift_collect"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"strconv"
"github.com/zeromicro/go-zero/core/logx"
@ -30,8 +33,7 @@ func NewUserSendGiftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *User
// UserSendGift 用户赠送礼物
// 1. 记录用户赠送信息
// 2. 新增用户积分
func (l *UserSendGiftLogic) UserSendGift(in *pb.UserSendGiftReq) (*pb.UserSendGiftResp, error) {
resp := &pb.UserSendGiftResp{}
func (l *UserSendGiftLogic) UserSendGift(in *pb.UserSendGiftReq) (*pb.Empty, error) {
// 记录送礼信息
{
dbUserGift := &model.UserGift{
@ -53,29 +55,22 @@ func (l *UserSendGiftLogic) UserSendGift(in *pb.UserSendGiftReq) (*pb.UserSendGi
}
}
// 积分
// 弹币
{
// 计算积分
addonIntegral := calcIntegral(l.svcCtx.Config, in.Platform, in.IsPaid, float64(in.Price), in.Num)
addonCoin := calcCoin(l.svcCtx.GameConfig, in.Platform, in.IsPaid, float64(in.Price), in.Num)
if tmpMap, ok := gift_collect.Service.GetCacheByPlatform(in.Platform); ok {
if tmpData, ok := tmpMap[in.GiftId]; ok {
addonIntegral = calcIntegral(l.svcCtx.Config, in.Platform, tmpData.IsPaid, tmpData.Price, in.Num)
addonCoin = calcCoin(l.svcCtx.GameConfig, in.Platform, tmpData.IsPaid, tmpData.Price, in.Num)
}
}
newIntegral, err := l.svcCtx.IntegralManager.ChangeIntegral(l.ctx, &integral_manager.ChangeIntegralReq{
_, err := l.svcCtx.CoinManager.ChangeCoin(l.ctx, nil, &coin_manager.ChangeCoinReq{
BattleId: in.BattleId,
UserId: in.UserId,
Change: addonIntegral,
Type: pb.IntegralType_Gift,
}, true)
Change: addonCoin,
}, pbVars.UserCoinChangedReason_SendGift)
if err != nil {
return nil, err
}
resp.Integral = &pb.ChangeIntegralResp{
UserId: in.UserId,
Change: newIntegral.Change,
Integral: newIntegral.Integral,
return nil, errors.Wrapf(nerr.NewWithErr(err), "添加弹币失败 err:%v", err)
}
}
return resp, nil
return &pb.Empty{}, nil
}

@ -5,21 +5,24 @@ import (
"live-service/app/user_center/rpc/internal/config"
)
func calcIntegral(cfg config.Config, platform string, isPaid bool, price float64, num int64) int64 {
giftToRMBRadio, _ := cfg.Integral.GiftToRMB[platform]
freeToIntegralRadio, _ := cfg.Integral.FreeToIntegral[platform]
rmbToIntegral := cfg.Integral.RMBToIntegral
func calcCoin(cfg *config.GameConfig, platform string, isPaid bool, price float64, num int64) int64 {
giftToRMBRadio, _ := cfg.Coin.GiftToRMB[platform]
freeToRadio, _ := cfg.Coin.FreeToCoin[platform]
rmbTo := cfg.Coin.RMBToCoin
var newPrice float64
if isPaid {
newPrice = price * giftToRMBRadio
} else {
newPrice = price * freeToIntegralRadio
newPrice = price * freeToRadio
}
decimal.DivisionPrecision = 2
return decimal.NewFromFloat(newPrice).
Mul(decimal.NewFromInt(num)).
Mul(decimal.NewFromFloat(rmbToIntegral)).
Round(0).IntPart()
resp := decimal.NewFromFloat(newPrice).
Mul(decimal.NewFromInt(num))
if isPaid {
resp = resp.Mul(decimal.NewFromFloat(rmbTo))
}
return resp.Round(0).IntPart()
}

@ -45,14 +45,14 @@ func InitCollector(svcCtx *svc.ServiceContext) {
Logger: logx.WithContext(ctx),
}
if !svcCtx.Config.GiftCollector.Enabled {
if !svcCtx.GameConfig.GiftCollector.Enabled {
return
}
Service.startJob()
}
func (c *GiftCollector) startJob() {
cfg := c.svcCtx.Config.GiftCollector
cfg := c.svcCtx.GameConfig.GiftCollector
// 先执行一次
c.collectGift(cfg.Platforms...)

@ -25,6 +25,7 @@ type (
Name string `json:"name"` // 礼物名称
Price int64 `json:"price"` // 礼物单价
CoinType string `json:"coin_type"` // 瓜子类型 gold金瓜子 silver银瓜子
ImgBasic string `json:"img_basic"` // 礼物图
}
)
@ -40,7 +41,7 @@ func isPaidGift(coinType string) bool {
func GiftCollectorBilibili(ctx context.Context, svcCtx *svc.ServiceContext) (ret map[int64]GiftData, err error) {
const platform = "bilibili"
radio, _ := svcCtx.Config.Integral.GiftToRMB[platform]
radio, _ := svcCtx.GameConfig.Coin.GiftToRMB[platform]
// 1. 读取API
httpResp, err := http.Get("https://api.live.bilibili.com/xlive/web-room/v1/giftPanel/giftConfig?platform=app")
@ -83,6 +84,7 @@ func GiftCollectorBilibili(ctx context.Context, svcCtx *svc.ServiceContext) (ret
Id: uuid.NextId(),
GiftId: strconv.FormatInt(gift.Id, 10),
GiftName: gift.Name,
Pic: gift.ImgBasic,
Platform: platform,
}
giftData := GiftData{

@ -1,46 +0,0 @@
package integral
import (
"context"
"github.com/pkg/errors"
"live-service/app/user_center/rpc/internal/common/integral_manager"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ChangeIntegralLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewChangeIntegralLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeIntegralLogic {
return &ChangeIntegralLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ChangeIntegral 更改用户积分
func (l *ChangeIntegralLogic) ChangeIntegral(in *pb.ChangeIntegralReq) (*pb.ChangeIntegralResp, error) {
integral, err := l.svcCtx.IntegralManager.ChangeIntegral(l.ctx, &integral_manager.ChangeIntegralReq{
BattleId: in.BattleId,
UserId: in.UserId,
Change: in.Change,
Type: in.IntegralType,
}, true)
if err != nil {
return nil, errors.Wrapf(nerr.NewWithErr(err), "记录积分失败, err:%+v", err)
}
return &pb.ChangeIntegralResp{
UserId: in.UserId,
Change: in.Change,
Integral: integral.Integral,
}, nil
}

@ -1,40 +0,0 @@
package integral
import (
"context"
"github.com/pkg/errors"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type GetUserIntegralLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetUserIntegralLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserIntegralLogic {
return &GetUserIntegralLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// GetUserIntegral 获取用户积分
func (l *GetUserIntegralLogic) GetUserIntegral(in *pb.UserIdReq) (*pb.UserIntegralResp, error) {
// 查询当前用户积分
integral, err := l.svcCtx.UserIntegralModel.FindOne(l.ctx, nil, in.UserId)
if err != nil {
return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "查询用户积分失败, err:%+v", err)
}
return &pb.UserIntegralResp{
UserId: in.UserId,
Integral: integral.Integral,
}, nil
}

@ -1,41 +0,0 @@
package integral
import (
"context"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"github.com/zeromicro/go-zero/core/logx"
)
type TransferUserIntegralLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewTransferUserIntegralLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TransferUserIntegralLogic {
return &TransferUserIntegralLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// TransferUserIntegral 转移积分
func (l *TransferUserIntegralLogic) TransferUserIntegral(in *pb.TransferUserIntegralReq) (*pb.TransferUserIntegralResp, error) {
transResp := l.svcCtx.IntegralManager.TransferIntegral(l.ctx, in)
if transResp.Code == int32(nerr.OK) {
// 获取 username
if tmp, err := l.svcCtx.UserPlatformModel.FindDisplayOneByUserId(l.ctx, transResp.UserId); err == nil {
transResp.Uname = tmp.PUname
transResp.Avatar = tmp.PAvatar
}
if tmp, err := l.svcCtx.UserPlatformModel.FindDisplayOneByUserId(l.ctx, transResp.TargetUserId); err == nil {
transResp.TargetUname = tmp.PUname
transResp.TargetAvatar = tmp.PAvatar
}
}
return transResp, nil
}

@ -41,7 +41,7 @@ type RetrieveFunc func(pUid string) (*PlatformUser, error)
type NobilityFunc func(svcCtx *svc.ServiceContext) ([]NobilityData, error)
func InitUserRetriever(svcCtx *svc.ServiceContext) {
cfg := svcCtx.Config.UserRetriever
cfg := svcCtx.GameConfig.UserRetriever
if !cfg.Enabled {
return
}
@ -63,7 +63,7 @@ func InitUserRetriever(svcCtx *svc.ServiceContext) {
func (r *UserRetriever) initJob() {
logx.Info("开启用户数据采集服务...")
cfg := r.svcCtx.Config.UserRetriever
cfg := r.svcCtx.GameConfig.UserRetriever
c := cron.New(cron.WithSeconds())
// 获取平台用户信息
_, _ = c.AddFunc(cfg.Cron.PlatformUser, func() {
@ -104,7 +104,7 @@ func (r *UserRetriever) retrievePlatformUser() {
r.retrieveList(list)
// 优先加载空信息用户
if len(list) <= 0 {
if list, err = r.svcCtx.UserPlatformModel.FindUpdatableList(r.ctx, r.svcCtx.Config.UserRetriever.UpdateDuration, 5); err != nil {
if list, err = r.svcCtx.UserPlatformModel.FindUpdatableList(r.ctx, r.svcCtx.GameConfig.UserRetriever.UpdateDuration, 5); err != nil {
return
}
r.retrieveList(list)

@ -124,7 +124,7 @@ type (
)
func NobilityBilibili(svcCtx *svc.ServiceContext) ([]NobilityData, error) {
cfg := svcCtx.Config.UserRetriever.Bilibili
cfg := svcCtx.GameConfig.UserRetriever.Bilibili
if cfg.Mid == 0 {
if mId, err := fetchMid(cfg.RoomShortInfoApi, cfg.RoomId); err != nil {
return nil, err

@ -8,6 +8,7 @@ import (
"github.com/pkg/errors"
"github.com/robfig/cron/v3"
"github.com/zeromicro/go-zero/core/logx"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
@ -27,20 +28,7 @@ type (
svcCtx *svc.ServiceContext
// 实时排行榜(定期读取,半实时)
rankByTypeMap map[pb.RankType]*zset.ZSetInt
//damageRank *zset.ZSetInt
//deDamageRank *zset.ZSetInt
//generalRank *zset.ZSetInt
//deGeneralRank *zset.ZSetInt
//killUnitRank *zset.ZSetInt
//deKillUnitRank *zset.ZSetInt
//killPlayerRank *zset.ZSetInt
//deKillPlayerRank *zset.ZSetInt
//winRank *zset.ZSetInt
//lostRank *zset.ZSetInt
//firstBloodRank *zset.ZSetInt
//deFirstBloodRank *zset.ZSetInt
rankByTypeMap map[pbVars.RankType]*zset.ZSetInt
// 用户数据表内存缓存
userCache *lru.Cache
@ -55,24 +43,24 @@ func InitRankJob(svcCtx *svc.ServiceContext) {
Service = &Job{
ctx: context.Background(),
svcCtx: svcCtx,
rankByTypeMap: map[pb.RankType]*zset.ZSetInt{
pb.RankType_Damage: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_DeDamage: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_General: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_DeGeneral: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_KillUnit: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_DeKillUnit: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_KillPlayer: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_DeKillPlayer: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_Win: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_Lost: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_FirstBlood: zset.NewZSetInt(lessFunc, model.MaxRankN),
pb.RankType_DeFirstBlood: zset.NewZSetInt(lessFunc, model.MaxRankN),
rankByTypeMap: map[pbVars.RankType]*zset.ZSetInt{
pbVars.RankType_Damage: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_DeDamage: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_General: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_DeGeneral: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_KillUnit: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_DeKillUnit: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_KillPlayer: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_DeKillPlayer: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_Win: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_Lost: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_FirstBlood: zset.NewZSetInt(lessFunc, model.MaxRankN),
pbVars.RankType_DeFirstBlood: zset.NewZSetInt(lessFunc, model.MaxRankN),
},
userCache: uc,
}
if !svcCtx.Config.Rank.Enabled {
if !svcCtx.GameConfig.Rank.Enabled {
return
}
Service.initJob()
@ -84,56 +72,43 @@ func InitRankJob(svcCtx *svc.ServiceContext) {
// 3. 开启任务 定时落库
func (j *Job) initJob() {
logx.Info("开启排行榜服务...")
// TODO 读取历史数据功能暂时移除
//j.initByType(model.RankTypeDamage)
//j.initByType(model.RankTypeDeDamage)
//j.initByType(model.RankTypeGeneral)
//j.initByType(model.RankTypeDeGeneral)
//j.initByType(model.RankTypeKillUnit)
//j.initByType(model.RankTypeDeKillUnit)
//j.initByType(model.RankTypeKillPlayer)
//j.initByType(model.RankTypeDeKillPlayer)
//j.initByType(model.RankTypeWin)
//j.initByType(model.RankTypeLost)
//j.initByType(model.RankTypeFirstBlood)
//j.initByType(model.RankTypeDeFirstBlood)
cfg := j.svcCtx.Config.Rank
cfg := j.svcCtx.GameConfig.Rank
// job read and update
c := cron.New()
_, _ = c.AddFunc(cfg.Cron.Update, func() {
go j.readAndUpdate(pb.RankType_Damage)
go j.readAndUpdate(pb.RankType_DeDamage)
go j.readAndUpdate(pb.RankType_General)
go j.readAndUpdate(pb.RankType_DeGeneral)
go j.readAndUpdate(pb.RankType_KillUnit)
go j.readAndUpdate(pb.RankType_DeKillUnit)
go j.readAndUpdate(pb.RankType_KillPlayer)
go j.readAndUpdate(pb.RankType_DeKillPlayer)
go j.readAndUpdate(pb.RankType_Win)
go j.readAndUpdate(pb.RankType_Lost)
go j.readAndUpdate(pb.RankType_FirstBlood)
go j.readAndUpdate(pb.RankType_DeFirstBlood)
go j.readAndUpdate(pbVars.RankType_Damage)
go j.readAndUpdate(pbVars.RankType_DeDamage)
go j.readAndUpdate(pbVars.RankType_General)
go j.readAndUpdate(pbVars.RankType_DeGeneral)
go j.readAndUpdate(pbVars.RankType_KillUnit)
go j.readAndUpdate(pbVars.RankType_DeKillUnit)
go j.readAndUpdate(pbVars.RankType_KillPlayer)
go j.readAndUpdate(pbVars.RankType_DeKillPlayer)
go j.readAndUpdate(pbVars.RankType_Win)
go j.readAndUpdate(pbVars.RankType_Lost)
go j.readAndUpdate(pbVars.RankType_FirstBlood)
go j.readAndUpdate(pbVars.RankType_DeFirstBlood)
})
// persistence
_, _ = c.AddFunc(cfg.Cron.Persistence, func() {
go j.persistence(pb.RankType_Damage)
go j.persistence(pb.RankType_DeDamage)
go j.persistence(pb.RankType_General)
go j.persistence(pb.RankType_DeGeneral)
go j.persistence(pb.RankType_KillUnit)
go j.persistence(pb.RankType_DeKillUnit)
go j.persistence(pb.RankType_KillPlayer)
go j.persistence(pb.RankType_DeKillPlayer)
go j.persistence(pb.RankType_Win)
go j.persistence(pb.RankType_Lost)
go j.persistence(pb.RankType_FirstBlood)
go j.persistence(pb.RankType_DeFirstBlood)
go j.persistence(pbVars.RankType_Damage)
go j.persistence(pbVars.RankType_DeDamage)
go j.persistence(pbVars.RankType_General)
go j.persistence(pbVars.RankType_DeGeneral)
go j.persistence(pbVars.RankType_KillUnit)
go j.persistence(pbVars.RankType_DeKillUnit)
go j.persistence(pbVars.RankType_KillPlayer)
go j.persistence(pbVars.RankType_DeKillPlayer)
go j.persistence(pbVars.RankType_Win)
go j.persistence(pbVars.RankType_Lost)
go j.persistence(pbVars.RankType_FirstBlood)
go j.persistence(pbVars.RankType_DeFirstBlood)
})
c.Start()
}
func (j *Job) RankByScore(rankType pb.RankType, score int32) int32 {
func (j *Job) RankByScore(rankType pbVars.RankType, score int32) int32 {
rankZSet, _, err := j.getRankInstanceAndScoreType(rankType)
if err != nil {
return 0
@ -146,9 +121,9 @@ func (j *Job) RankByScore(rankType pb.RankType, score int32) int32 {
return 0
}
func (j *Job) RangeRankByType(rankType pb.RankType, topN int32) *pb.RankPvpResp {
func (j *Job) RangeRankByType(rankType pbVars.RankType, topN int32) *pb.RankPvpResp {
result := &pb.RankPvpResp{
Type: int32(rankType),
Type: rankType,
}
rankZSet, _, err := j.getRankInstanceAndScoreType(rankType)
if err != nil {
@ -195,27 +170,7 @@ func (j *Job) RangeRankByType(rankType pb.RankType, topN int32) *pb.RankPvpResp
return result
}
func (j *Job) initByType(rankType pb.RankType) {
list, err := j.svcCtx.RankPvpModel.RankListByType(j.ctx, int64(rankType), model.MaxRankN)
if err != nil {
return
}
rankZSet, _, err := j.getRankInstanceAndScoreType(rankType)
if err != nil {
return
}
for _, user := range list {
// 缓存用户信息
j.userCache.Add(user.UserId, CachedUserInfo{
UserId: user.UserId,
Username: user.PUname,
Avatar: user.PAvatar,
})
rankZSet.Add(user.UserId, int32(user.Score))
}
}
func (j *Job) readAndUpdate(rankType pb.RankType) {
func (j *Job) readAndUpdate(rankType pbVars.RankType) {
rankZSet, scoreType, err := j.getRankInstanceAndScoreType(rankType)
if err != nil {
return
@ -259,7 +214,7 @@ func (j *Job) readAndUpdate(rankType pb.RankType) {
}
}
func (j *Job) persistence(rankType pb.RankType) {
func (j *Job) persistence(rankType pbVars.RankType) {
rankZSet, _, err := j.getRankInstanceAndScoreType(rankType)
if err != nil {
return
@ -286,7 +241,7 @@ func (j *Job) persistence(rankType pb.RankType) {
}
}
func (j *Job) getRankInstanceAndScoreType(rankType pb.RankType) (*zset.ZSetInt, model.ScoreType, error) {
func (j *Job) getRankInstanceAndScoreType(rankType pbVars.RankType) (*zset.ZSetInt, model.ScoreType, error) {
var rankZSet *zset.ZSetInt
scoreType := model.ScoreTypeByRankType(rankType)
rankZSet, _ = j.rankByTypeMap[rankType]

@ -24,5 +24,5 @@ func NewRankPvpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RankPvpLo
// rank
func (l *RankPvpLogic) RankPvp(in *pb.RankPvpReq) (*pb.RankPvpResp, error) {
return Service.RangeRankByType(pb.RankType(in.Type), in.TopN), nil
return Service.RangeRankByType(in.Type, in.TopN), nil
}

@ -3,6 +3,7 @@ package rank
import (
"context"
"github.com/pkg/errors"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/common/nerr"
@ -39,7 +40,7 @@ func (l *UserRankPvpLogic) UserRankPvp(in *pb.UserRankReq) (*pb.UserRankResp, er
}
} else {
// 只查询一种类型
scoreTypes := []model.ScoreType{model.ScoreTypeByRankType(pb.RankType(in.RankType))}
scoreTypes := []model.ScoreType{model.ScoreTypeByRankType(in.RankType)}
if dbScoreMap, err = l.svcCtx.StatisticsPvpModel.FindScoreByType(l.ctx, nil, in.UserId, scoreTypes); err != nil {
return nil, errors.Wrapf(nerr.NewError(nerr.RankStatisticsSelectError, "获取用户分数失败"), "获取用户分数失败 err:%v", err)
}
@ -54,9 +55,9 @@ func (l *UserRankPvpLogic) UserRankPvp(in *pb.UserRankReq) (*pb.UserRankResp, er
}, nil
}
func (l *UserRankPvpLogic) rankItem(rankType pb.RankType, score int64) *pb.UserRankResp_Item {
func (l *UserRankPvpLogic) rankItem(rankType pbVars.RankType, score int64) *pb.UserRankResp_Item {
return &pb.UserRankResp_Item{
RankType: int32(rankType),
RankType: rankType,
Score: score,
Pos: Service.RankByScore(rankType, int32(score)),
}

@ -1,74 +0,0 @@
package statistics
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"github.com/zeromicro/go-zero/core/logx"
)
type StatPvpFirstBloodLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewStatPvpFirstBloodLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatPvpFirstBloodLogic {
return &StatPvpFirstBloodLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
const (
TypeFirstBlood = 1
TypeDeFirstBlood = 2
)
func (l *StatPvpFirstBloodLogic) StatPvpFirstBlood(in *pb.StatPvPFirstBloodReq) (*pb.Empty, error) {
// 虚拟UID
if in.Uid <= 0 {
return &pb.Empty{}, nil
}
err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error {
// 直接更新,提高效率
props := model.UpdateRecordProps{}
if in.Type == TypeFirstBlood {
props.FirstBlood = true
} else if in.Type == TypeDeFirstBlood {
props.DeFirstBlood = true
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid,
&props); err != nil {
if errors.Is(err, gormx.ErrRowsAffectedZero) {
// insert
dbModel := model.StatisticsPvp{
UserId: in.Uid,
}
if in.Type == TypeFirstBlood {
dbModel.FirstBloodCount = 1
} else if in.Type == TypeDeFirstBlood {
dbModel.DeFirstBloodCount = 1
}
if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
return nil
})
if err != nil {
return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "一血报送-事务执行失败, err:%+v", err)
}
return &pb.Empty{}, nil
}

@ -1,86 +0,0 @@
package statistics
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/common/nerr"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type StatPvpKillLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewStatPvpKillLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatPvpKillLogic {
return &StatPvpKillLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *StatPvpKillLogic) StatPvpKill(in *pb.StatPvPKillReq) (*pb.Empty, error) {
// 虚拟UID
if in.Uid <= 0 {
return &pb.Empty{}, nil
}
err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error {
// 击杀
props := model.UpdateRecordProps{
KillPlayer: true,
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid, &props); err != nil {
if errors.Is(err, gormx.ErrRowsAffectedZero) {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
KillPlayerCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
// 被杀 + 落马否
// 虚拟UID
if in.TargetUid <= 0 {
return nil
}
props = model.UpdateRecordProps{
DeKillPlayer: true,
DeGeneral: in.IsGeneral,
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.TargetUid, &props); err != nil {
if errors.Is(err, gormx.ErrRowsAffectedZero) {
dbModel := &model.StatisticsPvp{
UserId: in.TargetUid,
DeKillUnitCount: 1,
}
if in.IsGeneral {
dbModel.DeGeneralCount = 1
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
return nil
})
if err != nil {
return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "击杀玩家-事务执行失败, err:%+v", err)
}
return &pb.Empty{}, nil
}

@ -4,11 +4,10 @@ import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"github.com/shopspring/decimal"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/integral_manager"
"live-service/app/user_center/rpc/internal/common/reward_pool"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"sort"
@ -28,165 +27,217 @@ func NewStatPvpReportLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sta
}
}
func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvPReportResp, error) {
resp := &pb.StatPvPReportResp{}
// 排序
sort.SliceStable(in.WinItems, func(i, j int) bool {
return in.WinItems[i].Position < in.WinItems[j].Position
})
sort.SliceStable(in.LostItems, func(i, j int) bool {
return in.LostItems[i].Position < in.LostItems[j].Position
})
// 名将记录
if len(in.WinItems) > 0 {
general := in.WinItems[0]
if general.Uid > 0 {
if err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error {
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, general.Uid,
&model.UpdateRecordProps{General: true}); err != nil {
if errors.Is(err, gormx.ErrRowsAffectedZero) {
// insert
if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &model.StatisticsPvp{
UserId: general.Uid,
GeneralCount: 1,
}); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
return nil
}); err != nil {
l.Logger.Errorf("PvP名将记录事务执行失败, err:%v", err)
type (
sumType struct {
damage int64
deDamage int64
killPlayer int64
}
statPvPReportItem struct {
*pb.StatPvPReportResp_Item
uid int64
uname string
damage int64
deDamage int64
killUnit int64
deKillUnit int64
firstBlood bool
deFirstBlood bool
killPlayer int64
deKillPlayer bool
isGeneral bool
}
)
func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvPReportResp, error) {
var err error
resp := &pb.StatPvPReportResp{
WinCamp: in.WinCamp,
BattleId: in.BattleId,
}
// 玩家记录
{
// 获胜记录
if err := l.reports(true, in.WinItems); err != nil {
winItems := make([]*statPvPReportItem, 0, len(in.WinItems))
lostItems := make([]*statPvPReportItem, 0, len(in.LostItems))
// 1. 计算评分
winSum := l.calcSum(in.WinItems, winItems)
lostSum := l.calcSum(in.LostItems, lostItems)
l.calcScoreResponse(winSum, winItems)
l.calcScoreResponse(lostSum, lostItems)
// 2. 评分排序
sort.Slice(winItems, func(i, j int) bool {
return winItems[i].Score > winItems[j].Score
})
sort.Slice(lostItems, func(i, j int) bool {
return lostItems[i].Score > lostItems[j].Score
})
// 3. 添加position + 各项记录(可忽略错误)
err = l.reports(true, winItems)
if err != nil {
l.Logger.Errorf("获胜PvP记录失败, err:%v", err)
}
// 战败记录
if err := l.reports(false, in.LostItems); err != nil {
err = l.reports(false, lostItems)
if err != nil {
l.Logger.Errorf("战败PvP记录失败, err:%v", err)
}
}
// 积分记录
{
battleReportCfg := l.svcCtx.Config.Integral.BattleReport
drawReq := make([]reward_pool.DrawRequest, 0, len(in.WinItems))
for _, item := range in.WinItems {
drawReq = append(drawReq, reward_pool.DrawRequest{
UserId: item.Uid,
// resp
resp.WinItems = make([]*pb.StatPvPReportResp_Item, 0, len(winItems))
resp.LostItems = make([]*pb.StatPvPReportResp_Item, 0, len(lostItems))
for _, item := range winItems {
resp.WinItems = append(resp.WinItems, &pb.StatPvPReportResp_Item{
Uid: item.uid,
Uname: item.uname,
Position: item.Position,
Ratio: 0.2,
Score: item.Score,
})
}
drawResult := l.svcCtx.RewardPoolManager.Draw(in.BattleId, drawReq)
winItemResp := make([]*pb.StatPvPReportResp_Item, 0, len(in.WinItems))
lostItemResp := make([]*pb.StatPvPReportResp_Item, 0, len(in.LostItems))
integralChangeReq := make([]integral_manager.ChangeIntegralReq, 0, len(in.WinItems)+len(in.LostItems))
// . 战斗结算
// . 奖池结算
for _, item := range in.WinItems {
// damage (暴兵越多伤害越高)
// killUnit (暴兵越多击杀越多)
// deDamage (暴兵越多受伤越多)
// deKillUnit (暴兵越多死的约多)
uid, uname, position, damage := item.Uid, item.Uname, item.Position, item.Damage
battleIntegral := int64(float64(damage) * battleReportCfg.WinRadio)
tmp := &pb.StatPvPReportResp_Item{
Uid: uid,
Uname: uname,
Position: position,
ReturnsIntegral: drawResult.UserReturns[uid],
RewardPoolIntegral: drawResult.DrawRewards[uid],
NobilityIntegral: 0, // TODO . 贵族加成分 再议
BattleIntegral: battleIntegral,
}
if position == 1 {
tmp.GeneralIntegral = battleReportCfg.GeneralIntegral
}
tmp.TotalIntegral = tmp.ReturnsIntegral + tmp.RewardPoolIntegral + tmp.GeneralIntegral + tmp.NobilityIntegral + tmp.BattleIntegral
winItemResp = append(winItemResp, tmp)
integralChangeReq = append(integralChangeReq, integral_manager.ChangeIntegralReq{
BattleId: in.BattleId,
UserId: uid,
Change: tmp.TotalIntegral,
Type: pb.IntegralType_Battle,
for _, item := range lostItems {
resp.LostItems = append(resp.LostItems, &pb.StatPvPReportResp_Item{
Uid: item.uid,
Uname: item.uname,
Position: item.Position,
Score: item.Score,
})
}
return resp, nil
}
for _, item := range in.LostItems {
uid, uname, position, damage := item.Uid, item.Uname, item.Position, item.Damage
battleIntegral := int64(float64(damage) * battleReportCfg.LostRadio)
tmp := &pb.StatPvPReportResp_Item{
Uid: uid,
Uname: uname,
Position: position,
ReturnsIntegral: 0,
RewardPoolIntegral: 0,
GeneralIntegral: 0,
NobilityIntegral: 0, // TODO . 贵族加成分 再议
BattleIntegral: battleIntegral,
TotalIntegral: 0,
}
tmp.TotalIntegral = tmp.ReturnsIntegral + tmp.RewardPoolIntegral + tmp.GeneralIntegral + tmp.NobilityIntegral + tmp.BattleIntegral
lostItemResp = append(lostItemResp, tmp)
integralChangeReq = append(integralChangeReq, integral_manager.ChangeIntegralReq{
BattleId: in.BattleId,
UserId: uid,
Change: tmp.TotalIntegral,
Type: pb.IntegralType_Battle,
func (l *StatPvpReportLogic) calcSum(items []*pb.StatPvPReportReq_Item, out []*statPvPReportItem) sumType {
var sum sumType
for _, item := range items {
sum.damage += item.Damage
sum.deDamage += item.DeDamage
sum.killPlayer += item.KillPlayer
out = append(out, &statPvPReportItem{
uid: item.Uid,
uname: item.Uname,
damage: item.Damage,
deDamage: item.DeDamage,
killUnit: item.KillUnit,
deKillUnit: item.DeKillUnit,
firstBlood: item.FirstBlood,
deFirstBlood: item.DeFirstBlood,
killPlayer: item.KillPlayer,
deKillPlayer: item.DeKillPlayer,
isGeneral: item.IsGeneral,
})
}
// 统一结算积分
_, err := l.svcCtx.IntegralManager.ChangeIntegralBatch(l.ctx, integralChangeReq, false)
if err != nil {
l.Logger.Errorf("积分结算失败 %v", err)
return sum
}
resp.WinItems = winItemResp
resp.LostItems = lostItemResp
func (l *StatPvpReportLogic) calcScoreResponse(sum sumType, items []*statPvPReportItem) {
for _, item := range items {
itemResp := &pb.StatPvPReportResp_Item{
Uid: item.Uid,
Uname: item.Uname,
Score: 0,
}
damageScore, _ := decimal.NewFromInt(item.damage).
Div(decimal.NewFromInt(sum.damage)).
Mul(decimal.NewFromFloat32(0.3)).
Mul(decimal.NewFromInt(100)).
Round(1).Float64()
deDamageScore, _ := decimal.NewFromInt(item.deDamage).
Div(decimal.NewFromInt(sum.deDamage)).
Mul(decimal.NewFromFloat32(0.1)).
Mul(decimal.NewFromInt(100)).
Round(1).Float64()
killPlayerScore, _ := decimal.NewFromInt(item.killPlayer).
Div(decimal.NewFromInt(sum.killPlayer)).
Mul(decimal.NewFromFloat32(0.3)).
Mul(decimal.NewFromInt(100)).
Round(1).Float64()
deKillUnit := item.deKillUnit
if deKillUnit == 0 {
deKillUnit = 1
}
kdScore, _ := decimal.NewFromInt(item.killUnit).
Div(decimal.NewFromInt(deKillUnit)).
Mul(decimal.NewFromFloat32(0.3)).
Mul(decimal.NewFromInt(30)).
Round(1).Float64()
itemResp.Score += float32(damageScore)
itemResp.Score += float32(deDamageScore)
itemResp.Score += float32(killPlayerScore)
itemResp.Score += float32(kdScore)
if item.firstBlood {
itemResp.Score += 5
}
if item.deFirstBlood {
itemResp.Score -= 5
}
if item.deKillPlayer {
itemResp.Score -= 10
}
if item.isGeneral {
itemResp.Score += 10
}
item.StatPvPReportResp_Item = itemResp
}
l.Logger.Info("PvP战报记录成功...")
return resp, nil
}
func (l *StatPvpReportLogic) reports(win bool, items []*pb.StatPvPReportReq_Item) error {
func (l *StatPvpReportLogic) reports(win bool, items []*statPvPReportItem) error {
return l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error {
for _, item := range items {
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, item.Uid,
&model.UpdateRecordProps{
for i, item := range items {
item.Position = int32(i + 1)
props := &model.UpdateRecordProps{
Damage: item.damage,
DeDamage: item.deDamage,
KillUnitCount: item.killUnit,
DeKillUnitCount: item.deKillUnit,
Win: win,
Lost: !win,
Damage: &item.Damage,
DeDamage: &item.DeDamage,
KillUnitCount: &item.KillUnit,
DeKillUnitCount: &item.DeKillUnit,
}); err != nil {
KillPlayer: item.killPlayer,
DeKillPlayer: item.deKillPlayer,
DeGeneral: item.deKillPlayer && item.isGeneral,
FirstBlood: item.firstBlood,
DeFirstBlood: item.deFirstBlood,
}
if win && i == 0 {
// 名将
props.General = true
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, item.Uid, props); err != nil {
if errors.Is(err, gormx.ErrRowsAffectedZero) {
// insert
var winCount int64
var lostCount int64
var (
winCount, lostCount, deKillPlayer, generalCount, firstBloodCount, deFirstBloodCount int64
)
if win {
winCount = 1
} else {
lostCount = 1
}
if item.deKillPlayer {
deKillPlayer = 1
}
if props.General {
generalCount = 1
}
if props.FirstBlood {
firstBloodCount = 1
}
if props.DeFirstBlood {
deFirstBloodCount = 1
}
if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &model.StatisticsPvp{
UserId: item.Uid,
UserId: item.uid,
WinCount: winCount,
LostCount: lostCount,
Damage: item.Damage,
DeDamage: item.DeDamage,
KillUnitCount: item.KillUnit,
DeKillUnitCount: item.DeKillUnit,
Damage: item.damage,
DeDamage: item.deDamage,
KillUnitCount: item.killUnit,
DeKillUnitCount: item.deKillUnit,
KillPlayerCount: item.killPlayer,
DeKillPlayerCount: deKillPlayer,
GeneralCount: generalCount,
DeGeneralCount: 0,
FirstBloodCount: firstBloodCount,
DeFirstBloodCount: deFirstBloodCount,
}); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}

@ -0,0 +1,124 @@
package user
import (
"context"
"gorm.io/gorm"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/timex"
"time"
"github.com/zeromicro/go-zero/core/logx"
)
type GetUserDetailsLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetUserDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserDetailsLogic {
return &GetUserDetailsLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// getUserDetails 获取用户详细信息
func (l *GetUserDetailsLogic) GetUserDetails(in *pb.UserIdReq) (*pb.UserDetailsResp, error) {
resp := &pb.UserDetailsResp{
UserId: in.UserId,
}
// 贵族
var nobilityLevel int32
if dbNobility, err := l.svcCtx.UserNobilityModel.FindOne(l.ctx, nil, in.UserId); err == nil {
nobilityLevel = int32(dbNobility.NobilityLevel)
// 判断过期
if time.Now().After(dbNobility.EndTime) {
if !dbNobility.Forever {
nobilityLevel = 0
}
}
}
resp.NobilityLevel = nobilityLevel
// 金币
var coin int64
if dbCoin, err := l.svcCtx.CoinManager.GetUserCoin(l.ctx, in.UserId); err == nil {
coin = dbCoin
}
resp.Coin = coin
nowTime := time.Now()
// 当前佩戴 称号/精英单位
var currentTitle pb.UserDetailsResp_TitleItem
var currentElite pb.UserDetailsResp_EliteItem
_ = l.svcCtx.Db.Transaction(func(tx *gorm.DB) error {
if zhgUserDetails, err := l.svcCtx.ZhgUserDetailsModel.FindOne(l.ctx, tx, in.UserId); err == nil {
if dbTitle, err := l.svcCtx.UserTitleModel.FindOneByUserIdTitleId(l.ctx, tx, in.UserId, zhgUserDetails.Title); err == nil {
if !timex.DayExpire(nowTime, dbTitle.EndTime, bool(dbTitle.Forever)) {
var name string
if cfg, err := l.svcCtx.GameConfig.Title.FindTitleCfg(dbTitle.TitleId); err == nil {
name = cfg.Name
}
currentTitle = pb.UserDetailsResp_TitleItem{
Id: dbTitle.TitleId,
Name: name,
Sort: int32(dbTitle.Sort),
Remain: timex.DayRemain(nowTime, dbTitle.EndTime, bool(dbTitle.Forever)),
}
}
}
if dbElite, err := l.svcCtx.UserEliteModel.FindOneByUserIdEliteId(l.ctx, tx, in.UserId, zhgUserDetails.Elite); err == nil {
if !timex.DayExpire(nowTime, dbElite.EndTime, bool(dbElite.Forever)) {
currentElite = pb.UserDetailsResp_EliteItem{
Id: dbElite.EliteId,
Sort: int32(dbElite.Sort),
Remain: timex.DayRemain(nowTime, dbElite.EndTime, bool(dbElite.Forever)),
}
}
}
}
return nil
})
resp.CurrentTitle = &currentTitle
resp.CurrentElite = &currentElite
// 拥有 称号/精英单位 列表
elites := make([]*pb.UserDetailsResp_EliteItem, 0)
if dbElites, err := l.svcCtx.UserEliteModel.FindByUserId(l.ctx, nil, in.UserId); err == nil {
for _, item := range dbElites {
if !timex.DayExpire(nowTime, item.EndTime, bool(item.Forever)) {
elites = append(elites, &pb.UserDetailsResp_EliteItem{
Id: item.EliteId,
Sort: int32(item.Sort),
Remain: timex.DayRemain(nowTime, item.EndTime, bool(item.Forever)),
})
}
}
}
resp.Elites = elites
titles := make([]*pb.UserDetailsResp_TitleItem, 0)
if dbTitles, err := l.svcCtx.UserTitleModel.FindByUserId(l.ctx, nil, in.UserId); err == nil {
for _, item := range dbTitles {
if !timex.DayExpire(nowTime, item.EndTime, bool(item.Forever)) {
var name string
if cfg, err := l.svcCtx.GameConfig.Title.FindTitleCfg(item.TitleId); err == nil {
name = cfg.Name
}
titles = append(titles, &pb.UserDetailsResp_TitleItem{
Id: item.TitleId,
Name: name,
Sort: int32(item.Sort),
Remain: timex.DayRemain(nowTime, item.EndTime, bool(item.Forever)),
})
}
}
}
resp.Titles = titles
return resp, nil
}

@ -10,7 +10,6 @@ import (
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"time"
)
type RetrievePlatformUserLogic struct {
@ -30,20 +29,15 @@ func NewRetrievePlatformUserLogic(ctx context.Context, svcCtx *svc.ServiceContex
// RetrievePlatformUser 查询或创建用户此时不通过API查询平台用户信息
func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) (*pb.PlatformUserResp, error) {
var dbFullUser *model.FullUser
var username string
var displayUser *model.UserForDisplay
if err := l.svcCtx.Db.Transaction(func(tx *gorm.DB) error {
var err error
if dbFullUser, err = l.svcCtx.UserPlatformModel.FindFullByPlatform(l.ctx, tx, in.Platform, in.PUid); err != nil {
if displayUser, err = l.svcCtx.UserPlatformModel.FindDisplayOneByPlatform(l.ctx, tx, in.Platform, in.PUid); err != nil {
if !errors.Is(err, model.ErrNotFound) {
return nerr.NewWithCode(nerr.DBError)
}
}
if dbFullUser != nil {
if one, err := l.svcCtx.UserModel.FindOne(l.ctx, tx, dbFullUser.UserId); err != nil {
username = one.Username
}
} else {
return nil
}
// : not found
@ -51,7 +45,7 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq)
// insert
newId := uuid.NextId()
if err := l.svcCtx.UserModel.Insert(l.ctx, tx, &model.User{Id: newId}); err != nil {
return errors.Wrap(nerr.NewWithCode(nerr.DBError), "插入用户数据失败")
return nerr.NewWithCode(nerr.DBError)
}
dbPlatformUser := &model.UserPlatform{
Id: uuid.NextId(),
@ -61,45 +55,20 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq)
PInfo: "{}",
}
if err := l.svcCtx.UserPlatformModel.Insert(l.ctx, tx, dbPlatformUser); err != nil {
return errors.Wrap(nerr.NewWithCode(nerr.DBError), "插入平台用户数据失败")
return nerr.NewWithCode(nerr.DBError)
}
dbFullUser = &model.FullUser{
UserPlatform: *dbPlatformUser,
UserNobility: model.UserNobility{
UserId: newId,
NobilityLevel: 0,
},
UserIntegral: model.UserIntegral{
displayUser = &model.UserForDisplay{
UserId: newId,
Integral: 0,
},
}
return nil
}); err != nil {
return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "查询或创建用户-事务执行失败, err:%+v", err)
}
return &pb.PlatformUserResp{
User: l.buildPBUser(username, dbFullUser),
Id: displayUser.UserId,
Platform: in.Platform,
PUid: in.PUid,
PUname: displayUser.PUname,
PAvatar: displayUser.PAvatar,
}, nil
}
func (l *RetrievePlatformUserLogic) buildPBUser(username string, dbFullUser *model.FullUser) *pb.User {
resp := &pb.User{
Id: dbFullUser.UserId,
Username: username,
Platform: dbFullUser.Platform,
PUid: dbFullUser.PUid,
PUname: dbFullUser.PUname,
PAvatar: dbFullUser.PAvatar,
NobilityLevel: int32(dbFullUser.UserNobility.NobilityLevel),
Integral: dbFullUser.UserIntegral.Integral,
}
// 贵族过期判断
if time.Now().After(dbFullUser.UserNobility.EndTime) {
if !dbFullUser.UserNobility.Forever {
// 贵族过期置为0
resp.NobilityLevel = 0
}
}
return resp
}

@ -6,9 +6,12 @@ import (
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"math/rand"
"time"
)
@ -29,29 +32,20 @@ func NewUserCheckInLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserC
const (
MsgAlreadyCheckIn = "今天已打过卡了!"
MsgCheckInSuccess = "打卡成功,哔哩哔哩 (゜-゜)つロ 干杯"
)
var (
ErrAlreadyCheckIn = errors.New(MsgAlreadyCheckIn)
)
// UserCheckIn 用户签到|打卡
func (l *UserCheckInLogic) UserCheckIn(in *pb.UserIdReq) (*pb.UserCheckInResp, error) {
resp := &pb.UserCheckInResp{
Code: 0,
Msg: "",
IntegralChange: 0,
Integral: 0,
IsCritical: false,
}
if err := l.svcCtx.Db.Transaction(func(tx *gorm.DB) error {
isCheckInToday, err := l.svcCtx.UserCheckInModel.CheckInToday(l.ctx, tx, in.UserId)
if err != nil {
return err
return nerr.NewWithCode(nerr.DBError)
}
if isCheckInToday {
return ErrAlreadyCheckIn
return nerr.NewError(nerr.UserAlreadyCheckIn, MsgAlreadyCheckIn)
}
// 打卡记录
if err = l.svcCtx.UserCheckInModel.Insert(l.ctx, tx, &model.UserCheckIn{
@ -59,33 +53,31 @@ func (l *UserCheckInLogic) UserCheckIn(in *pb.UserIdReq) (*pb.UserCheckInResp, e
UserId: in.UserId,
CheckInTime: time.Now(),
}); err != nil {
return err
return nerr.NewWithCode(nerr.DBError)
}
// 积分记录,计算当日可得积分
change, critical := l.getCriticalPoint()
if resp.Integral, err = l.svcCtx.UserIntegralModel.ChangeIntegral(l.ctx, tx, in.UserId, change); err != nil {
return err
}
changeCoinResp, err := l.svcCtx.CoinManager.ChangeCoin(l.ctx, tx, &coin_manager.ChangeCoinReq{
UserId: in.UserId,
Change: change,
}, pbVars.UserCoinChangedReason_CheckIn)
if err != nil {
return errors.Wrapf(nerr.NewWithErr(err), "记录弹币失败, err:%+v", err)
}
resp.CurrentCoin = changeCoinResp.Current
resp.CoinChange = change
resp.IsCritical = critical
resp.IntegralChange = change
resp.Msg = MsgCheckInSuccess
resp.Code = 200
return nil
}); err != nil {
if errors.Is(err, ErrAlreadyCheckIn) {
resp.Msg = MsgAlreadyCheckIn
return resp, nil
}
return nil, err
return nil, errors.Wrapf(nerr.NewWithErr(err), "打卡失败 err:%v", err)
}
return resp, nil
}
func (l *UserCheckInLogic) getCriticalPoint() (int64, bool) {
checkInCfg := l.svcCtx.Config.Integral.CheckIn
checkInCfg := l.svcCtx.GameConfig.Coin.CheckIn
nt := time.Now()
weekDay := int(nt.Weekday())
point := checkInCfg.Points[weekDay]

@ -0,0 +1,60 @@
package zhg
import (
"context"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"live-service/common/nerr"
"time"
)
type BuyEliteLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewBuyEliteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BuyEliteLogic {
return &BuyEliteLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *BuyEliteLogic) BuyElite(in *pb.EliteReq) (*pb.BuyEliteResp, error) {
elite, err := l.svcCtx.GameConfig.Elite.FindEliteCfgByLive(in.Sort)
if err != nil {
// 待购买的精英单位不存在
return nil, errors.Wrapf(nerr.NewError(nerr.EliteConfigNotFoundErr, err.Error()), err.Error())
}
resp := &pb.BuyEliteResp{
UserId: in.UserId,
EliteId: elite.Id,
Cost: elite.PriceDay,
Duration: 1,
}
if err = l.svcCtx.Db.Transaction(func(tx *gorm.DB) error {
// 扣减弹币
if _, err = l.svcCtx.CoinManager.ChangeCoin(l.ctx, tx, &coin_manager.ChangeCoinReq{
UserId: in.UserId,
Change: -elite.PriceDay,
}, pbVars.UserCoinChangedReason_BuyEliteUnit); err != nil {
return err
}
if err = l.svcCtx.UserEliteModel.Addon(l.ctx, nil, in.UserId, elite.Id, 24*time.Hour, false); err != nil {
return errors.Wrapf(nerr.NewWithErr(err), "兑换精英单位失败 err:%v", err)
}
return nil
}); err != nil {
return nil, err
}
return resp, nil
}

@ -0,0 +1,67 @@
package zhg
import (
"context"
"github.com/pkg/errors"
"gorm.io/gorm"
pbVars "live-service/app/pb/vars"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/common/nerr"
"time"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type BuyTitleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewBuyTitleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BuyTitleLogic {
return &BuyTitleLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *BuyTitleLogic) BuyTitle(in *pb.TitleReq) (*pb.BuyTitleResp, error) {
titleCfg, err := l.svcCtx.GameConfig.Title.FindTitleCfgByLive(in.Sort)
if err != nil {
return nil, nerr.NewError(nerr.TitleConfigNotFoundErr, err.Error())
}
if titleCfg.Type != model.TitleTypeDefault {
return nil, nerr.NewError(nerr.TitleCannotBuyErr, "该称号禁止兑换")
}
resp := &pb.BuyTitleResp{
UserId: in.UserId,
TitleId: titleCfg.Id,
Name: titleCfg.Name,
Cost: titleCfg.PriceDay,
Duration: 1,
}
if err = l.svcCtx.Db.Transaction(func(tx *gorm.DB) error {
// 扣减弹币
if _, err = l.svcCtx.CoinManager.ChangeCoin(l.ctx, tx, &coin_manager.ChangeCoinReq{
UserId: in.UserId,
Change: -titleCfg.PriceDay,
}, pbVars.UserCoinChangedReason_BuyEliteUnit); err != nil {
return err
}
if err = l.svcCtx.UserTitleModel.Addon(l.ctx, nil, in.UserId, titleCfg.Id, titleCfg.Type, 24*time.Hour, false); err != nil {
return errors.Wrapf(nerr.NewWithErr(err), "兑换称号失败 err:%v", err)
}
return nil
}); err != nil {
return nil, err
}
return resp, nil
}

@ -0,0 +1,66 @@
package zhg
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"live-service/app/user_center/model"
"live-service/common/nerr"
"live-service/common/timex"
"time"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ChangeEliteLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewChangeEliteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeEliteLogic {
return &ChangeEliteLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ChangeEliteLogic) ChangeElite(in *pb.EliteReq) (*pb.ChangeEliteResp, error) {
resp := &pb.ChangeEliteResp{
UserId: in.UserId,
}
eliteId := l.svcCtx.GameConfig.Elite.Default.Id
if in.Sort != l.svcCtx.GameConfig.Elite.Default.Sort {
dbModel, err := l.svcCtx.UserEliteModel.FindOneByUserIdSort(l.ctx, nil, in.UserId, int64(in.Sort))
if err != nil {
if errors.Is(err, gormx.ErrNotFound) {
return nil, errors.Wrap(nerr.NewError(nerr.UserEliteNotFoundErr, "用户没有此单位"), "用户没有此单位")
}
return nil, errors.Wrap(nerr.NewWithCode(nerr.DBError), "数据库错误请联系UP主")
}
// 判断过期
if timex.DayExpire(time.Now(), dbModel.EndTime, bool(dbModel.Forever)) {
return nil, errors.Wrap(nerr.NewError(nerr.UserEliteExpiresErr, "待切换的精英单位已过期"), "待切换的精英单位已过期")
}
eliteId = dbModel.EliteId
}
// 更新当前使用精英单位
err := l.svcCtx.ZhgUserDetailsModel.Upsert(l.ctx, nil, &model.UpsertParam{
UserId: in.UserId,
Elite: &eliteId,
})
if err != nil {
if !errors.Is(err, gormx.ErrRowsAffectedZero) {
return nil, errors.Wrapf(nerr.NewError(nerr.UserChangeEliteErr, "切换精英单位失败"), "切换精英单位失败 err:%v", err)
}
}
resp.EliteId = eliteId
return resp, nil
}

@ -0,0 +1,68 @@
package zhg
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx"
"github.com/pkg/errors"
"live-service/app/user_center/model"
"live-service/common/nerr"
"live-service/common/timex"
"time"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type ChangeTitleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewChangeTitleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeTitleLogic {
return &ChangeTitleLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *ChangeTitleLogic) ChangeTitle(in *pb.TitleReq) (*pb.ChangeTitleResp, error) {
resp := &pb.ChangeTitleResp{
UserId: in.UserId,
}
dbModel, err := l.svcCtx.UserTitleModel.FindOneByUserIdSort(l.ctx, nil, in.UserId, int64(in.Sort))
if err != nil {
if errors.Is(err, gormx.ErrNotFound) {
return nil, errors.Wrap(nerr.NewError(nerr.UserTitleNotFoundErr, "用户没有此称号"), "用户没有此称号")
}
return nil, errors.Wrap(nerr.NewWithCode(nerr.DBError), "数据库错误请联系UP主")
}
// 判断过期
if timex.DayExpire(time.Now(), dbModel.EndTime, bool(dbModel.Forever)) {
return nil, errors.Wrap(nerr.NewError(nerr.UserTitleExpiresErr, "待切换的称号已过期"), "待切换的称号已过期")
}
// 更新当前佩戴称号
err = l.svcCtx.ZhgUserDetailsModel.Upsert(l.ctx, nil, &model.UpsertParam{
UserId: in.UserId,
Title: &dbModel.TitleId,
})
if err != nil {
if !errors.Is(err, gormx.ErrRowsAffectedZero) {
return nil, errors.Wrapf(nerr.NewError(nerr.UserChangeTitleErr, "切换称号失败"), "切换称号失败 err:%v", err)
}
}
resp.TitleId = dbModel.TitleId
var titleName string
if titleCfg, err := l.svcCtx.GameConfig.Title.FindTitleCfg(dbModel.TitleId); err == nil {
titleName = titleCfg.Name
}
resp.Name = titleName
return resp, nil
}

@ -0,0 +1,55 @@
package zhg
import (
"context"
"live-service/common/nerr"
"time"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type GiveEliteLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGiveEliteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GiveEliteLogic {
return &GiveEliteLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GiveEliteLogic) GiveElite(in *pb.GiveEliteReq) (*pb.BuyEliteResp, error) {
elite, err := l.svcCtx.GameConfig.Elite.FindEliteCfg(in.EliteId)
if err != nil {
return nil, nerr.NewError(nerr.EliteConfigNotFoundErr, err.Error())
}
duration := in.Duration
if in.Forever {
duration = -1
}
resp := &pb.BuyEliteResp{
UserId: in.UserId,
EliteId: elite.Id,
Cost: 0,
Duration: duration,
}
if duration < 0 {
duration = -duration
} else if duration == 0 {
duration = 1
}
err = l.svcCtx.UserEliteModel.Addon(l.ctx, nil, in.UserId, elite.Id, time.Duration(duration)*24*time.Hour, in.Forever)
if err != nil {
return nil, err
}
return resp, nil
}

@ -0,0 +1,56 @@
package zhg
import (
"context"
"live-service/common/nerr"
"time"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type GiveTitleLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGiveTitleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GiveTitleLogic {
return &GiveTitleLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *GiveTitleLogic) GiveTitle(in *pb.GiveTitleReq) (*pb.BuyTitleResp, error) {
cfg, err := l.svcCtx.GameConfig.Title.FindTitleCfg(in.TitleId)
if err != nil {
return nil, nerr.NewError(nerr.EliteConfigNotFoundErr, err.Error())
}
duration := in.Duration
if in.Forever {
duration = -1
}
resp := &pb.BuyTitleResp{
UserId: in.UserId,
TitleId: cfg.Id,
Name: cfg.Name,
Cost: 0,
Duration: duration,
}
if duration < 0 {
duration = -duration
} else if duration == 0 {
duration = 1
}
err = l.svcCtx.UserTitleModel.Addon(l.ctx, nil, in.UserId, cfg.Id, cfg.Type, time.Duration(duration)*24*time.Hour, in.Forever)
if err != nil {
return nil, err
}
return resp, nil
}

@ -0,0 +1,32 @@
package mq
import (
"context"
"git.noahlan.cn/northlan/ntools-go/kafka"
"github.com/zeromicro/go-zero/core/logx"
pbMq "live-service/app/pb/mq"
"live-service/app/user_center/rpc/internal/config"
kfk "live-service/common/kafka"
)
type (
RewardPool struct {
producer *kafka.Producer // kafka
logx.Logger
}
)
func NewRewardPoolMq(cfg config.KafkaProducer) *RewardPool {
return &RewardPool{
producer: kafka.NewKafkaProducer(kfk.DefaultProducerConfig, cfg.RewardPool.Addr, cfg.RewardPool.Topic),
Logger: logx.WithContext(context.Background()),
}
}
func (m *RewardPool) RewardPoolChanged(req *pbMq.MqRewardPool) {
err := m.producer.SendMessageAsync(req)
if err != nil {
m.Logger.Error("发送通知奖池变更消息失败")
}
}

@ -0,0 +1,42 @@
package mq
import (
"context"
"git.noahlan.cn/northlan/ntools-go/kafka"
"github.com/zeromicro/go-zero/core/logx"
pbMq "live-service/app/pb/mq"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/config"
kfk "live-service/common/kafka"
)
type (
UserMq struct {
userPlatformModel model.UserPlatformModel
coinChangedKfk *kafka.Producer
logx.Logger
}
)
func NewUserMq(userPlatformModel model.UserPlatformModel, cfg config.KafkaProducer) *UserMq {
return &UserMq{
userPlatformModel: userPlatformModel,
coinChangedKfk: kafka.NewKafkaProducer(kfk.DefaultProducerConfig, cfg.UserCoinNotify.Addr, cfg.UserCoinNotify.Topic),
Logger: logx.WithContext(context.Background()),
}
}
func (m *UserMq) NotifyUserCoinChanged(req *pbMq.MqUserCoinChanged) {
if req.Username == "" || req.Avatar == "" {
// 读取用户数据
if dbModel, err := m.userPlatformModel.FindDisplayOneByUserId(context.Background(), req.UserId); err == nil {
req.Username = dbModel.PUname
req.Avatar = dbModel.PAvatar
}
}
err := m.coinChangedKfk.SendMessageAsync(req)
if err != nil {
m.Logger.Error("发送通知用户金币变更消息失败")
}
}

@ -5,12 +5,12 @@ package server
import (
"context"
"live-service/app/user_center/rpc/internal/logic/draw_pool"
"live-service/app/user_center/rpc/internal/logic/coin"
"live-service/app/user_center/rpc/internal/logic/gift"
"live-service/app/user_center/rpc/internal/logic/integral"
"live-service/app/user_center/rpc/internal/logic/rank"
"live-service/app/user_center/rpc/internal/logic/statistics"
"live-service/app/user_center/rpc/internal/logic/user"
"live-service/app/user_center/rpc/internal/logic/zhg"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
@ -33,57 +33,53 @@ func (s *UserCenterServer) RetrievePlatformUser(ctx context.Context, in *pb.Plat
return l.RetrievePlatformUser(in)
}
// getUserDetails 获取用户详细信息
func (s *UserCenterServer) GetUserDetails(ctx context.Context, in *pb.UserIdReq) (*pb.UserDetailsResp, error) {
l := user.NewGetUserDetailsLogic(ctx, s.svcCtx)
return l.GetUserDetails(in)
}
// getUserIdByPUid 通过平台用户id获取系统用户ID
func (s *UserCenterServer) GetUserIdByPUid(ctx context.Context, in *pb.PlatformUserReq) (*pb.UserIdResp, error) {
l := user.NewGetUserIdByPUidLogic(ctx, s.svcCtx)
return l.GetUserIdByPUid(in)
}
// ChangeIntegral 新增用户积分
func (s *UserCenterServer) ChangeIntegral(ctx context.Context, in *pb.ChangeIntegralReq) (*pb.ChangeIntegralResp, error) {
l := integral.NewChangeIntegralLogic(ctx, s.svcCtx)
return l.ChangeIntegral(in)
}
// GetUserIntegral 获取用户积分
func (s *UserCenterServer) GetUserIntegral(ctx context.Context, in *pb.UserIdReq) (*pb.UserIntegralResp, error) {
l := integral.NewGetUserIntegralLogic(ctx, s.svcCtx)
return l.GetUserIntegral(in)
}
// UserCheckIn 用户签到|打卡
func (s *UserCenterServer) UserCheckIn(ctx context.Context, in *pb.UserIdReq) (*pb.UserCheckInResp, error) {
l := user.NewUserCheckInLogic(ctx, s.svcCtx)
return l.UserCheckIn(in)
}
// TransferUserIntegral 转移积分
func (s *UserCenterServer) TransferUserIntegral(ctx context.Context, in *pb.TransferUserIntegralReq) (*pb.TransferUserIntegralResp, error) {
l := integral.NewTransferUserIntegralLogic(ctx, s.svcCtx)
return l.TransferUserIntegral(in)
// changeCoin 新增或扣减用户弹币
func (s *UserCenterServer) ChangeCoin(ctx context.Context, in *pb.ChangeCoinReq) (*pb.Empty, error) {
l := coin.NewChangeCoinLogic(ctx, s.svcCtx)
return l.ChangeCoin(in)
}
// getUserCoin 获取用户弹币
func (s *UserCenterServer) GetUserCoin(ctx context.Context, in *pb.UserIdReq) (*pb.GetUserCoinResp, error) {
l := coin.NewGetUserCoinLogic(ctx, s.svcCtx)
return l.GetUserCoin(in)
}
// transferUserCoin 转移用户弹币
func (s *UserCenterServer) TransferUserCoin(ctx context.Context, in *pb.TransferUserCoinReq) (*pb.TransferUserCoinResp, error) {
l := coin.NewTransferUserCoinLogic(ctx, s.svcCtx)
return l.TransferUserCoin(in)
}
// UserSendGift 用户赠送礼物
func (s *UserCenterServer) UserSendGift(ctx context.Context, in *pb.UserSendGiftReq) (*pb.UserSendGiftResp, error) {
func (s *UserCenterServer) UserSendGift(ctx context.Context, in *pb.UserSendGiftReq) (*pb.Empty, error) {
l := gift.NewUserSendGiftLogic(ctx, s.svcCtx)
return l.UserSendGift(in)
}
func (s *UserCenterServer) UserBuyNobility(ctx context.Context, in *pb.UserBuyNobilityReq) (*pb.UserBuyNobilityResp, error) {
func (s *UserCenterServer) UserBuyNobility(ctx context.Context, in *pb.UserBuyNobilityReq) (*pb.Empty, error) {
l := gift.NewUserBuyNobilityLogic(ctx, s.svcCtx)
return l.UserBuyNobility(in)
}
func (s *UserCenterServer) StatPvpKill(ctx context.Context, in *pb.StatPvPKillReq) (*pb.Empty, error) {
l := statistics.NewStatPvpKillLogic(ctx, s.svcCtx)
return l.StatPvpKill(in)
}
func (s *UserCenterServer) StatPvpFirstBlood(ctx context.Context, in *pb.StatPvPFirstBloodReq) (*pb.Empty, error) {
l := statistics.NewStatPvpFirstBloodLogic(ctx, s.svcCtx)
return l.StatPvpFirstBlood(in)
}
func (s *UserCenterServer) StatPvpReport(ctx context.Context, in *pb.StatPvPReportReq) (*pb.StatPvPReportResp, error) {
l := statistics.NewStatPvpReportLogic(ctx, s.svcCtx)
return l.StatPvpReport(in)
@ -94,11 +90,6 @@ func (s *UserCenterServer) DrawGiftPack(ctx context.Context, in *pb.DrawGiftPack
return l.DrawGiftPack(in)
}
func (s *UserCenterServer) IncreaseWelfare(ctx context.Context, in *pb.IncreaseWelfareReq) (*pb.Empty, error) {
l := draw_pool.NewIncreaseWelfareLogic(ctx, s.svcCtx)
return l.IncreaseWelfare(in)
}
// rankPvp pvp排行
func (s *UserCenterServer) RankPvp(ctx context.Context, in *pb.RankPvpReq) (*pb.RankPvpResp, error) {
l := rank.NewRankPvpLogic(ctx, s.svcCtx)
@ -114,3 +105,33 @@ func (s *UserCenterServer) UserRankPvp(ctx context.Context, in *pb.UserRankReq)
l := rank.NewUserRankPvpLogic(ctx, s.svcCtx)
return l.UserRankPvp(in)
}
func (s *UserCenterServer) GiveElite(ctx context.Context, in *pb.GiveEliteReq) (*pb.BuyEliteResp, error) {
l := zhg.NewGiveEliteLogic(ctx, s.svcCtx)
return l.GiveElite(in)
}
func (s *UserCenterServer) BuyElite(ctx context.Context, in *pb.EliteReq) (*pb.BuyEliteResp, error) {
l := zhg.NewBuyEliteLogic(ctx, s.svcCtx)
return l.BuyElite(in)
}
func (s *UserCenterServer) GiveTitle(ctx context.Context, in *pb.GiveTitleReq) (*pb.BuyTitleResp, error) {
l := zhg.NewGiveTitleLogic(ctx, s.svcCtx)
return l.GiveTitle(in)
}
func (s *UserCenterServer) BuyTitle(ctx context.Context, in *pb.TitleReq) (*pb.BuyTitleResp, error) {
l := zhg.NewBuyTitleLogic(ctx, s.svcCtx)
return l.BuyTitle(in)
}
func (s *UserCenterServer) ChangeElite(ctx context.Context, in *pb.EliteReq) (*pb.ChangeEliteResp, error) {
l := zhg.NewChangeEliteLogic(ctx, s.svcCtx)
return l.ChangeElite(in)
}
func (s *UserCenterServer) ChangeTitle(ctx context.Context, in *pb.TitleReq) (*pb.ChangeTitleResp, error) {
l := zhg.NewChangeTitleLogic(ctx, s.svcCtx)
return l.ChangeTitle(in)
}

@ -1,41 +1,48 @@
package svc
import (
"git.noahlan.cn/northlan/ntools-go/kafka"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/common/integral_manager"
"live-service/app/user_center/rpc/internal/common/reward_pool"
"live-service/app/user_center/rpc/internal/common/coin_manager"
"live-service/app/user_center/rpc/internal/config"
kfk "live-service/common/kafka"
"live-service/app/user_center/rpc/internal/mq"
"log"
"os"
"time"
)
type ServiceContext struct {
Config config.Config
Config *config.Config
GameConfig *config.GameConfig
Db *gorm.DB
UserModel model.UserModel
UserPlatformModel model.UserPlatformModel
UserGiftModel model.UserGiftModel
UserIntegralModel model.UserIntegralModel
UserCoinModel model.UserCoinModel
UserNobilityModel model.UserNobilityModel
UserCheckInModel model.UserCheckInModel
UserEliteModel model.UserEliteModel
UserTitleModel model.UserTitleModel
ZhgUserDetailsModel model.ZhgUserDetailsModel
StatisticsPvpModel model.StatisticsPvpModel
RankPvpModel model.RankPvpModel
GiftModel model.GiftModel
RewardPoolManager *reward_pool.PoolManager
IntegralManager *integral_manager.Manager
////////////// mq
UserMq *mq.UserMq // 用户MQ
RewardPoolMq *mq.RewardPool // 奖池MQ
//RewardPoolManager *reward_pool.PoolManager
CoinManager *coin_manager.Manager
}
func NewServiceContext(c config.Config) *ServiceContext {
func NewServiceContext(c *config.Config, cg *config.GameConfig) *ServiceContext {
var logLevel logger.LogLevel
if c.Log.Mode == "console" {
logLevel = logger.Info
@ -56,32 +63,48 @@ func NewServiceContext(c config.Config) *ServiceContext {
if err != nil {
log.Fatal(err)
}
userPlatformModel := model.NewUserPlatformModel(gormDb)
userIntegralModel := model.NewUserIntegralModel(gormDb)
userCoinModel := model.NewUserCoinModel(gormDb)
rewardPoolManager := reward_pool.NewRewardPoolManager(
c.Integral.RewardPool.InitReward,
reward_pool.Ratio{
Ratio: c.Integral.RewardPool.Ratio,
BattleRatio: c.Integral.RewardPool.BattleRatio,
GiftRatio: c.Integral.RewardPool.GiftRatio,
ReturnRatio: c.Integral.RewardPool.ReturnRatio,
WelfareRatio: c.Integral.RewardPool.WelfareRatio,
},
kafka.NewKafkaProducer(kfk.DefaultProducerConfig, c.Kafka.RewardPool.Addr, c.Kafka.RewardPool.Topic))
userMq := mq.NewUserMq(userPlatformModel, c.Kafka)
rewardPoolMq := mq.NewRewardPoolMq(c.Kafka)
//rewardPoolManager := reward_pool.NewRewardPoolManager(
// c.Integral.RewardPool.InitReward,
// reward_pool.Ratio{
// Ratio: c.Integral.RewardPool.Ratio,
// BattleRatio: c.Integral.RewardPool.BattleRatio,
// GiftRatio: c.Integral.RewardPool.GiftRatio,
// ReturnRatio: c.Integral.RewardPool.ReturnRatio,
// WelfareRatio: c.Integral.RewardPool.WelfareRatio,
// },
// rewardPoolMq)
return &ServiceContext{
Config: c,
GameConfig: cg,
Db: gormDb,
UserModel: model.NewUserModel(gormDb),
UserPlatformModel: model.NewUserPlatformModel(gormDb),
UserPlatformModel: userPlatformModel,
UserGiftModel: model.NewUserGiftModel(gormDb),
UserIntegralModel: userIntegralModel,
UserCoinModel: userCoinModel,
UserNobilityModel: model.NewUserNobilityModel(gormDb),
UserCheckInModel: model.NewUserCheckInModel(gormDb),
UserEliteModel: model.NewUserEliteModel(gormDb),
UserTitleModel: model.NewUserTitleModel(gormDb),
ZhgUserDetailsModel: model.NewZhgUserDetailsModel(gormDb),
StatisticsPvpModel: model.NewStatisticsPvpModel(gormDb),
RankPvpModel: model.NewRankPvpModel(gormDb),
GiftModel: model.NewGiftModel(gormDb),
RewardPoolManager: rewardPoolManager,
IntegralManager: integral_manager.NewIntegralManager(userIntegralModel, rewardPoolManager),
UserMq: userMq,
RewardPoolMq: rewardPoolMq,
//RewardPoolManager: rewardPoolManager,
CoinManager: coin_manager.NewCoinManager(userCoinModel, userMq),
}
}

@ -1,3 +1,3 @@
package pb
//go:generate goctl rpc protoc user_center.proto --style=go_zero --go_out=../ --go-grpc_out=../ --zrpc_out=../
//go:generate goctl rpc protoc user_center.proto --proto_path=. --proto_path=../../../pb/ --style=go_zero --go_out=../ --go-grpc_out=../ --zrpc_out=../

File diff suppressed because it is too large Load Diff

@ -2,31 +2,57 @@ syntax = "proto3";
package pb;
import "vars/vars.proto";
option go_package = "./pb";
// model
message User {
message Empty {}
message Response {
int32 code = 1; // code
string msg = 2; // msg
}
// req
message PlatformUserReq {
string platform = 1;
string pUid = 2;
}
message PlatformUserResp {
int64 id = 1;
string username = 2;
// platform
string platform = 3;
string pUid = 4;
string pUname = 5;
string pAvatar = 6;
int32 nobilityLevel = 7; //
int64 integral = 8; // ()
}
message Empty {}
// req
message PlatformUserReq {
string platform = 1;
string pUid = 2;
//
message UserDetailsResp {
// TitleItem
message TitleItem {
int64 id = 1; // ID
string name = 2; //
int32 sort = 3; //
int32 remain = 4; //
}
//
message EliteItem {
int64 id = 1; // ID 1000(x) 1001() 1002()
int32 sort = 2; //
int32 remain = 3; // -1
}
message PlatformUserResp {
User user = 1;
int64 userId = 1; // ID
int32 nobilityLevel = 2; //
int64 coin = 3; //
TitleItem currentTitle = 4; // ID
EliteItem currentElite = 5; // 使ID
repeated TitleItem titles = 6; //
repeated EliteItem elites = 7; //
}
// ID
@ -39,63 +65,45 @@ message UserIdResp {
int64 userId = 1;
}
enum IntegralType {
Battle = 0; //
Gift = 1; //
Other = 10; //
message GetUserCoinResp {
int64 userId = 1;
int64 current = 2; //
}
//
message ChangeIntegralReq {
//
message ChangeCoinReq {
int64 userId = 1; // ID
int64 battleId = 2; // ID(RPC)
int64 battleId = 2; // ID
int64 change = 3; //
IntegralType integralType = 4; //
}
//
message ChangeIntegralResp {
int64 userId = 1; // ID
int64 change = 2; //
int64 integral = 3; //
}
//
message UserIntegralResp {
int64 userId = 1; // ID
int64 integral = 2; //
}
//
message UserCheckInResp {
int32 code = 1;
string msg = 2; //
int64 integralChange = 3; //
int64 integral = 4; //
bool isCritical = 5; //
pb.vars.UserCoinChangedReason reason = 4; //
}
//
message TransferUserIntegralReq {
//
message TransferUserCoinReq {
int64 userId = 1; // ID
int64 targetUserId = 2; //
int64 transfer = 3; //
}
message TransferUserIntegralResp {
int32 code = 1;
string msg = 2; //
//
message TransferUserCoinResp {
int64 userId = 1;
string uname = 2;
string avatar = 3;
int64 userId = 3;
string uname = 4;
string avatar = 5;
int64 targetUserId = 4;
string targetUname = 5;
string targetAvatar = 6;
int64 targetUserId = 6;
string targetUname = 7;
string targetAvatar = 8;
int64 userCoin = 10; //
int64 targetUserCoin = 11; //
}
int64 userIntegral = 10; //
int64 targetUserIntegral = 11; //
//
message UserCheckInResp {
int64 coinChange = 1; //
int64 currentCoin = 2; //
bool isCritical = 3; //
}
//
@ -112,11 +120,6 @@ message UserSendGiftReq {
int64 battleId = 10; // ID
}
//
message UserSendGiftResp {
ChangeIntegralResp integral = 10; //
}
//
message UserBuyNobilityReq {
string platform = 1; //
@ -134,34 +137,20 @@ message UserBuyNobilityReq {
int64 endTime = 12; //
}
//
message UserBuyNobilityResp {
ChangeIntegralResp integral = 10; //
}
// -PvP( statistics.pvp.kill
message StatPvPKillReq {
int64 uid = 1; // ID
int64 targetUid = 2; //
bool isGeneral = 3; // targetUid
}
// -PvP statistics.pvp.first
message StatPvPFirstBloodReq {
int64 uid = 1; // ID
int32 type = 2; // 1- 2-
}
// -PvP statistics.pvp.report
message StatPvPReportReq {
message Item {
int64 uid = 1; // ID
string uname = 2; //
int32 position = 3; //
int64 damage = 4; //
int64 deDamage = 5; //
int64 killUnit = 6; //
int64 deKillUnit = 7; //
int64 damage = 3; //
int64 deDamage = 4; //
int64 killUnit = 5; //
int64 deKillUnit = 6; //
bool firstBlood = 7; //
bool deFirstBlood = 8; //
int64 killPlayer = 9; //
bool deKillPlayer = 10; //
bool isGeneral = 11; // ?
}
int32 winCamp = 1; // 1- 2-
int64 battleId = 2; // ID
@ -175,15 +164,12 @@ message StatPvPReportResp {
int64 uid = 1; // ID
string uname = 2; //
int32 position = 3; //
int64 returnsIntegral = 4; // 0
int64 rewardPoolIntegral = 5; //
int64 generalIntegral = 6; //
int64 nobilityIntegral = 7; // ||
int64 battleIntegral = 8; //
int64 totalIntegral = 10; //
float score = 4; //
}
repeated Item winItems = 1; //
repeated Item lostItems = 2; //
int32 winCamp = 1; // 1- 2-
int64 battleId = 2; // ID
repeated Item winItems = 10; //
repeated Item lostItems = 11; //
}
////////////////////
@ -196,7 +182,7 @@ enum GiftType {
message GiftPackItem {
string packType = 1; // starter:
string packName = 2; //
int64 integral = 3; //
int64 coin = 3; //
repeated string title = 4; //
}
@ -210,8 +196,7 @@ message DrawGiftPackReq {
message DrawGiftPackResp {
int64 uid = 1;
string uname = 2;
int32 code = 3; // 200: 201100: 201101:
string msg = 4; // [||||]
GiftPackItem item = 10;
}
@ -225,24 +210,9 @@ message IncreaseWelfareReq {
}
////////////////////// rank
enum RankType {
Unknown = 0;
Damage = 1; //
DeDamage = 2; //
General = 3; //
DeGeneral = 4; //
KillUnit = 5; //
DeKillUnit = 6; //
KillPlayer = 7; //
DeKillPlayer = 8; //
Win = 9; //
Lost = 10; //
FirstBlood = 11; //
DeFirstBlood = 12; //
}
message RankPvpReq {
int32 type = 1; // rank
pb.vars.RankType type = 1; // rank
int32 topN = 2; // TopN
}
@ -253,13 +223,13 @@ message RankPvpResp {
int64 score = 3;
string avatar = 4;
}
int32 type = 1; // rank
pb.vars.RankType type = 1; // rank
repeated Item items = 2; // rank
}
// RankPvpSubmitReq
message RankPvpSubmitReq {
int32 rankType = 1; //
pb.vars.RankType rankType = 1; //
bool allRankType = 2; //
}
@ -268,12 +238,12 @@ message RankPvpSubmitResp {
int64 userId = 1;
string username = 2;
string avatar = 3;
int64 integral = 4; //
int64 coin = 4; //
string title = 5; //
int64 titleDuration = 6; // (: ,)
}
message Item {
int32 rankType = 1; //
pb.vars.RankType rankType = 1; //
repeated Result results = 2; //
}
@ -284,48 +254,100 @@ message RankPvpSubmitResp {
message UserRankReq {
int64 userId = 1; // ID
string username = 2; //
int32 rankType = 3; //
pb.vars.RankType rankType = 3; //
bool allRankType = 4; //
}
message UserRankResp {
message Item {
int32 rankType = 1; //
pb.vars.RankType rankType = 1; //
int32 pos = 2; //
int64 score = 3; //
}
repeated Item items = 1;
}
/////////////////////////// zhg
message EliteReq {
int64 userId = 1; // ID
int32 sort = 2; //
}
message GiveEliteReq {
int64 userId = 1; // ID
int64 eliteId = 2; // ID
int32 duration = 3; //
bool forever = 4; //
}
message BuyEliteResp {
int64 userId = 1; // ID
int64 eliteId = 2; // ID
int64 cost = 3; //
int32 duration = 4; // (day)
}
message GiveTitleReq {
int64 userId = 1; // ID
int64 titleId = 2; // ID
int32 duration = 3; //
bool forever = 4; //
}
message BuyTitleResp {
int64 userId = 1; // ID
int64 titleId = 2; // ID
string name = 3; //
int64 cost = 4; //
int32 duration = 5; // (day)
}
message ChangeEliteResp {
int64 userId = 1;
int64 eliteId = 2;
}
message TitleReq {
int64 userId = 1; // ID
int32 sort = 2; //
}
message ChangeTitleResp {
int64 userId = 1;
int64 titleId = 2;
string name = 3;
}
service userCenter {
/// @ZeroGroup: platform_user
// retrievePlatformUser
rpc retrievePlatformUser(PlatformUserReq) returns (PlatformUserResp);
//getUserDetails
rpc getUserDetails(UserIdReq) returns (UserDetailsResp);
// getUserIdByPUid idID
rpc getUserIdByPUid(PlatformUserReq) returns (UserIdResp);
/// @ZeroGroup: integral
//ChangeIntegral
rpc changeIntegral(ChangeIntegralReq) returns (ChangeIntegralResp);
//GetUserIntegral
rpc getUserIntegral(UserIdReq) returns (UserIntegralResp);
//UserCheckIn |
rpc userCheckIn(UserIdReq) returns (UserCheckInResp);
//TransferUserIntegral
rpc transferUserIntegral(TransferUserIntegralReq) returns (TransferUserIntegralResp);
/// @ZeroGroup: coin
//changeCoin
rpc changeCoin(ChangeCoinReq) returns (Empty);
//getUserCoin
rpc getUserCoin(UserIdReq) returns (GetUserCoinResp);
//transferUserCoin
rpc transferUserCoin(TransferUserCoinReq) returns (TransferUserCoinResp);
/// @ZeroGroup: gift
// UserSendGift
rpc userSendGift(UserSendGiftReq) returns(UserSendGiftResp);
rpc userBuyNobility(UserBuyNobilityReq) returns(UserBuyNobilityResp);
rpc userSendGift(UserSendGiftReq) returns(Empty);
rpc userBuyNobility(UserBuyNobilityReq) returns(Empty);
/// @ZeroGroup: statistics
rpc statPvpKill(StatPvPKillReq) returns (Empty);
rpc statPvpFirstBlood(StatPvPFirstBloodReq) returns (Empty);
rpc statPvpReport(StatPvPReportReq) returns (StatPvPReportResp);
/// @ZeroGroup: giftPack
@ -334,7 +356,7 @@ service userCenter {
/// @ZeroGroup: drawPool
rpc increaseWelfare(IncreaseWelfareReq) returns (Empty);
// rpc increaseWelfare(IncreaseWelfareReq) returns (Empty);
/// @ZeroGroup: rank
@ -342,4 +364,13 @@ service userCenter {
rpc rankPvp(RankPvpReq) returns(RankPvpResp);
rpc rankPvpSubmit(RankPvpSubmitReq) returns(RankPvpSubmitResp);
rpc userRankPvp(UserRankReq) returns (UserRankResp);
/// @ZeroGroup: zhg
rpc giveElite(GiveEliteReq) returns(BuyEliteResp);
rpc buyElite(EliteReq) returns(BuyEliteResp);
rpc giveTitle(GiveTitleReq) returns(BuyTitleResp);
rpc buyTitle(TitleReq) returns(BuyTitleResp);
rpc changeElite(EliteReq) returns(ChangeEliteResp);
rpc changeTitle(TitleReq) returns(ChangeTitleResp);
}

@ -24,28 +24,33 @@ const _ = grpc.SupportPackageIsVersion7
type UserCenterClient interface {
// retrievePlatformUser 新增或获取用户
RetrievePlatformUser(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*PlatformUserResp, error)
//getUserDetails 获取用户详细信息
GetUserDetails(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserDetailsResp, error)
// getUserIdByPUid 通过平台用户id获取系统用户ID
GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error)
//ChangeIntegral 新增用户积分
ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error)
//GetUserIntegral 获取用户积分
GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error)
//UserCheckIn 用户签到|打卡
UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error)
//TransferUserIntegral 转移积分
TransferUserIntegral(ctx context.Context, in *TransferUserIntegralReq, opts ...grpc.CallOption) (*TransferUserIntegralResp, error)
//changeCoin 新增或扣减用户弹币
ChangeCoin(ctx context.Context, in *ChangeCoinReq, opts ...grpc.CallOption) (*Empty, error)
//getUserCoin 获取用户弹币
GetUserCoin(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*GetUserCoinResp, error)
//transferUserCoin 转移用户弹币
TransferUserCoin(ctx context.Context, in *TransferUserCoinReq, opts ...grpc.CallOption) (*TransferUserCoinResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*Empty, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error)
DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error)
IncreaseWelfare(ctx context.Context, in *IncreaseWelfareReq, opts ...grpc.CallOption) (*Empty, error)
// rankPvp pvp排行
RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error)
RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error)
UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error)
GiveElite(ctx context.Context, in *GiveEliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error)
BuyElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error)
GiveTitle(ctx context.Context, in *GiveTitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error)
BuyTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error)
ChangeElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*ChangeEliteResp, error)
ChangeTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*ChangeTitleResp, error)
}
type userCenterClient struct {
@ -65,27 +70,18 @@ func (c *userCenterClient) RetrievePlatformUser(ctx context.Context, in *Platfor
return out, nil
}
func (c *userCenterClient) GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error) {
out := new(UserIdResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/getUserIdByPUid", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error) {
out := new(ChangeIntegralResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/changeIntegral", in, out, opts...)
func (c *userCenterClient) GetUserDetails(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserDetailsResp, error) {
out := new(UserDetailsResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/getUserDetails", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error) {
out := new(UserIntegralResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/getUserIntegral", in, out, opts...)
func (c *userCenterClient) GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error) {
out := new(UserIdResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/getUserIdByPUid", in, out, opts...)
if err != nil {
return nil, err
}
@ -101,45 +97,45 @@ func (c *userCenterClient) UserCheckIn(ctx context.Context, in *UserIdReq, opts
return out, nil
}
func (c *userCenterClient) TransferUserIntegral(ctx context.Context, in *TransferUserIntegralReq, opts ...grpc.CallOption) (*TransferUserIntegralResp, error) {
out := new(TransferUserIntegralResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/transferUserIntegral", in, out, opts...)
func (c *userCenterClient) ChangeCoin(ctx context.Context, in *ChangeCoinReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/changeCoin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error) {
out := new(UserSendGiftResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/userSendGift", in, out, opts...)
func (c *userCenterClient) GetUserCoin(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*GetUserCoinResp, error) {
out := new(GetUserCoinResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/getUserCoin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error) {
out := new(UserBuyNobilityResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/userBuyNobility", in, out, opts...)
func (c *userCenterClient) TransferUserCoin(ctx context.Context, in *TransferUserCoinReq, opts ...grpc.CallOption) (*TransferUserCoinResp, error) {
out := new(TransferUserCoinResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/transferUserCoin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error) {
func (c *userCenterClient) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpKill", in, out, opts...)
err := c.cc.Invoke(ctx, "/pb.userCenter/userSendGift", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error) {
func (c *userCenterClient) UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpFirstBlood", in, out, opts...)
err := c.cc.Invoke(ctx, "/pb.userCenter/userBuyNobility", in, out, opts...)
if err != nil {
return nil, err
}
@ -164,15 +160,6 @@ func (c *userCenterClient) DrawGiftPack(ctx context.Context, in *DrawGiftPackReq
return out, nil
}
func (c *userCenterClient) IncreaseWelfare(ctx context.Context, in *IncreaseWelfareReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/increaseWelfare", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) {
out := new(RankPvpResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/rankPvp", in, out, opts...)
@ -200,34 +187,93 @@ func (c *userCenterClient) UserRankPvp(ctx context.Context, in *UserRankReq, opt
return out, nil
}
func (c *userCenterClient) GiveElite(ctx context.Context, in *GiveEliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error) {
out := new(BuyEliteResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/giveElite", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) BuyElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error) {
out := new(BuyEliteResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/buyElite", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) GiveTitle(ctx context.Context, in *GiveTitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error) {
out := new(BuyTitleResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/giveTitle", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) BuyTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error) {
out := new(BuyTitleResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/buyTitle", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) ChangeElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*ChangeEliteResp, error) {
out := new(ChangeEliteResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/changeElite", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) ChangeTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*ChangeTitleResp, error) {
out := new(ChangeTitleResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/changeTitle", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserCenterServer is the server API for UserCenter service.
// All implementations must embed UnimplementedUserCenterServer
// for forward compatibility
type UserCenterServer interface {
// retrievePlatformUser 新增或获取用户
RetrievePlatformUser(context.Context, *PlatformUserReq) (*PlatformUserResp, error)
//getUserDetails 获取用户详细信息
GetUserDetails(context.Context, *UserIdReq) (*UserDetailsResp, error)
// getUserIdByPUid 通过平台用户id获取系统用户ID
GetUserIdByPUid(context.Context, *PlatformUserReq) (*UserIdResp, error)
//ChangeIntegral 新增用户积分
ChangeIntegral(context.Context, *ChangeIntegralReq) (*ChangeIntegralResp, error)
//GetUserIntegral 获取用户积分
GetUserIntegral(context.Context, *UserIdReq) (*UserIntegralResp, error)
//UserCheckIn 用户签到|打卡
UserCheckIn(context.Context, *UserIdReq) (*UserCheckInResp, error)
//TransferUserIntegral 转移积分
TransferUserIntegral(context.Context, *TransferUserIntegralReq) (*TransferUserIntegralResp, error)
//changeCoin 新增或扣减用户弹币
ChangeCoin(context.Context, *ChangeCoinReq) (*Empty, error)
//getUserCoin 获取用户弹币
GetUserCoin(context.Context, *UserIdReq) (*GetUserCoinResp, error)
//transferUserCoin 转移用户弹币
TransferUserCoin(context.Context, *TransferUserCoinReq) (*TransferUserCoinResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(context.Context, *UserSendGiftReq) (*UserSendGiftResp, error)
UserBuyNobility(context.Context, *UserBuyNobilityReq) (*UserBuyNobilityResp, error)
StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error)
StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error)
UserSendGift(context.Context, *UserSendGiftReq) (*Empty, error)
UserBuyNobility(context.Context, *UserBuyNobilityReq) (*Empty, error)
StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error)
DrawGiftPack(context.Context, *DrawGiftPackReq) (*DrawGiftPackResp, error)
IncreaseWelfare(context.Context, *IncreaseWelfareReq) (*Empty, error)
// rankPvp pvp排行
RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error)
RankPvpSubmit(context.Context, *RankPvpSubmitReq) (*RankPvpSubmitResp, error)
UserRankPvp(context.Context, *UserRankReq) (*UserRankResp, error)
GiveElite(context.Context, *GiveEliteReq) (*BuyEliteResp, error)
BuyElite(context.Context, *EliteReq) (*BuyEliteResp, error)
GiveTitle(context.Context, *GiveTitleReq) (*BuyTitleResp, error)
BuyTitle(context.Context, *TitleReq) (*BuyTitleResp, error)
ChangeElite(context.Context, *EliteReq) (*ChangeEliteResp, error)
ChangeTitle(context.Context, *TitleReq) (*ChangeTitleResp, error)
mustEmbedUnimplementedUserCenterServer()
}
@ -238,32 +284,29 @@ type UnimplementedUserCenterServer struct {
func (UnimplementedUserCenterServer) RetrievePlatformUser(context.Context, *PlatformUserReq) (*PlatformUserResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RetrievePlatformUser not implemented")
}
func (UnimplementedUserCenterServer) GetUserDetails(context.Context, *UserIdReq) (*UserDetailsResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserDetails not implemented")
}
func (UnimplementedUserCenterServer) GetUserIdByPUid(context.Context, *PlatformUserReq) (*UserIdResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserIdByPUid not implemented")
}
func (UnimplementedUserCenterServer) ChangeIntegral(context.Context, *ChangeIntegralReq) (*ChangeIntegralResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeIntegral not implemented")
}
func (UnimplementedUserCenterServer) GetUserIntegral(context.Context, *UserIdReq) (*UserIntegralResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserIntegral not implemented")
}
func (UnimplementedUserCenterServer) UserCheckIn(context.Context, *UserIdReq) (*UserCheckInResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserCheckIn not implemented")
}
func (UnimplementedUserCenterServer) TransferUserIntegral(context.Context, *TransferUserIntegralReq) (*TransferUserIntegralResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method TransferUserIntegral not implemented")
func (UnimplementedUserCenterServer) ChangeCoin(context.Context, *ChangeCoinReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeCoin not implemented")
}
func (UnimplementedUserCenterServer) UserSendGift(context.Context, *UserSendGiftReq) (*UserSendGiftResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserSendGift not implemented")
func (UnimplementedUserCenterServer) GetUserCoin(context.Context, *UserIdReq) (*GetUserCoinResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserCoin not implemented")
}
func (UnimplementedUserCenterServer) UserBuyNobility(context.Context, *UserBuyNobilityReq) (*UserBuyNobilityResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserBuyNobility not implemented")
func (UnimplementedUserCenterServer) TransferUserCoin(context.Context, *TransferUserCoinReq) (*TransferUserCoinResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method TransferUserCoin not implemented")
}
func (UnimplementedUserCenterServer) StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpKill not implemented")
func (UnimplementedUserCenterServer) UserSendGift(context.Context, *UserSendGiftReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserSendGift not implemented")
}
func (UnimplementedUserCenterServer) StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpFirstBlood not implemented")
func (UnimplementedUserCenterServer) UserBuyNobility(context.Context, *UserBuyNobilityReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserBuyNobility not implemented")
}
func (UnimplementedUserCenterServer) StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpReport not implemented")
@ -271,9 +314,6 @@ func (UnimplementedUserCenterServer) StatPvpReport(context.Context, *StatPvPRepo
func (UnimplementedUserCenterServer) DrawGiftPack(context.Context, *DrawGiftPackReq) (*DrawGiftPackResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DrawGiftPack not implemented")
}
func (UnimplementedUserCenterServer) IncreaseWelfare(context.Context, *IncreaseWelfareReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method IncreaseWelfare not implemented")
}
func (UnimplementedUserCenterServer) RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RankPvp not implemented")
}
@ -283,6 +323,24 @@ func (UnimplementedUserCenterServer) RankPvpSubmit(context.Context, *RankPvpSubm
func (UnimplementedUserCenterServer) UserRankPvp(context.Context, *UserRankReq) (*UserRankResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserRankPvp not implemented")
}
func (UnimplementedUserCenterServer) GiveElite(context.Context, *GiveEliteReq) (*BuyEliteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GiveElite not implemented")
}
func (UnimplementedUserCenterServer) BuyElite(context.Context, *EliteReq) (*BuyEliteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method BuyElite not implemented")
}
func (UnimplementedUserCenterServer) GiveTitle(context.Context, *GiveTitleReq) (*BuyTitleResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GiveTitle not implemented")
}
func (UnimplementedUserCenterServer) BuyTitle(context.Context, *TitleReq) (*BuyTitleResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method BuyTitle not implemented")
}
func (UnimplementedUserCenterServer) ChangeElite(context.Context, *EliteReq) (*ChangeEliteResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeElite not implemented")
}
func (UnimplementedUserCenterServer) ChangeTitle(context.Context, *TitleReq) (*ChangeTitleResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeTitle not implemented")
}
func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {}
// UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service.
@ -314,6 +372,24 @@ func _UserCenter_RetrievePlatformUser_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _UserCenter_GetUserDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).GetUserDetails(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/getUserDetails",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).GetUserDetails(ctx, req.(*UserIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_GetUserIdByPUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PlatformUserReq)
if err := dec(in); err != nil {
@ -332,74 +408,74 @@ func _UserCenter_GetUserIdByPUid_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _UserCenter_ChangeIntegral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangeIntegralReq)
func _UserCenter_UserCheckIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).ChangeIntegral(ctx, in)
return srv.(UserCenterServer).UserCheckIn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/changeIntegral",
FullMethod: "/pb.userCenter/userCheckIn",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).ChangeIntegral(ctx, req.(*ChangeIntegralReq))
return srv.(UserCenterServer).UserCheckIn(ctx, req.(*UserIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_GetUserIntegral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdReq)
func _UserCenter_ChangeCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangeCoinReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).GetUserIntegral(ctx, in)
return srv.(UserCenterServer).ChangeCoin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/getUserIntegral",
FullMethod: "/pb.userCenter/changeCoin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).GetUserIntegral(ctx, req.(*UserIdReq))
return srv.(UserCenterServer).ChangeCoin(ctx, req.(*ChangeCoinReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_UserCheckIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _UserCenter_GetUserCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).UserCheckIn(ctx, in)
return srv.(UserCenterServer).GetUserCoin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/userCheckIn",
FullMethod: "/pb.userCenter/getUserCoin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).UserCheckIn(ctx, req.(*UserIdReq))
return srv.(UserCenterServer).GetUserCoin(ctx, req.(*UserIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_TransferUserIntegral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TransferUserIntegralReq)
func _UserCenter_TransferUserCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TransferUserCoinReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).TransferUserIntegral(ctx, in)
return srv.(UserCenterServer).TransferUserCoin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/transferUserIntegral",
FullMethod: "/pb.userCenter/transferUserCoin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).TransferUserIntegral(ctx, req.(*TransferUserIntegralReq))
return srv.(UserCenterServer).TransferUserCoin(ctx, req.(*TransferUserCoinReq))
}
return interceptor(ctx, in, info, handler)
}
@ -440,146 +516,200 @@ func _UserCenter_UserBuyNobility_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpKill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPKillReq)
func _UserCenter_StatPvpReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPReportReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).StatPvpKill(ctx, in)
return srv.(UserCenterServer).StatPvpReport(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/statPvpKill",
FullMethod: "/pb.userCenter/statPvpReport",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).StatPvpKill(ctx, req.(*StatPvPKillReq))
return srv.(UserCenterServer).StatPvpReport(ctx, req.(*StatPvPReportReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpFirstBlood_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPFirstBloodReq)
func _UserCenter_DrawGiftPack_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DrawGiftPackReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).StatPvpFirstBlood(ctx, in)
return srv.(UserCenterServer).DrawGiftPack(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/statPvpFirstBlood",
FullMethod: "/pb.userCenter/drawGiftPack",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).StatPvpFirstBlood(ctx, req.(*StatPvPFirstBloodReq))
return srv.(UserCenterServer).DrawGiftPack(ctx, req.(*DrawGiftPackReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPReportReq)
func _UserCenter_RankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RankPvpReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).StatPvpReport(ctx, in)
return srv.(UserCenterServer).RankPvp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/statPvpReport",
FullMethod: "/pb.userCenter/rankPvp",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).StatPvpReport(ctx, req.(*StatPvPReportReq))
return srv.(UserCenterServer).RankPvp(ctx, req.(*RankPvpReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_DrawGiftPack_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DrawGiftPackReq)
func _UserCenter_RankPvpSubmit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RankPvpSubmitReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).DrawGiftPack(ctx, in)
return srv.(UserCenterServer).RankPvpSubmit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/drawGiftPack",
FullMethod: "/pb.userCenter/rankPvpSubmit",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).DrawGiftPack(ctx, req.(*DrawGiftPackReq))
return srv.(UserCenterServer).RankPvpSubmit(ctx, req.(*RankPvpSubmitReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_IncreaseWelfare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IncreaseWelfareReq)
func _UserCenter_UserRankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserRankReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).IncreaseWelfare(ctx, in)
return srv.(UserCenterServer).UserRankPvp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/increaseWelfare",
FullMethod: "/pb.userCenter/userRankPvp",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).IncreaseWelfare(ctx, req.(*IncreaseWelfareReq))
return srv.(UserCenterServer).UserRankPvp(ctx, req.(*UserRankReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_RankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RankPvpReq)
func _UserCenter_GiveElite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GiveEliteReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).RankPvp(ctx, in)
return srv.(UserCenterServer).GiveElite(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/rankPvp",
FullMethod: "/pb.userCenter/giveElite",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).RankPvp(ctx, req.(*RankPvpReq))
return srv.(UserCenterServer).GiveElite(ctx, req.(*GiveEliteReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_RankPvpSubmit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RankPvpSubmitReq)
func _UserCenter_BuyElite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EliteReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).RankPvpSubmit(ctx, in)
return srv.(UserCenterServer).BuyElite(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/rankPvpSubmit",
FullMethod: "/pb.userCenter/buyElite",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).RankPvpSubmit(ctx, req.(*RankPvpSubmitReq))
return srv.(UserCenterServer).BuyElite(ctx, req.(*EliteReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_UserRankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserRankReq)
func _UserCenter_GiveTitle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GiveTitleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).UserRankPvp(ctx, in)
return srv.(UserCenterServer).GiveTitle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/userRankPvp",
FullMethod: "/pb.userCenter/giveTitle",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).UserRankPvp(ctx, req.(*UserRankReq))
return srv.(UserCenterServer).GiveTitle(ctx, req.(*GiveTitleReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_BuyTitle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TitleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).BuyTitle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/buyTitle",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).BuyTitle(ctx, req.(*TitleReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_ChangeElite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EliteReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).ChangeElite(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/changeElite",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).ChangeElite(ctx, req.(*EliteReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_ChangeTitle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TitleReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).ChangeTitle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/changeTitle",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).ChangeTitle(ctx, req.(*TitleReq))
}
return interceptor(ctx, in, info, handler)
}
@ -595,25 +725,29 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "retrievePlatformUser",
Handler: _UserCenter_RetrievePlatformUser_Handler,
},
{
MethodName: "getUserDetails",
Handler: _UserCenter_GetUserDetails_Handler,
},
{
MethodName: "getUserIdByPUid",
Handler: _UserCenter_GetUserIdByPUid_Handler,
},
{
MethodName: "changeIntegral",
Handler: _UserCenter_ChangeIntegral_Handler,
MethodName: "userCheckIn",
Handler: _UserCenter_UserCheckIn_Handler,
},
{
MethodName: "getUserIntegral",
Handler: _UserCenter_GetUserIntegral_Handler,
MethodName: "changeCoin",
Handler: _UserCenter_ChangeCoin_Handler,
},
{
MethodName: "userCheckIn",
Handler: _UserCenter_UserCheckIn_Handler,
MethodName: "getUserCoin",
Handler: _UserCenter_GetUserCoin_Handler,
},
{
MethodName: "transferUserIntegral",
Handler: _UserCenter_TransferUserIntegral_Handler,
MethodName: "transferUserCoin",
Handler: _UserCenter_TransferUserCoin_Handler,
},
{
MethodName: "userSendGift",
@ -623,14 +757,6 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "userBuyNobility",
Handler: _UserCenter_UserBuyNobility_Handler,
},
{
MethodName: "statPvpKill",
Handler: _UserCenter_StatPvpKill_Handler,
},
{
MethodName: "statPvpFirstBlood",
Handler: _UserCenter_StatPvpFirstBlood_Handler,
},
{
MethodName: "statPvpReport",
Handler: _UserCenter_StatPvpReport_Handler,
@ -639,10 +765,6 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "drawGiftPack",
Handler: _UserCenter_DrawGiftPack_Handler,
},
{
MethodName: "increaseWelfare",
Handler: _UserCenter_IncreaseWelfare_Handler,
},
{
MethodName: "rankPvp",
Handler: _UserCenter_RankPvp_Handler,
@ -655,6 +777,30 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "userRankPvp",
Handler: _UserCenter_UserRankPvp_Handler,
},
{
MethodName: "giveElite",
Handler: _UserCenter_GiveElite_Handler,
},
{
MethodName: "buyElite",
Handler: _UserCenter_BuyElite_Handler,
},
{
MethodName: "giveTitle",
Handler: _UserCenter_GiveTitle_Handler,
},
{
MethodName: "buyTitle",
Handler: _UserCenter_BuyTitle_Handler,
},
{
MethodName: "changeElite",
Handler: _UserCenter_ChangeElite_Handler,
},
{
MethodName: "changeTitle",
Handler: _UserCenter_ChangeTitle_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "user_center.proto",

@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"github.com/zeromicro/go-zero/core/conf"
"live-service/app/user_center/rpc/internal/config"
"live-service/app/user_center/rpc/internal/logic/gift_collect"
"live-service/app/user_center/rpc/internal/logic/platform_user"
@ -12,7 +13,6 @@ import (
"live-service/app/user_center/rpc/pb"
"live-service/common/interceptor/rpcserver"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
@ -26,7 +26,11 @@ func main() {
var c config.Config
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
var cg config.GameConfig
config.MustLoad(*configFile, &cg)
ctx := svc.NewServiceContext(&c, &cg)
svr := server.NewUserCenterServer(ctx)
platform_user.InitUserRetriever(ctx)

@ -13,12 +13,19 @@ import (
)
type (
ChangeIntegralReq = pb.ChangeIntegralReq
ChangeIntegralResp = pb.ChangeIntegralResp
BuyEliteResp = pb.BuyEliteResp
BuyTitleResp = pb.BuyTitleResp
ChangeCoinReq = pb.ChangeCoinReq
ChangeEliteResp = pb.ChangeEliteResp
ChangeTitleResp = pb.ChangeTitleResp
DrawGiftPackReq = pb.DrawGiftPackReq
DrawGiftPackResp = pb.DrawGiftPackResp
EliteReq = pb.EliteReq
Empty = pb.Empty
GetUserCoinResp = pb.GetUserCoinResp
GiftPackItem = pb.GiftPackItem
GiveEliteReq = pb.GiveEliteReq
GiveTitleReq = pb.GiveTitleReq
IncreaseWelfareReq = pb.IncreaseWelfareReq
PlatformUserReq = pb.PlatformUserReq
PlatformUserResp = pb.PlatformUserResp
@ -29,52 +36,56 @@ type (
RankPvpSubmitResp = pb.RankPvpSubmitResp
RankPvpSubmitResp_Item = pb.RankPvpSubmitResp_Item
RankPvpSubmitResp_Result = pb.RankPvpSubmitResp_Result
StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq
StatPvPKillReq = pb.StatPvPKillReq
Response = pb.Response
StatPvPReportReq = pb.StatPvPReportReq
StatPvPReportReq_Item = pb.StatPvPReportReq_Item
StatPvPReportResp = pb.StatPvPReportResp
StatPvPReportResp_Item = pb.StatPvPReportResp_Item
TransferUserIntegralReq = pb.TransferUserIntegralReq
TransferUserIntegralResp = pb.TransferUserIntegralResp
User = pb.User
TitleReq = pb.TitleReq
TransferUserCoinReq = pb.TransferUserCoinReq
TransferUserCoinResp = pb.TransferUserCoinResp
UserBuyNobilityReq = pb.UserBuyNobilityReq
UserBuyNobilityResp = pb.UserBuyNobilityResp
UserCheckInResp = pb.UserCheckInResp
UserDetailsResp = pb.UserDetailsResp
UserDetailsResp_EliteItem = pb.UserDetailsResp_EliteItem
UserDetailsResp_TitleItem = pb.UserDetailsResp_TitleItem
UserIdReq = pb.UserIdReq
UserIdResp = pb.UserIdResp
UserIntegralResp = pb.UserIntegralResp
UserRankReq = pb.UserRankReq
UserRankResp = pb.UserRankResp
UserRankResp_Item = pb.UserRankResp_Item
UserSendGiftReq = pb.UserSendGiftReq
UserSendGiftResp = pb.UserSendGiftResp
UserCenter interface {
// retrievePlatformUser 新增或获取用户
RetrievePlatformUser(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*PlatformUserResp, error)
// getUserDetails 获取用户详细信息
GetUserDetails(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserDetailsResp, error)
// getUserIdByPUid 通过平台用户id获取系统用户ID
GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error)
// ChangeIntegral 新增用户积分
ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error)
// GetUserIntegral 获取用户积分
GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error)
// UserCheckIn 用户签到|打卡
UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error)
// TransferUserIntegral 转移积分
TransferUserIntegral(ctx context.Context, in *TransferUserIntegralReq, opts ...grpc.CallOption) (*TransferUserIntegralResp, error)
// changeCoin 新增或扣减用户弹币
ChangeCoin(ctx context.Context, in *ChangeCoinReq, opts ...grpc.CallOption) (*Empty, error)
// getUserCoin 获取用户弹币
GetUserCoin(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*GetUserCoinResp, error)
// transferUserCoin 转移用户弹币
TransferUserCoin(ctx context.Context, in *TransferUserCoinReq, opts ...grpc.CallOption) (*TransferUserCoinResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*Empty, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error)
DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error)
IncreaseWelfare(ctx context.Context, in *IncreaseWelfareReq, opts ...grpc.CallOption) (*Empty, error)
// rankPvp pvp排行
RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error)
RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error)
UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error)
GiveElite(ctx context.Context, in *GiveEliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error)
BuyElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error)
GiveTitle(ctx context.Context, in *GiveTitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error)
BuyTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error)
ChangeElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*ChangeEliteResp, error)
ChangeTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*ChangeTitleResp, error)
}
defaultUserCenter struct {
@ -94,22 +105,16 @@ func (m *defaultUserCenter) RetrievePlatformUser(ctx context.Context, in *Platfo
return client.RetrievePlatformUser(ctx, in, opts...)
}
// getUserIdByPUid 通过平台用户id获取系统用户ID
func (m *defaultUserCenter) GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error) {
// getUserDetails 获取用户详细信息
func (m *defaultUserCenter) GetUserDetails(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserDetailsResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.GetUserIdByPUid(ctx, in, opts...)
return client.GetUserDetails(ctx, in, opts...)
}
// ChangeIntegral 新增用户积分
func (m *defaultUserCenter) ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.ChangeIntegral(ctx, in, opts...)
}
// GetUserIntegral 获取用户积分
func (m *defaultUserCenter) GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error) {
// getUserIdByPUid 通过平台用户id获取系统用户ID
func (m *defaultUserCenter) GetUserIdByPUid(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*UserIdResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.GetUserIntegral(ctx, in, opts...)
return client.GetUserIdByPUid(ctx, in, opts...)
}
// UserCheckIn 用户签到|打卡
@ -118,31 +123,33 @@ func (m *defaultUserCenter) UserCheckIn(ctx context.Context, in *UserIdReq, opts
return client.UserCheckIn(ctx, in, opts...)
}
// TransferUserIntegral 转移积分
func (m *defaultUserCenter) TransferUserIntegral(ctx context.Context, in *TransferUserIntegralReq, opts ...grpc.CallOption) (*TransferUserIntegralResp, error) {
// changeCoin 新增或扣减用户弹币
func (m *defaultUserCenter) ChangeCoin(ctx context.Context, in *ChangeCoinReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.TransferUserIntegral(ctx, in, opts...)
return client.ChangeCoin(ctx, in, opts...)
}
// UserSendGift 用户赠送礼物
func (m *defaultUserCenter) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error) {
// getUserCoin 获取用户弹币
func (m *defaultUserCenter) GetUserCoin(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*GetUserCoinResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.UserSendGift(ctx, in, opts...)
return client.GetUserCoin(ctx, in, opts...)
}
func (m *defaultUserCenter) UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error) {
// transferUserCoin 转移用户弹币
func (m *defaultUserCenter) TransferUserCoin(ctx context.Context, in *TransferUserCoinReq, opts ...grpc.CallOption) (*TransferUserCoinResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.UserBuyNobility(ctx, in, opts...)
return client.TransferUserCoin(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error) {
// UserSendGift 用户赠送礼物
func (m *defaultUserCenter) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpKill(ctx, in, opts...)
return client.UserSendGift(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error) {
func (m *defaultUserCenter) UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpFirstBlood(ctx, in, opts...)
return client.UserBuyNobility(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error) {
@ -155,11 +162,6 @@ func (m *defaultUserCenter) DrawGiftPack(ctx context.Context, in *DrawGiftPackRe
return client.DrawGiftPack(ctx, in, opts...)
}
func (m *defaultUserCenter) IncreaseWelfare(ctx context.Context, in *IncreaseWelfareReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.IncreaseWelfare(ctx, in, opts...)
}
// rankPvp pvp排行
func (m *defaultUserCenter) RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
@ -175,3 +177,33 @@ func (m *defaultUserCenter) UserRankPvp(ctx context.Context, in *UserRankReq, op
client := pb.NewUserCenterClient(m.cli.Conn())
return client.UserRankPvp(ctx, in, opts...)
}
func (m *defaultUserCenter) GiveElite(ctx context.Context, in *GiveEliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.GiveElite(ctx, in, opts...)
}
func (m *defaultUserCenter) BuyElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*BuyEliteResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.BuyElite(ctx, in, opts...)
}
func (m *defaultUserCenter) GiveTitle(ctx context.Context, in *GiveTitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.GiveTitle(ctx, in, opts...)
}
func (m *defaultUserCenter) BuyTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*BuyTitleResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.BuyTitle(ctx, in, opts...)
}
func (m *defaultUserCenter) ChangeElite(ctx context.Context, in *EliteReq, opts ...grpc.CallOption) (*ChangeEliteResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.ChangeElite(ctx, in, opts...)
}
func (m *defaultUserCenter) ChangeTitle(ctx context.Context, in *TitleReq, opts ...grpc.CallOption) (*ChangeTitleResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.ChangeTitle(ctx, in, opts...)
}

@ -19,38 +19,51 @@ const (
// 业务错误
// 用户积分相关 UserIntegral
const (
UserIntegralNotEnoughError uint32 = iota + 200100 // 用户积分不足
// UserAlreadyCheckIn 用户相关
UserAlreadyCheckIn uint32 = iota + 200100 // 用户已打过卡了
// UserIntegralNotEnoughError 用户积分相关 UserIntegral
UserIntegralNotEnoughError // 用户积分不足
NewUserIntegralError // 新建用户积分失败
GetUserIntegralError // 获取用户积分失败
UpdateUserIntegralError // 更新用户积分失败
)
// 礼包相关 GiftPack
// UserCoinNotEnoughErr 用户金币(Coin)相关 UserCoin
UserCoinNotEnoughErr // 用户金币不足
NewUserCoinErr // 新建用户金币失败
GetUserCoinErr // 获取用户金币失败
UpdateUserCoinErr // 更新用户金币失败
// UserEliteExpiresErr 用户精英单位相关
UserEliteExpiresErr // 用户精英单位过期
UserEliteNotFoundErr // 用户没有此单位
UserChangeEliteErr // 用户切换精英单位失败
const (
GiftPackHasDrawError uint32 = 201100 // 该礼包已经领取过
GiftPackDrawCountLimitedError = 201101 // 该礼包已领取完
// UserTitleExpiresErr 用户称号相关
UserTitleExpiresErr // 用户称号过期
UserTitleNotFoundErr // 用户没有此称号
UserChangeTitleErr // 用户切换称号失败
)
// 礼物相关 Gift
// 其它业务
const (
GiftRecordErr uint32 = 202100 // 礼物记录失败
GiftNobilityUpdateErr = 202101 // 更新贵族信息失败
)
// GiftPackHasDrawError 礼包相关 GiftPack
GiftPackHasDrawError uint32 = iota + 201100 // 该礼包已经领取过
GiftPackDrawCountLimitedError // 该礼包已领取完
// 排行相关
// GiftRecordErr 礼物相关 Gift
GiftRecordErr // 礼物记录失败
GiftNobilityUpdateErr // 更新贵族信息失败
const (
RankStatisticsSelectError uint32 = 203100 // 获取统计数据失败
)
// RankStatisticsSelectError 排行相关
RankStatisticsSelectError // 获取统计数据失败
// 用户金币(Coin)相关 UserCoin
const (
UserCoinNotEnoughErr uint32 = iota + 204100 // 用户金币不足
NewUserCoinErr // 新建用户金币失败
GetUserCoinErr // 获取用户金币失败
UpdateUserCoinErr // 更新用户金币失败
// EliteConfigNotFoundErr 精英单位
EliteConfigNotFoundErr // 精英单位配置不存在
// TitleConfigNotFoundErr 称号相关
TitleConfigNotFoundErr // 称号配置不存在
TitleCannotBuyErr // 该称号禁止购买
)

@ -0,0 +1,28 @@
package timex
import (
"github.com/jinzhu/now"
"time"
)
// DayExpire 日期是否过期
// 使用 BeginningOfDay 判断
func DayExpire(nowTime time.Time, src time.Time, forever bool) bool {
if forever {
return false
}
today := now.With(nowTime).BeginningOfDay()
return !today.Before(now.With(src).BeginningOfDay())
}
// DayRemain 剩余天数(包括今天)
func DayRemain(nowTime time.Time, src time.Time, forever bool) int32 {
if forever {
return -1
}
resp := int32(src.YearDay() - nowTime.YearDay())
if resp < 0 {
resp = 0
}
return resp
}

@ -3,12 +3,13 @@ module live-service
go 1.18
require (
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.6
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.8
git.noahlan.cn/northlan/ntools-go/kafka v1.0.1
git.noahlan.cn/northlan/ntools-go/uuid v1.0.0
github.com/Shopify/sarama v1.33.0
github.com/hashicorp/golang-lru v0.5.1
github.com/jinzhu/now v1.1.5
github.com/knadh/koanf v1.4.1
github.com/longzhiri/gozset v0.0.0-20210113140059-91f2d281daf1
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.0
@ -31,6 +32,7 @@ require (
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
@ -54,6 +56,9 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.4 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect

@ -31,10 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.4 h1:r9jH+tJ1YoeX0gtt26lWeW2hxJGbKH1DksnIrjrLaMk=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.4/go.mod h1:ExV9s96axCdMcaXqsezoUxnbTptkMqwvNWvON05uzjE=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.6 h1:Y59SvkmIFsAAF3BifOxMjOwj/USsZDLuMuliPS2r4OA=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.6/go.mod h1:ExV9s96axCdMcaXqsezoUxnbTptkMqwvNWvON05uzjE=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.8 h1:k2dEdCJWj0rFqOWy8XHolKnw896Dn4RYqWtLqlp+7zI=
git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.8/go.mod h1:ExV9s96axCdMcaXqsezoUxnbTptkMqwvNWvON05uzjE=
git.noahlan.cn/northlan/ntools-go/kafka v1.0.1 h1:SDUwYRzksZ3Vcu7PTZxk+TEMF2f3gBiQEboKOhi1yfI=
git.noahlan.cn/northlan/ntools-go/kafka v1.0.1/go.mod h1:RxX9JSUIr3Gbk+cvUwE5k+i08AgIK3TA9ayDJCMn2n8=
git.noahlan.cn/northlan/ntools-go/uuid v1.0.0 h1:C0PazSzG3+e/Hfh2C6Qf8R46sNZmZKTOcWS990yUmrE=
@ -71,13 +69,26 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGn
github.com/alicebob/miniredis/v2 v2.17.0 h1:EwLdrIS50uczw71Jc7iVSxZluTKj5nfSP8n7ARRnJy0=
github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4=
github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw=
github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM=
github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ=
github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8=
github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk=
github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g=
github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@ -127,7 +138,9 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
@ -146,6 +159,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
@ -174,6 +188,7 @@ github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfC
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@ -261,14 +276,33 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplb
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=
github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
@ -297,7 +331,11 @@ github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkr
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -315,6 +353,8 @@ github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.4 h1:1kn4/7MepF/CHmYub99/nNX8az0IJjfSOU/jbnTVfqQ=
github.com/klauspost/compress v1.15.4/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/knadh/koanf v1.4.1 h1:Z0VGW/uo8NJmjd+L1Dc3S5frq6c62w5xQ9Yf4Mg3wFQ=
github.com/knadh/koanf v1.4.1/go.mod h1:1cfH5223ZeZUOs8FU2UdTmaNfHpqgtjV0+NHjRO43gs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
@ -334,7 +374,9 @@ github.com/longzhiri/gozset v0.0.0-20210113140059-91f2d281daf1 h1:fCVAFg3S0Q/jm7
github.com/longzhiri/gozset v0.0.0-20210113140059-91f2d281daf1/go.mod h1:BlQbuXS7HqF9F+ZfnUG+GXrKndMZXa0xspzG/wY3IGk=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@ -343,7 +385,21 @@ github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/K
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -357,9 +413,11 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@ -377,6 +435,9 @@ github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw=
github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
@ -387,6 +448,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
@ -412,6 +474,7 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E=
github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
@ -420,6 +483,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
@ -610,13 +675,16 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -672,6 +740,7 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -763,6 +832,7 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@ -794,9 +864,11 @@ google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 h1:nquqdM9+ps0JZcIiI70+tqoaIFS5Ql4ZuK8UXnz3HfE=
google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
@ -829,6 +901,7 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@ -841,6 +914,7 @@ gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

Loading…
Cancel
Save