diff --git a/bin/json/game_msgdistrib.json b/bin/json/game_msgdistrib.json index 0f2f94dcc..4a6e42358 100644 --- a/bin/json/game_msgdistrib.json +++ b/bin/json/game_msgdistrib.json @@ -148,5 +148,11 @@ "open": true, "routrules": "~/worker", "describe": "猜颜色" + }, + { + "msgid": "gameinvite", + "open": true, + "routrules": "~/worker", + "describe": "邀请系统" } ] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index c3ca875c9..6142158f6 100644 --- a/comm/const.go +++ b/comm/const.go @@ -399,6 +399,9 @@ const ( //游戏邀请 TableGameInvite = "gameinvite" + + //推送礼包 + TablekTreasuremap = "treasuremap" ) // RPC服务接口定义处 diff --git a/modules/dcolor/module.go b/modules/dcolor/module.go index c79bf6e2f..55554741a 100644 --- a/modules/dcolor/module.go +++ b/modules/dcolor/module.go @@ -27,6 +27,7 @@ type DColor struct { model *modelComp modelQiecuo *modelQiecuoComp rooms *roomsComp + gameInvite comm.IGameInvite } // 模块名 @@ -40,6 +41,19 @@ func (this *DColor) Init(service core.IService, module core.IModule, options cor this.service = service.(comm.IService) return } + +func (this *DColor) Start() (err error) { + if err = this.ModuleBase.Start(); err != nil { + return + } + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleGameInvite); err != nil { + return + } + this.gameInvite = module.(comm.IGameInvite) + return +} + func (this *DColor) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) @@ -51,9 +65,10 @@ func (this *DColor) OnInstallComp() { func (this *DColor) CreateRoom(sessions []comm.IUserSession, rulesStr string) (roomid string, err error) { var ( - rules *GameRules + rules *GameRules = &GameRules{} red *pb.DBUser blue *pb.DBUser + room *Room ) if err = json.Unmarshal([]byte(rulesStr), rules); err != nil { @@ -73,7 +88,7 @@ func (this *DColor) CreateRoom(sessions []comm.IUserSession, rulesStr string) (r return } roomid = primitive.NewObjectID().Hex() - if _, err = this.rooms.newRoom(&pb.DBDColorRoom{ + if room, err = this.rooms.newRoom(&pb.DBDColorRoom{ Rid: roomid, Difficulty: rules.Difficulty, Repeat: rules.Repeat, @@ -89,5 +104,6 @@ func (this *DColor) CreateRoom(sessions []comm.IUserSession, rulesStr string) (r this.Error("创建房间错误", log.Field{Key: "err", Value: err.Error()}) return } + go room.GameStart() return } diff --git a/modules/dcolor/rooms.go b/modules/dcolor/rooms.go index c935a13e0..0bf56688a 100644 --- a/modules/dcolor/rooms.go +++ b/modules/dcolor/rooms.go @@ -46,11 +46,20 @@ func (this *roomsComp) newRoom(data *pb.DBDColorRoom, session []comm.IUserSessio this.lock.Lock() this.rooms[data.Rid] = room this.lock.Unlock() + return } func (this *roomsComp) removeRoom(rid string) { + var ( + ok bool + room *Room + ) this.lock.Lock() + room, ok = this.rooms[rid] delete(this.rooms, rid) this.lock.Unlock() + if ok { + go this.module.gameInvite.GameInviteEnd(3, room.data.Red.Info.Uid) + } } diff --git a/modules/gameinvite/api_qiecuo.go b/modules/gameinvite/api_qiecuo.go index 09fd1fa8c..03729bcb1 100644 --- a/modules/gameinvite/api_qiecuo.go +++ b/modules/gameinvite/api_qiecuo.go @@ -99,13 +99,13 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.GameInviteQiecuoR }) } this.module.model.Change(session.GetUserId(), map[string]interface{}{ - "targets": info.Invite, + "invite": info.Invite, }) session.SendMsg(string(this.module.GetType()), "qiecuo", &pb.DColorQiecuoResp{Fid: req.Fid}) this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify", - &pb.GameInviteQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 1, Rules: req.Rules}, req.Fid) + &pb.GameInviteQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 1, Gtype: req.Gtype, Rules: req.Rules}, req.Fid) return } diff --git a/modules/gameinvite/api_refuse.go b/modules/gameinvite/api_refuse.go index 5d3f746c3..565f5e8b4 100644 --- a/modules/gameinvite/api_refuse.go +++ b/modules/gameinvite/api_refuse.go @@ -65,6 +65,6 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.GameInviteRefuseR }) this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify", - &pb.GameInviteQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 3}, req.Uid) + &pb.GameInviteQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 3, Gtype: req.Gtype}, req.Uid) return } diff --git a/modules/gameinvite/module.go b/modules/gameinvite/module.go index 645d85a37..70e633d39 100644 --- a/modules/gameinvite/module.go +++ b/modules/gameinvite/module.go @@ -30,6 +30,22 @@ func (this *GameInvite) Init(service core.IService, module core.IModule, options return } +func (this *GameInvite) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + this.model = this.RegisterComp(new(modelComp)).(*modelComp) +} +func (this *GameInvite) Start() (err error) { + if err = this.ModuleBase.Start(); err != nil { + return + } + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleDcolor); err != nil { + return + } + this.dcolor = module.(comm.IDColor) + return +} func (this *GameInvite) GameInviteEnd(gtype int32, uid string) { this.model.endQiecuo(gtype, uid) } diff --git a/modules/matchpool/module.go b/modules/matchpool/module.go index 9534a3681..a6cf9b1ad 100644 --- a/modules/matchpool/module.go +++ b/modules/matchpool/module.go @@ -39,6 +39,7 @@ func (this *MatchPool) Init(service core.IService, module core.IModule, options return } this.service = service.(comm.IService) + this.options = options.(*Options) return } diff --git a/modules/treasuremap/api_award.go b/modules/treasuremap/api_award.go index 5f61cbc21..46e5b8506 100644 --- a/modules/treasuremap/api_award.go +++ b/modules/treasuremap/api_award.go @@ -36,7 +36,7 @@ func (this *apiComp) Award(session comm.IUserSession, req *pb.TreasuremapAwardRe errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), - Message: fmt.Sprintf("Treasuremap Claimed!", req.Id), + Message: fmt.Sprintf("Treasuremap Claimed! id:%d", req.Id), } } @@ -45,6 +45,6 @@ func (this *apiComp) Award(session comm.IUserSession, req *pb.TreasuremapAwardRe this.module.model.Change(session.GetUserId(), map[string]interface{}{ "treasuremap": info.Treasuremap, }) - session.SendMsg(string(this.module.GetType()), "award", &pb.TreasuremapAwardResp{}) + session.SendMsg(string(this.module.GetType()), "award", &pb.TreasuremapAwardResp{Id: req.Id}) return } diff --git a/modules/treasuremap/model.go b/modules/treasuremap/model.go index a8a4bbac7..c40566394 100644 --- a/modules/treasuremap/model.go +++ b/modules/treasuremap/model.go @@ -19,7 +19,7 @@ type modelComp struct { func (this *modelComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompModel.Init(service, module, comp, options) - this.TableName = comm.TablekfPushGiftbag + this.TableName = comm.TablekTreasuremap this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) diff --git a/modules/whackamole/api.go b/modules/whackamole/api.go new file mode 100644 index 000000000..70908568e --- /dev/null +++ b/modules/whackamole/api.go @@ -0,0 +1,17 @@ +package whackamole + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + module *Whackamole +} + +func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + _ = this.MCompGate.Init(service, module, comp, options) + this.module = module.(*Whackamole) + return +} diff --git a/modules/whackamole/api_award.go b/modules/whackamole/api_award.go new file mode 100644 index 000000000..0c22f64f0 --- /dev/null +++ b/modules/whackamole/api_award.go @@ -0,0 +1,23 @@ +package whackamole + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +// 参数校验 +func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.TreasuremapAwardReq) (errdata *pb.ErrorData) { + + return +} + +// /获取系统公告 +func (this *apiComp) Award(session comm.IUserSession, req *pb.TreasuremapAwardReq) (errdata *pb.ErrorData) { + var () + if errdata = this.AwardCheck(session, req); errdata != nil { + return + } + + session.SendMsg(string(this.module.GetType()), "award", &pb.TreasuremapAwardResp{Id: req.Id}) + return +} diff --git a/modules/whackamole/configure.go b/modules/whackamole/configure.go new file mode 100644 index 000000000..147c4f0f3 --- /dev/null +++ b/modules/whackamole/configure.go @@ -0,0 +1,45 @@ +package whackamole + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" + "sync" +) + +const ( + game_gcolorgetfraction = "game_gcolorgetfraction.json" + game_gcolorreward = "game_gcolorreward.json" + game_gcolorttmedecay = "game_gcolorttmedecay.json" +) + +type configureComp struct { + modules.MCompConfigure + module *Whackamole + lock sync.RWMutex +} + +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompConfigure.Init(service, module, comp, options) + this.module = module.(*Whackamole) + + return +} + +// 获取奖励列表 +func (this *configureComp) getGameGColorRewardData(id int32) (conf *cfg.GameGColorRewardData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(game_gcolorreward); err != nil { + return + } + if conf, ok = v.(*cfg.GameGColorReward).GetDataMap()[id]; !ok { + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_gcolorreward, id) + this.module.Errorln(err) + return + } + return +} diff --git a/modules/whackamole/module.go b/modules/whackamole/module.go new file mode 100644 index 000000000..59d6d5881 --- /dev/null +++ b/modules/whackamole/module.go @@ -0,0 +1,40 @@ +package whackamole + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +func NewModule() core.IModule { + m := new(Whackamole) + return m +} + +/* +模块名称:打地鼠 +*/ +type Whackamole struct { + modules.ModuleBase + service comm.IService + api *apiComp + configure *configureComp +} + +// 模块名 +func (this *Whackamole) GetType() core.M_Modules { + return comm.ModuleTreasureMap +} + +// 模块初始化接口 注册用户创建角色事件 +func (this *Whackamole) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + this.service = service.(comm.IService) + return +} + +func (this *Whackamole) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) +} diff --git a/pb/gameinvite_db.pb.go b/pb/gameinvite_db.pb.go index c75fca560..3d38030c0 100644 --- a/pb/gameinvite_db.pb.go +++ b/pb/gameinvite_db.pb.go @@ -147,7 +147,7 @@ type GameInviteQiecuoRecord struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //id Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //发起人id Status int32 `protobuf:"varint,3,opt,name=status,proto3" json:"status"` //0邀请中 1战斗中 - Gtype int32 `protobuf:"varint,4,opt,name=gtype,proto3" json:"gtype"` //当前游戏类型 + Gtype int32 `protobuf:"varint,4,opt,name=gtype,proto3" json:"gtype"` //当前游戏类型 0 武馆切磋 3 猜颜色 Battid string `protobuf:"bytes,5,opt,name=battid,proto3" json:"battid"` //战斗id Invite map[int32]*GameInviteData `protobuf:"bytes,6,rep,name=Invite,proto3" json:"Invite" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //邀请数据 } diff --git a/pb/gameinvite_msg.pb.go b/pb/gameinvite_msg.pb.go index 1c2b6f014..bfcf3eefe 100644 --- a/pb/gameinvite_msg.pb.go +++ b/pb/gameinvite_msg.pb.go @@ -353,7 +353,8 @@ type GameInviteQiecuonotifyPush struct { User *BaseUserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user"` //发起者信息 NotifyType int32 `protobuf:"varint,2,opt,name=notifyType,proto3" json:"notifyType"` //1发起通知 2接受通知 3拒绝通知 - Rules string `protobuf:"bytes,3,opt,name=rules,proto3" json:"rules"` //游戏规则 + Gtype int32 `protobuf:"varint,3,opt,name=gtype,proto3" json:"gtype"` //游戏类型 + Rules string `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` //游戏规则 } func (x *GameInviteQiecuonotifyPush) Reset() { @@ -402,6 +403,13 @@ func (x *GameInviteQiecuonotifyPush) GetNotifyType() int32 { return 0 } +func (x *GameInviteQiecuonotifyPush) GetGtype() int32 { + if x != nil { + return x.Gtype + } + return 0 +} + func (x *GameInviteQiecuonotifyPush) GetRules() string { if x != nil { return x.Rules @@ -438,15 +446,17 @@ var file_gameinvite_gameinvite_msg_proto_rawDesc = []byte{ 0x05, 0x67, 0x74, 0x79, 0x70, 0x65, 0x22, 0x2e, 0x0a, 0x14, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x75, 0x0a, 0x1a, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x6e, - 0x76, 0x69, 0x74, 0x65, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, - 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, 0x74, - 0x69, 0x66, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x8b, 0x01, 0x0a, 0x1a, 0x47, 0x61, 0x6d, 0x65, 0x49, + 0x6e, 0x76, 0x69, 0x74, 0x65, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, + 0x66, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, + 0x74, 0x69, 0x66, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, + 0x75, 0x6c, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/treasuremap_msg.pb.go b/pb/treasuremap_msg.pb.go index 77bb82237..55a2b0c6f 100644 --- a/pb/treasuremap_msg.pb.go +++ b/pb/treasuremap_msg.pb.go @@ -24,8 +24,6 @@ type TreasuremapInfoReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` } func (x *TreasuremapInfoReq) Reset() { @@ -60,13 +58,6 @@ func (*TreasuremapInfoReq) Descriptor() ([]byte, []int) { return file_treasuremap_treasuremap_msg_proto_rawDescGZIP(), []int{0} } -func (x *TreasuremapInfoReq) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - type TreasuremapInfoResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -165,6 +156,8 @@ type TreasuremapAwardResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` // repeated UserAtno award = 3; //获取资源 } func (x *TreasuremapAwardResp) Reset() { @@ -199,6 +192,13 @@ func (*TreasuremapAwardResp) Descriptor() ([]byte, []int) { return file_treasuremap_treasuremap_msg_proto_rawDescGZIP(), []int{3} } +func (x *TreasuremapAwardResp) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + var File_treasuremap_treasuremap_msg_proto protoreflect.FileDescriptor var file_treasuremap_treasuremap_msg_proto_rawDesc = []byte{ @@ -206,17 +206,17 @@ var file_treasuremap_treasuremap_msg_proto_rawDesc = []byte{ 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x2f, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x5f, 0x64, 0x62, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, - 0x65, 0x6d, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x39, 0x0a, 0x13, 0x54, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, + 0x65, 0x6d, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x22, 0x39, 0x0a, 0x13, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x25, 0x0a, 0x13, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x16, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x26, 0x0a, 0x14, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x61, 0x70, 0x41, 0x77, 0x61, 0x72, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } diff --git a/pb/whackamole_db.pb.go b/pb/whackamole_db.pb.go new file mode 100644 index 000000000..15089cbfb --- /dev/null +++ b/pb/whackamole_db.pb.go @@ -0,0 +1,61 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: whackamole/whackamole_db.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_whackamole_whackamole_db_proto protoreflect.FileDescriptor + +var file_whackamole_whackamole_db_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x77, 0x68, 0x61, 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, 0x65, 0x2f, 0x77, 0x68, 0x61, + 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_whackamole_whackamole_db_proto_goTypes = []interface{}{} +var file_whackamole_whackamole_db_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_whackamole_whackamole_db_proto_init() } +func file_whackamole_whackamole_db_proto_init() { + if File_whackamole_whackamole_db_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_whackamole_whackamole_db_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_whackamole_whackamole_db_proto_goTypes, + DependencyIndexes: file_whackamole_whackamole_db_proto_depIdxs, + }.Build() + File_whackamole_whackamole_db_proto = out.File + file_whackamole_whackamole_db_proto_rawDesc = nil + file_whackamole_whackamole_db_proto_goTypes = nil + file_whackamole_whackamole_db_proto_depIdxs = nil +} diff --git a/pb/whackamole_msg.pb.go b/pb/whackamole_msg.pb.go new file mode 100644 index 000000000..09998549a --- /dev/null +++ b/pb/whackamole_msg.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: whackamole/whackamole_msg.proto + +package pb + +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 WhackamoleAwardReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` +} + +func (x *WhackamoleAwardReq) Reset() { + *x = WhackamoleAwardReq{} + if protoimpl.UnsafeEnabled { + mi := &file_whackamole_whackamole_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WhackamoleAwardReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WhackamoleAwardReq) ProtoMessage() {} + +func (x *WhackamoleAwardReq) ProtoReflect() protoreflect.Message { + mi := &file_whackamole_whackamole_msg_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 WhackamoleAwardReq.ProtoReflect.Descriptor instead. +func (*WhackamoleAwardReq) Descriptor() ([]byte, []int) { + return file_whackamole_whackamole_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *WhackamoleAwardReq) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type WhackamoleAwardResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + Award []*UserAtno `protobuf:"bytes,3,rep,name=award,proto3" json:"award"` //获取资源 +} + +func (x *WhackamoleAwardResp) Reset() { + *x = WhackamoleAwardResp{} + if protoimpl.UnsafeEnabled { + mi := &file_whackamole_whackamole_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WhackamoleAwardResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WhackamoleAwardResp) ProtoMessage() {} + +func (x *WhackamoleAwardResp) ProtoReflect() protoreflect.Message { + mi := &file_whackamole_whackamole_msg_proto_msgTypes[1] + 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 WhackamoleAwardResp.ProtoReflect.Descriptor instead. +func (*WhackamoleAwardResp) Descriptor() ([]byte, []int) { + return file_whackamole_whackamole_msg_proto_rawDescGZIP(), []int{1} +} + +func (x *WhackamoleAwardResp) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *WhackamoleAwardResp) GetAward() []*UserAtno { + if x != nil { + return x.Award + } + return nil +} + +var File_whackamole_whackamole_msg_proto protoreflect.FileDescriptor + +var file_whackamole_whackamole_msg_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x77, 0x68, 0x61, 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, 0x65, 0x2f, 0x77, 0x68, 0x61, + 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, + 0x12, 0x57, 0x68, 0x61, 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, + 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x46, 0x0a, 0x13, 0x57, 0x68, 0x61, 0x63, 0x6b, 0x61, 0x6d, 0x6f, 0x6c, + 0x65, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, + 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_whackamole_whackamole_msg_proto_rawDescOnce sync.Once + file_whackamole_whackamole_msg_proto_rawDescData = file_whackamole_whackamole_msg_proto_rawDesc +) + +func file_whackamole_whackamole_msg_proto_rawDescGZIP() []byte { + file_whackamole_whackamole_msg_proto_rawDescOnce.Do(func() { + file_whackamole_whackamole_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_whackamole_whackamole_msg_proto_rawDescData) + }) + return file_whackamole_whackamole_msg_proto_rawDescData +} + +var file_whackamole_whackamole_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_whackamole_whackamole_msg_proto_goTypes = []interface{}{ + (*WhackamoleAwardReq)(nil), // 0: WhackamoleAwardReq + (*WhackamoleAwardResp)(nil), // 1: WhackamoleAwardResp + (*UserAtno)(nil), // 2: UserAtno +} +var file_whackamole_whackamole_msg_proto_depIdxs = []int32{ + 2, // 0: WhackamoleAwardResp.award:type_name -> UserAtno + 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_whackamole_whackamole_msg_proto_init() } +func file_whackamole_whackamole_msg_proto_init() { + if File_whackamole_whackamole_msg_proto != nil { + return + } + file_comm_proto_init() + if !protoimpl.UnsafeEnabled { + file_whackamole_whackamole_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WhackamoleAwardReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_whackamole_whackamole_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WhackamoleAwardResp); 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_whackamole_whackamole_msg_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_whackamole_whackamole_msg_proto_goTypes, + DependencyIndexes: file_whackamole_whackamole_msg_proto_depIdxs, + MessageInfos: file_whackamole_whackamole_msg_proto_msgTypes, + }.Build() + File_whackamole_whackamole_msg_proto = out.File + file_whackamole_whackamole_msg_proto_rawDesc = nil + file_whackamole_whackamole_msg_proto_goTypes = nil + file_whackamole_whackamole_msg_proto_depIdxs = nil +} diff --git a/services/worker/main.go b/services/worker/main.go index 9e8a60959..e5a465c79 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -25,6 +25,7 @@ import ( "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/forum" "go_dreamfactory/modules/friend" + "go_dreamfactory/modules/gameinvite" "go_dreamfactory/modules/gm" "go_dreamfactory/modules/gourmet" "go_dreamfactory/modules/growtask" @@ -176,6 +177,7 @@ func main() { dcolor.NewModule(), maincity.NewModule(), treasuremap.NewModule(), + gameinvite.NewModule(), ) }