refactor: 粮草版,精英单位,称号。
parent
6c1f3c2d76
commit
5a3febc5cc
@ -0,0 +1,6 @@
|
||||
Name: usercenter.rpc
|
||||
ListenOn: 127.0.0.1:8080
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
Key: usercenter.rpc
|
@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.BuyEliteResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.BuyTitleResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.Empty{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.ChangeEliteResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.ChangeTitleResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DrawGiftPackLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewDrawGiftPackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DrawGiftPackLogic {
|
||||
return &DrawGiftPackLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DrawGiftPackLogic) DrawGiftPack(in *pb.DrawGiftPackReq) (*pb.DrawGiftPackResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.DrawGiftPackResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.GetUserCoinResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.UserDetailsResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetUserIdByPUidLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserIdByPUidLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserIdByPUidLogic {
|
||||
return &GetUserIdByPUidLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// getUserIdByPUid 通过平台用户id获取系统用户ID
|
||||
func (l *GetUserIdByPUidLogic) GetUserIdByPUid(in *pb.PlatformUserReq) (*pb.UserIdResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.UserIdResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.BuyEliteResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.BuyTitleResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RankPvpLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewRankPvpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RankPvpLogic {
|
||||
return &RankPvpLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// rankPvp pvp排行
|
||||
func (l *RankPvpLogic) RankPvp(in *pb.RankPvpReq) (*pb.RankPvpResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.RankPvpResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RankPvpSubmitLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewRankPvpSubmitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RankPvpSubmitLogic {
|
||||
return &RankPvpSubmitLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RankPvpSubmitLogic) RankPvpSubmit(in *pb.RankPvpSubmitReq) (*pb.RankPvpSubmitResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.RankPvpSubmitResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RetrievePlatformUserLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewRetrievePlatformUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RetrievePlatformUserLogic {
|
||||
return &RetrievePlatformUserLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// retrievePlatformUser 新增或获取用户
|
||||
func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) (*pb.PlatformUserResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.PlatformUserResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StatPvpReportLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewStatPvpReportLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatPvpReportLogic {
|
||||
return &StatPvpReportLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvPReportResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.StatPvPReportResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/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) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.TransferUserCoinResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UserBuyNobilityLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUserBuyNobilityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserBuyNobilityLogic {
|
||||
return &UserBuyNobilityLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UserBuyNobilityLogic) UserBuyNobility(in *pb.UserBuyNobilityReq) (*pb.Empty, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.Empty{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UserCheckInLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUserCheckInLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserCheckInLogic {
|
||||
return &UserCheckInLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// UserCheckIn 用户签到|打卡
|
||||
func (l *UserCheckInLogic) UserCheckIn(in *pb.UserIdReq) (*pb.UserCheckInResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.UserCheckInResp{}, nil
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UserRankPvpLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUserRankPvpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserRankPvpLogic {
|
||||
return &UserRankPvpLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UserRankPvpLogic) UserRankPvp(in *pb.UserRankReq) (*pb.UserRankResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.UserRankResp{}, nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UserSendGiftLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUserSendGiftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserSendGiftLogic {
|
||||
return &UserSendGiftLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// UserSendGift 用户赠送礼物
|
||||
func (l *UserSendGiftLogic) UserSendGift(in *pb.UserSendGiftReq) (*pb.Empty, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.Empty{}, nil
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
// Code generated by goctl. DO NOT EDIT!
|
||||
// Source: user_center.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"dcg/app/user_center/internal/logic"
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
)
|
||||
|
||||
type UserCenterServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
pb.UnimplementedUserCenterServer
|
||||
}
|
||||
|
||||
func NewUserCenterServer(svcCtx *svc.ServiceContext) *UserCenterServer {
|
||||
return &UserCenterServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// retrievePlatformUser 新增或获取用户
|
||||
func (s *UserCenterServer) RetrievePlatformUser(ctx context.Context, in *pb.PlatformUserReq) (*pb.PlatformUserResp, error) {
|
||||
l := logic.NewRetrievePlatformUserLogic(ctx, s.svcCtx)
|
||||
return l.RetrievePlatformUser(in)
|
||||
}
|
||||
|
||||
// getUserDetails 获取用户详细信息
|
||||
func (s *UserCenterServer) GetUserDetails(ctx context.Context, in *pb.UserIdReq) (*pb.UserDetailsResp, error) {
|
||||
l := logic.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 := logic.NewGetUserIdByPUidLogic(ctx, s.svcCtx)
|
||||
return l.GetUserIdByPUid(in)
|
||||
}
|
||||
|
||||
// UserCheckIn 用户签到|打卡
|
||||
func (s *UserCenterServer) UserCheckIn(ctx context.Context, in *pb.UserIdReq) (*pb.UserCheckInResp, error) {
|
||||
l := logic.NewUserCheckInLogic(ctx, s.svcCtx)
|
||||
return l.UserCheckIn(in)
|
||||
}
|
||||
|
||||
// changeCoin 新增或扣减用户弹币
|
||||
func (s *UserCenterServer) ChangeCoin(ctx context.Context, in *pb.ChangeCoinReq) (*pb.Empty, error) {
|
||||
l := logic.NewChangeCoinLogic(ctx, s.svcCtx)
|
||||
return l.ChangeCoin(in)
|
||||
}
|
||||
|
||||
// getUserCoin 获取用户弹币
|
||||
func (s *UserCenterServer) GetUserCoin(ctx context.Context, in *pb.UserIdReq) (*pb.GetUserCoinResp, error) {
|
||||
l := logic.NewGetUserCoinLogic(ctx, s.svcCtx)
|
||||
return l.GetUserCoin(in)
|
||||
}
|
||||
|
||||
// transferUserCoin 转移用户弹币
|
||||
func (s *UserCenterServer) TransferUserCoin(ctx context.Context, in *pb.TransferUserCoinReq) (*pb.TransferUserCoinResp, error) {
|
||||
l := logic.NewTransferUserCoinLogic(ctx, s.svcCtx)
|
||||
return l.TransferUserCoin(in)
|
||||
}
|
||||
|
||||
// UserSendGift 用户赠送礼物
|
||||
func (s *UserCenterServer) UserSendGift(ctx context.Context, in *pb.UserSendGiftReq) (*pb.Empty, error) {
|
||||
l := logic.NewUserSendGiftLogic(ctx, s.svcCtx)
|
||||
return l.UserSendGift(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) UserBuyNobility(ctx context.Context, in *pb.UserBuyNobilityReq) (*pb.Empty, error) {
|
||||
l := logic.NewUserBuyNobilityLogic(ctx, s.svcCtx)
|
||||
return l.UserBuyNobility(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) StatPvpReport(ctx context.Context, in *pb.StatPvPReportReq) (*pb.StatPvPReportResp, error) {
|
||||
l := logic.NewStatPvpReportLogic(ctx, s.svcCtx)
|
||||
return l.StatPvpReport(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) DrawGiftPack(ctx context.Context, in *pb.DrawGiftPackReq) (*pb.DrawGiftPackResp, error) {
|
||||
l := logic.NewDrawGiftPackLogic(ctx, s.svcCtx)
|
||||
return l.DrawGiftPack(in)
|
||||
}
|
||||
|
||||
// rankPvp pvp排行
|
||||
func (s *UserCenterServer) RankPvp(ctx context.Context, in *pb.RankPvpReq) (*pb.RankPvpResp, error) {
|
||||
l := logic.NewRankPvpLogic(ctx, s.svcCtx)
|
||||
return l.RankPvp(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) RankPvpSubmit(ctx context.Context, in *pb.RankPvpSubmitReq) (*pb.RankPvpSubmitResp, error) {
|
||||
l := logic.NewRankPvpSubmitLogic(ctx, s.svcCtx)
|
||||
return l.RankPvpSubmit(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) UserRankPvp(ctx context.Context, in *pb.UserRankReq) (*pb.UserRankResp, error) {
|
||||
l := logic.NewUserRankPvpLogic(ctx, s.svcCtx)
|
||||
return l.UserRankPvp(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) GiveElite(ctx context.Context, in *pb.GiveEliteReq) (*pb.BuyEliteResp, error) {
|
||||
l := logic.NewGiveEliteLogic(ctx, s.svcCtx)
|
||||
return l.GiveElite(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) BuyElite(ctx context.Context, in *pb.EliteReq) (*pb.BuyEliteResp, error) {
|
||||
l := logic.NewBuyEliteLogic(ctx, s.svcCtx)
|
||||
return l.BuyElite(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) GiveTitle(ctx context.Context, in *pb.GiveTitleReq) (*pb.BuyTitleResp, error) {
|
||||
l := logic.NewGiveTitleLogic(ctx, s.svcCtx)
|
||||
return l.GiveTitle(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) BuyTitle(ctx context.Context, in *pb.TitleReq) (*pb.BuyTitleResp, error) {
|
||||
l := logic.NewBuyTitleLogic(ctx, s.svcCtx)
|
||||
return l.BuyTitle(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) ChangeElite(ctx context.Context, in *pb.EliteReq) (*pb.ChangeEliteResp, error) {
|
||||
l := logic.NewChangeEliteLogic(ctx, s.svcCtx)
|
||||
return l.ChangeElite(in)
|
||||
}
|
||||
|
||||
func (s *UserCenterServer) ChangeTitle(ctx context.Context, in *pb.TitleReq) (*pb.ChangeTitleResp, error) {
|
||||
l := logic.NewChangeTitleLogic(ctx, s.svcCtx)
|
||||
return l.ChangeTitle(in)
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package svc
|
||||
|
||||
import "dcg/app/user_center/internal/config"
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
}
|
@ -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=../../../game/pb/ --style=go_zero --go_out=../ --go-grpc_out=../ --zrpc_out=../
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
|
||||
"dcg/app/user_center/internal/config"
|
||||
"dcg/app/user_center/internal/server"
|
||||
"dcg/app/user_center/internal/svc"
|
||||
"dcg/app/user_center/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/user_center.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
ctx := svc.NewServiceContext(c)
|
||||
svr := server.NewUserCenterServer(ctx)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
pb.RegisterUserCenterServer(grpcServer, svr)
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
s.Start()
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"dcg/app/user_center/usercenter"
|
||||
"dcg/game/manager"
|
||||
pbCommon "dcg/game/pb/common"
|
||||
"dcg/game/svc"
|
||||
"dcg/pkg/grpcx"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"git.noahlan.cn/northlan/ngs/session"
|
||||
)
|
||||
|
||||
type UserCoinLogic struct {
|
||||
component.Base
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUserCoin(svcCtx *svc.ServiceContext) *UserCoinLogic {
|
||||
return &UserCoinLogic{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *UserCoinLogic) Init() {
|
||||
}
|
||||
|
||||
func (p *UserCoinLogic) Shutdown() {
|
||||
}
|
||||
|
||||
func (p *UserCoinLogic) CMD() string {
|
||||
return "user"
|
||||
}
|
||||
|
||||
func (p *UserCoinLogic) Prefix() string {
|
||||
return "coin"
|
||||
}
|
||||
|
||||
// Change 更新弹币
|
||||
func (p *UserCoinLogic) Change(s *session.Session, msg *pbCommon.ChangeUserCoinReq) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.ChangeCoin(p.svcCtx.Ctx, &usercenter.ChangeCoinReq{
|
||||
UserId: msg.UserId,
|
||||
BattleId: manager.GameManager.BattleIdBySession(s),
|
||||
Change: msg.Change,
|
||||
Reason: msg.Reason,
|
||||
})
|
||||
if err != nil {
|
||||
code, m, _ := grpcx.WrapGrpcErr(err)
|
||||
|
||||
return s.Response(&pbCommon.ChangeUserCoinResp{
|
||||
Code: code,
|
||||
Msg: m,
|
||||
UserId: msg.UserId,
|
||||
})
|
||||
}
|
||||
return s.Response(&pbCommon.ChangeUserCoinResp{
|
||||
Code: 200,
|
||||
Msg: "成功",
|
||||
UserId: msg.UserId,
|
||||
Change: msg.Change,
|
||||
})
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"dcg/app/user_center/pb"
|
||||
"dcg/app/user_center/usercenter"
|
||||
"dcg/game/manager"
|
||||
pbCommon "dcg/game/pb/common"
|
||||
"dcg/game/svc"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"git.noahlan.cn/northlan/ngs/session"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type UserLogic struct {
|
||||
component.Base
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUserIntegral(svcCtx *svc.ServiceContext) *UserLogic {
|
||||
return &UserLogic{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *UserLogic) Init() {
|
||||
}
|
||||
|
||||
func (p *UserLogic) Shutdown() {
|
||||
}
|
||||
|
||||
func (p *UserLogic) CMD() string {
|
||||
return "user"
|
||||
}
|
||||
|
||||
func (p *UserLogic) Prefix() string {
|
||||
return "integral"
|
||||
}
|
||||
|
||||
// Change 更新积分
|
||||
func (p *UserLogic) Change(s *session.Session, msg *pbCommon.ChangeUserIntegralReq) error {
|
||||
integral, err := p.svcCtx.UserCenterRpc.ChangeIntegral(p.svcCtx.Ctx, &usercenter.ChangeIntegralReq{
|
||||
UserId: msg.UserId,
|
||||
BattleId: manager.GameManager.BattleIdBySession(s),
|
||||
Change: msg.Change,
|
||||
IntegralType: pb.IntegralType_Battle,
|
||||
})
|
||||
if err != nil {
|
||||
cause := errors.Cause(err)
|
||||
gStatus, _ := status.FromError(cause)
|
||||
|
||||
return s.Response(&pbCommon.ChangeUserIntegralResp{
|
||||
Code: int32(gStatus.Code()),
|
||||
Msg: gStatus.Message(),
|
||||
})
|
||||
}
|
||||
return s.Response(&pbCommon.ChangeUserIntegralResp{
|
||||
Code: 200,
|
||||
Msg: "成功",
|
||||
UserId: msg.UserId,
|
||||
Change: msg.Change,
|
||||
Integral: integral.Integral,
|
||||
})
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package msg_transfer
|
||||
|
||||
import (
|
||||
"dcg/config"
|
||||
"dcg/game/manager"
|
||||
"dcg/game/pb"
|
||||
pbCommon "dcg/game/pb/common"
|
||||
pbMq "dcg/game/pb/mq"
|
||||
"dcg/game/svc"
|
||||
kfk "dcg/pkg/kafka"
|
||||
"git.noahlan.cn/northlan/ntools-go/kafka"
|
||||
"git.noahlan.cn/northlan/ntools-go/logger"
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
type CoinTransferHandler struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
msgHandle map[string]kafkaMsgHandlerFunc
|
||||
ConsumerGroup *kafka.ConsumerGroup
|
||||
}
|
||||
|
||||
func (h *CoinTransferHandler) Init(svcCtx *svc.ServiceContext) {
|
||||
h.svcCtx = svcCtx
|
||||
cfg := config.Config.Kafka.UserCoin
|
||||
h.msgHandle = make(map[string]kafkaMsgHandlerFunc)
|
||||
h.msgHandle[cfg.Topic] = h.handleTopic
|
||||
|
||||
var err error
|
||||
h.ConsumerGroup, err = kafka.NewConsumerGroup(&kafka.ConsumerGroupConfig{
|
||||
KafkaVersion: sarama.V3_1_0_0,
|
||||
OffsetsInitial: sarama.OffsetNewest,
|
||||
IsReturnErr: false,
|
||||
UnMarshaler: kfk.ProtobufMarshaler,
|
||||
}, cfg.Addr, []string{cfg.Topic}, cfg.ConsumerGroup)
|
||||
|
||||
if err != nil {
|
||||
logger.SLog.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *CoinTransferHandler) handleTopic(data []byte, _ string) {
|
||||
// msg proto
|
||||
var msgFromMq pbMq.MqUserCoinChanged
|
||||
err := proto.Unmarshal(data, &msgFromMq)
|
||||
if err != nil {
|
||||
logger.SLog.Error("unmarshal msg err", err)
|
||||
return
|
||||
}
|
||||
manager.GameManager.Broadcast(pb.PushCoinChanged, &pbCommon.UserCoinChangedMsg{
|
||||
User: &pbCommon.PbUser{
|
||||
UserId: msgFromMq.UserId,
|
||||
Username: msgFromMq.Username,
|
||||
Avatar: msgFromMq.Avatar,
|
||||
},
|
||||
Reason: msgFromMq.Reason,
|
||||
Change: msgFromMq.Change,
|
||||
Current: msgFromMq.Current,
|
||||
})
|
||||
}
|
||||
|
||||
func (CoinTransferHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (CoinTransferHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (h *CoinTransferHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
|
||||
for msg := range claim.Messages() {
|
||||
//logger.SLog.Infow("kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
|
||||
if hFunc, ok := h.msgHandle[msg.Topic]; ok {
|
||||
hFunc(msg.Value, string(msg.Key))
|
||||
}
|
||||
sess.MarkMessage(msg, "")
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,75 +1,76 @@
|
||||
package msg_transfer
|
||||
|
||||
import (
|
||||
"dcg/config"
|
||||
"dcg/game/manager"
|
||||
pbCommon "dcg/game/pb/common"
|
||||
pbMq "dcg/game/pb/mq"
|
||||
"dcg/game/svc"
|
||||
kfk "dcg/pkg/kafka"
|
||||
"git.noahlan.cn/northlan/ntools-go/kafka"
|
||||
"git.noahlan.cn/northlan/ntools-go/logger"
|
||||
"github.com/Shopify/sarama"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type RewardTransferHandler struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
msgHandle map[string]kafkaMsgHandlerFunc
|
||||
ConsumerGroup *kafka.ConsumerGroup
|
||||
}
|
||||
|
||||
func (h *RewardTransferHandler) Init(svcCtx *svc.ServiceContext) {
|
||||
h.svcCtx = svcCtx
|
||||
cfg := config.Config.Kafka.RewardPool
|
||||
h.msgHandle = make(map[string]kafkaMsgHandlerFunc)
|
||||
h.msgHandle[cfg.Topic] = h.handleTopic
|
||||
|
||||
var err error
|
||||
h.ConsumerGroup, err = kafka.NewConsumerGroup(&kafka.ConsumerGroupConfig{
|
||||
KafkaVersion: sarama.V3_1_0_0,
|
||||
OffsetsInitial: sarama.OffsetNewest,
|
||||
IsReturnErr: false,
|
||||
UnMarshaler: kfk.ProtobufMarshaler,
|
||||
}, cfg.Addr, []string{cfg.Topic}, cfg.ConsumerGroup)
|
||||
|
||||
if err != nil {
|
||||
logger.SLog.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *RewardTransferHandler) handleTopic(data []byte, _ string) {
|
||||
// msg proto
|
||||
var msgFromMq pbMq.MqRewardPool
|
||||
err := proto.Unmarshal(data, &msgFromMq)
|
||||
if err != nil {
|
||||
logger.SLog.Error("unmarshal msg err", err)
|
||||
return
|
||||
}
|
||||
room, err := manager.GameManager.RoomByBattleId(msgFromMq.BattleId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
room.Broadcast("game.rewardPool", &pbCommon.RewardPoolMsg{
|
||||
WelfarePool: msgFromMq.WelfarePool,
|
||||
BattleId: msgFromMq.BattleId,
|
||||
InitReward: msgFromMq.InitReward,
|
||||
GiftReward: msgFromMq.GiftReward,
|
||||
BattleReward: msgFromMq.BattleReward,
|
||||
OtherReward: msgFromMq.OtherReward,
|
||||
AllRewards: msgFromMq.AllRewards,
|
||||
})
|
||||
}
|
||||
|
||||
func (RewardTransferHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (RewardTransferHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
func (h *RewardTransferHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
|
||||
for msg := range claim.Messages() {
|
||||
//logger.SLog.Infow("kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
|
||||
if hFunc, ok := h.msgHandle[msg.Topic]; ok {
|
||||
hFunc(msg.Value, string(msg.Key))
|
||||
}
|
||||
sess.MarkMessage(msg, "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
//
|
||||
//import (
|
||||
// "dcg/config"
|
||||
// "dcg/game/manager"
|
||||
// pbCommon "dcg/game/pb/common"
|
||||
// pbMq "dcg/game/pb/mq"
|
||||
// "dcg/game/svc"
|
||||
// kfk "dcg/pkg/kafka"
|
||||
// "git.noahlan.cn/northlan/ntools-go/kafka"
|
||||
// "git.noahlan.cn/northlan/ntools-go/logger"
|
||||
// "github.com/Shopify/sarama"
|
||||
// "google.golang.org/protobuf/proto"
|
||||
//)
|
||||
//
|
||||
//type RewardTransferHandler struct {
|
||||
// svcCtx *svc.ServiceContext
|
||||
// msgHandle map[string]kafkaMsgHandlerFunc
|
||||
// ConsumerGroup *kafka.ConsumerGroup
|
||||
//}
|
||||
//
|
||||
//func (h *RewardTransferHandler) Init(svcCtx *svc.ServiceContext) {
|
||||
// h.svcCtx = svcCtx
|
||||
// cfg := config.Config.Kafka.RewardPool
|
||||
// h.msgHandle = make(map[string]kafkaMsgHandlerFunc)
|
||||
// h.msgHandle[cfg.Topic] = h.handleTopic
|
||||
//
|
||||
// var err error
|
||||
// h.ConsumerGroup, err = kafka.NewConsumerGroup(&kafka.ConsumerGroupConfig{
|
||||
// KafkaVersion: sarama.V3_1_0_0,
|
||||
// OffsetsInitial: sarama.OffsetNewest,
|
||||
// IsReturnErr: false,
|
||||
// UnMarshaler: kfk.ProtobufMarshaler,
|
||||
// }, cfg.Addr, []string{cfg.Topic}, cfg.ConsumerGroup)
|
||||
//
|
||||
// if err != nil {
|
||||
// logger.SLog.Error(err)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//func (h *RewardTransferHandler) handleTopic(data []byte, _ string) {
|
||||
// // msg proto
|
||||
// var msgFromMq pbMq.MqRewardPool
|
||||
// err := proto.Unmarshal(data, &msgFromMq)
|
||||
// if err != nil {
|
||||
// logger.SLog.Error("unmarshal msg err", err)
|
||||
// return
|
||||
// }
|
||||
// room, err := manager.GameManager.RoomByBattleId(msgFromMq.BattleId)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// room.Broadcast("game.rewardPool", &pbCommon.RewardPoolMsg{
|
||||
// WelfarePool: msgFromMq.WelfarePool,
|
||||
// BattleId: msgFromMq.BattleId,
|
||||
// InitReward: msgFromMq.InitReward,
|
||||
// GiftReward: msgFromMq.GiftReward,
|
||||
// BattleReward: msgFromMq.BattleReward,
|
||||
// OtherReward: msgFromMq.OtherReward,
|
||||
// AllRewards: msgFromMq.AllRewards,
|
||||
// })
|
||||
//}
|
||||
//
|
||||
//func (RewardTransferHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
//func (RewardTransferHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
|
||||
//func (h *RewardTransferHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
|
||||
// for msg := range claim.Messages() {
|
||||
// //logger.SLog.Infow("kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
|
||||
// if hFunc, ok := h.msgHandle[msg.Topic]; ok {
|
||||
// hFunc(msg.Value, string(msg.Key))
|
||||
// }
|
||||
// sess.MarkMessage(msg, "")
|
||||
// }
|
||||
// return nil
|
||||
//}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
|
@ -1 +0,0 @@
|
||||
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
|
@ -1 +0,0 @@
|
||||
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
|
@ -1,5 +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=. ^
|
||||
./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto
|
||||
--go_out=. --go-grpc_out=. --proto_path=. ^
|
||||
./vars/*.proto ./mq/*.proto ./common/*.proto ./room/*.proto ./game/zhg/*.proto ./game/zhghz/*.proto ./game/zhgzd/*.proto
|
@ -0,0 +1,7 @@
|
||||
protoc --csharp_out=./common --proto_path=. --proto_path=./common --proto_path=./vars ./common/*.proto
|
||||
protoc --csharp_out=./vars --proto_path=. --proto_path=./common --proto_path=./vars ./vars/*.proto
|
||||
protoc --csharp_out=./room --proto_path=. --proto_path=./room --proto_path=./vars ./room/*.proto
|
||||
::games
|
||||
protoc --csharp_out=./game/zhg --proto_path=. --proto_path=./vars --proto_path=./game/zhg ./game/zhg/*.proto
|
||||
protoc --csharp_out=./game/zhghz --proto_path=. --proto_path=./vars --proto_path=./game/zhghz ./game/zhghz/*.proto
|
||||
protoc --csharp_out=./game/zhgzd --proto_path=. --proto_path=./vars --proto_path=./game/zhgzd ./game/zhgzd/*.proto
|
@ -1 +0,0 @@
|
||||
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
|
@ -0,0 +1,41 @@
|
||||
package pb
|
||||
|
||||
// common通用消息路由
|
||||
|
||||
const (
|
||||
PushCoinChanged = "user.coin.change"
|
||||
PushCheckIn = "user.checkIn"
|
||||
PushDrawGiftPack = "user.giftPack"
|
||||
PushBuyGoods = "user.buy"
|
||||
PushUserQuery = "user.query"
|
||||
PushDanmaku = "live.danmaku"
|
||||
PushGift = "live.gift.common"
|
||||
PushGiftNobility = "live.gift.nobility"
|
||||
)
|
||||
|
||||
// zhg
|
||||
|
||||
const (
|
||||
PushZhgJoinGame = "game.join"
|
||||
PushZhgCreateUnit = "game.createUnit"
|
||||
PushZhgMove = "game.move"
|
||||
PushZhgOutbreak = "game.outbreak"
|
||||
PushZhgOutbreakFood = "game.outbreak.food"
|
||||
PushZhgWhere = "game.wai"
|
||||
PushZhgMode = "game.mode"
|
||||
PushZhgChangeElite = "game.change.elite"
|
||||
PushZhgChangeTitle = "game.change.title"
|
||||
PushZhgBuyFood = "game.buy.food"
|
||||
)
|
||||
|
||||
// zhgzd
|
||||
const (
|
||||
PushZhgzdJoinGame = "game.join"
|
||||
PushZhgzdChangeUnit = "game.unit.change"
|
||||
PushZhgzdMove = "game.line"
|
||||
PushZhgzdPosition = "game.pos"
|
||||
PushZhgzdOutbreak = "game.outbreak"
|
||||
PushZhgzdDispatch = "game.unit.dispatch"
|
||||
PushZhgzdWhere = "game.where"
|
||||
PushZhgzdMode = "game.mode"
|
||||
)
|
@ -0,0 +1,160 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: vars/vars.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
using pbc = global::Google.Protobuf.Collections;
|
||||
using pbr = global::Google.Protobuf.Reflection;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace Pb.Vars {
|
||||
|
||||
/// <summary>Holder for reflection information generated from vars/vars.proto</summary>
|
||||
public static partial class VarsReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for vars/vars.proto</summary>
|
||||
public static pbr::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbr::FileDescriptor descriptor;
|
||||
|
||||
static VarsReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"Cg92YXJzL3ZhcnMucHJvdG8SB3BiLnZhcnMqyAEKFVVzZXJDb2luQ2hhbmdl",
|
||||
"ZFJlYXNvbhIHCgNQYXkQABIRCg1CdXlCYXR0bGVGb29kEAESEAoMQnV5RWxp",
|
||||
"dGVVbml0EAISDAoIQnV5VGl0bGUQAxIMCghTZW5kR2lmdBAEEg8KC0J1eU5v",
|
||||
"YmlsaXR5EAUSEAoMRHJhd0dpZnRQYWNrEAoSCwoHQ2hlY2tJbhALEhMKD0V2",
|
||||
"ZW50UmFua1N1Ym1pdBAUEhIKDkV2ZW50QmF0dGxlRW5kEBUSDAoIVHJhbnNm",
|
||||
"ZXIQHiodCgVHb29kcxIJCgVUaXRsZRAAEgkKBUVsaXRlEAEqwgEKCFJhbmtU",
|
||||
"eXBlEgsKB1Vua25vd24QABIKCgZEYW1hZ2UQARIMCghEZURhbWFnZRACEgsK",
|
||||
"B0dlbmVyYWwQAxINCglEZUdlbmVyYWwQBBIMCghLaWxsVW5pdBAFEg4KCkRl",
|
||||
"S2lsbFVuaXQQBhIOCgpLaWxsUGxheWVyEAcSEAoMRGVLaWxsUGxheWVyEAgS",
|
||||
"BwoDV2luEAkSCAoETG9zdBAKEg4KCkZpcnN0Qmxvb2QQCxIQCgxEZUZpcnN0",
|
||||
"Qmxvb2QQDEIZWhdkY2cvZ2FtZS9wYi92YXJzO3BiVmFyc2IGcHJvdG8z"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pb.Vars.UserCoinChangedReason), typeof(global::Pb.Vars.Goods), typeof(global::Pb.Vars.RankType), }, null, null));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Enums
|
||||
public enum UserCoinChangedReason {
|
||||
/// <summary>
|
||||
////// 消费
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Pay")] Pay = 0,
|
||||
/// <summary>
|
||||
/// 购买粮草
|
||||
/// </summary>
|
||||
[pbr::OriginalName("BuyBattleFood")] BuyBattleFood = 1,
|
||||
/// <summary>
|
||||
/// 购买精英单位
|
||||
/// </summary>
|
||||
[pbr::OriginalName("BuyEliteUnit")] BuyEliteUnit = 2,
|
||||
/// <summary>
|
||||
/// 购买称号
|
||||
/// </summary>
|
||||
[pbr::OriginalName("BuyTitle")] BuyTitle = 3,
|
||||
/// <summary>
|
||||
////// 礼物
|
||||
/// </summary>
|
||||
[pbr::OriginalName("SendGift")] SendGift = 4,
|
||||
/// <summary>
|
||||
/// 购买贵族
|
||||
/// </summary>
|
||||
[pbr::OriginalName("BuyNobility")] BuyNobility = 5,
|
||||
/// <summary>
|
||||
////// 领取
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DrawGiftPack")] DrawGiftPack = 10,
|
||||
/// <summary>
|
||||
/// 签到打卡
|
||||
/// </summary>
|
||||
[pbr::OriginalName("CheckIn")] CheckIn = 11,
|
||||
/// <summary>
|
||||
////// 游戏事件
|
||||
/// </summary>
|
||||
[pbr::OriginalName("EventRankSubmit")] EventRankSubmit = 20,
|
||||
/// <summary>
|
||||
/// 战局结束奖励
|
||||
/// </summary>
|
||||
[pbr::OriginalName("EventBattleEnd")] EventBattleEnd = 21,
|
||||
/// <summary>
|
||||
////// 其它事件
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Transfer")] Transfer = 30,
|
||||
}
|
||||
|
||||
public enum Goods {
|
||||
/// <summary>
|
||||
/// 称号
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Title")] Title = 0,
|
||||
/// <summary>
|
||||
/// 精英单位
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Elite")] Elite = 1,
|
||||
}
|
||||
|
||||
public enum RankType {
|
||||
[pbr::OriginalName("Unknown")] Unknown = 0,
|
||||
/// <summary>
|
||||
/// 伤害榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Damage")] Damage = 1,
|
||||
/// <summary>
|
||||
/// 受伤榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DeDamage")] DeDamage = 2,
|
||||
/// <summary>
|
||||
/// 名将榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("General")] General = 3,
|
||||
/// <summary>
|
||||
/// 落马榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DeGeneral")] DeGeneral = 4,
|
||||
/// <summary>
|
||||
/// 小兵击杀
|
||||
/// </summary>
|
||||
[pbr::OriginalName("KillUnit")] KillUnit = 5,
|
||||
/// <summary>
|
||||
/// 小兵被杀
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DeKillUnit")] DeKillUnit = 6,
|
||||
/// <summary>
|
||||
/// 击杀玩家
|
||||
/// </summary>
|
||||
[pbr::OriginalName("KillPlayer")] KillPlayer = 7,
|
||||
/// <summary>
|
||||
/// 被杀榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DeKillPlayer")] DeKillPlayer = 8,
|
||||
/// <summary>
|
||||
/// 获胜榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Win")] Win = 9,
|
||||
/// <summary>
|
||||
/// 战败榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("Lost")] Lost = 10,
|
||||
/// <summary>
|
||||
/// 一血榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("FirstBlood")] FirstBlood = 11,
|
||||
/// <summary>
|
||||
/// 被拿一血榜
|
||||
/// </summary>
|
||||
[pbr::OriginalName("DeFirstBlood")] DeFirstBlood = 12,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion Designer generated code
|
@ -0,0 +1,311 @@
|
||||
// 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, 0x19, 0x5a, 0x17, 0x64, 0x63, 0x67,
|
||||
0x2f, 0x67, 0x61, 0x6d, 0x65, 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 = "dcg/game/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; // 被拿一血榜
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package grpcx
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func WrapGrpcErr(e error) (code int32, msg string, err error) {
|
||||
err = e
|
||||
cause := errors.Cause(err)
|
||||
gStatus, ok := status.FromError(cause)
|
||||
if ok {
|
||||
code = int32(gStatus.Code())
|
||||
msg = gStatus.Message()
|
||||
} else {
|
||||
code = 500
|
||||
msg = cause.Error()
|
||||
}
|
||||
return
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package radar
|
||||
|
||||
// Engine 简易风控引擎
|
||||
type Engine struct {
|
||||
opt1 byte
|
||||
opt2 byte
|
||||
ratio int32
|
||||
danmakuChan chan struct{}
|
||||
userId int64
|
||||
username string
|
||||
}
|
||||
|
||||
type Option struct {
|
||||
IntervalCheck bool // 间隔检测开关
|
||||
Repeat bool // 重复性检测开关
|
||||
Violence bool // 暴力检测开关
|
||||
RuleStudy bool // 规则AI学习开关
|
||||
}
|
Loading…
Reference in New Issue