助战推送
This commit is contained in:
parent
60a36c51b7
commit
56b809406c
@ -171,6 +171,8 @@ const ( //Rpc
|
||||
Rpc_ModuleMoonfantasyTrigger core.Rpc_Key = "Rpc_ModuleMoonfantasyTrigger" //月之秘境触发消息
|
||||
//rtask 上传随机任务代码
|
||||
Rpc_ModuleRtaskSendTask core.Rpc_Key = "Rpc_ModuleRtaskSendTask" //随机任务触发
|
||||
// friend
|
||||
Rpc_ModuleFriendUseAssitHero core.Rpc_Key = "Rpc_ModuleFriendUseAssitHero" //使用助战英雄
|
||||
)
|
||||
|
||||
//事件类型定义处
|
||||
|
@ -24,7 +24,6 @@ const (
|
||||
FriendSubTypeDel = "del"
|
||||
FriendSubTypeAssistlist = "assistlist"
|
||||
FriendSubTypeGetreward = "getreward"
|
||||
FriendSubTypeAssistHeroList = "assistherolist"
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
|
@ -1,34 +0,0 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// 助战英雄列表
|
||||
|
||||
func (this *apiComp) AssistherolistCheck(session comm.IUserSession, req *pb.FriendAssistHeroListReq) (code pb.ErrorCode) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Assistherolist(session comm.IUserSession, req *pb.FriendAssistHeroListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
resp := &pb.FriendAssistHeroListResp{}
|
||||
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
||||
|
||||
for _, fId := range self.FriendIds {
|
||||
d := this.moduleFriend.modelFriend.GetFriend(fId)
|
||||
resp.Friends = append(resp.Friends, &pb.FriendBase{
|
||||
HeroObjId: d.AssistHeroId,
|
||||
})
|
||||
}
|
||||
|
||||
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAssistHeroList, resp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
|
||||
return
|
||||
}
|
@ -65,6 +65,19 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
||||
return
|
||||
}
|
||||
|
||||
//推送
|
||||
push := &pb.FriendAssistHeroListPush{}
|
||||
for _, fId := range self.FriendIds {
|
||||
d := this.moduleFriend.modelFriend.GetFriend(fId)
|
||||
push.Friends = append(push.Friends, &pb.FriendBase{
|
||||
HeroObjId: d.AssistHeroId,
|
||||
})
|
||||
}
|
||||
if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "AssistHeroList",
|
||||
&pb.FriendAssistHeroListPush{}, self.FriendIds...); err != nil {
|
||||
this.moduleFriend.Errorf("push AssistHeroList err:", err)
|
||||
}
|
||||
|
||||
// 随机任务Rtype13
|
||||
this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
"time"
|
||||
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
|
||||
@ -24,6 +25,7 @@ type Friend struct {
|
||||
api *apiComp
|
||||
modelFriend *ModelFriend
|
||||
configure *modules.MCompConfigure
|
||||
service base.IRPCXService
|
||||
}
|
||||
|
||||
func (this *Friend) GetType() core.M_Modules {
|
||||
@ -32,6 +34,7 @@ func (this *Friend) GetType() core.M_Modules {
|
||||
|
||||
func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
return
|
||||
}
|
||||
|
||||
@ -41,6 +44,12 @@ func (this *Friend) OnInstallComp() {
|
||||
this.modelFriend = this.RegisterComp(new(ModelFriend)).(*ModelFriend)
|
||||
}
|
||||
|
||||
func (this *Friend) Start() (err error) {
|
||||
err = this.ModuleBase.Start()
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendUseAssitHero), this.UseAssistHero)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Friend) ResetFriend(uid string) {
|
||||
// 重置点赞列表
|
||||
zanUpdate := map[string]interface{}{
|
||||
|
@ -1866,15 +1866,17 @@ func (x *FriendGetrewardResp) GetReceived() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 助战英雄列表
|
||||
type FriendAssistHeroListReq struct {
|
||||
// 助战英雄列表推送
|
||||
type FriendAssistHeroListPush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Friends []*FriendBase `protobuf:"bytes,1,rep,name=friends,proto3" json:"friends"` //好友列表
|
||||
}
|
||||
|
||||
func (x *FriendAssistHeroListReq) Reset() {
|
||||
*x = FriendAssistHeroListReq{}
|
||||
func (x *FriendAssistHeroListPush) Reset() {
|
||||
*x = FriendAssistHeroListPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_friend_friend_msg_proto_msgTypes[37]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -1882,13 +1884,13 @@ func (x *FriendAssistHeroListReq) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FriendAssistHeroListReq) String() string {
|
||||
func (x *FriendAssistHeroListPush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FriendAssistHeroListReq) ProtoMessage() {}
|
||||
func (*FriendAssistHeroListPush) ProtoMessage() {}
|
||||
|
||||
func (x *FriendAssistHeroListReq) ProtoReflect() protoreflect.Message {
|
||||
func (x *FriendAssistHeroListPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_friend_friend_msg_proto_msgTypes[37]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -1900,52 +1902,12 @@ func (x *FriendAssistHeroListReq) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FriendAssistHeroListReq.ProtoReflect.Descriptor instead.
|
||||
func (*FriendAssistHeroListReq) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use FriendAssistHeroListPush.ProtoReflect.Descriptor instead.
|
||||
func (*FriendAssistHeroListPush) Descriptor() ([]byte, []int) {
|
||||
return file_friend_friend_msg_proto_rawDescGZIP(), []int{37}
|
||||
}
|
||||
|
||||
type FriendAssistHeroListResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Friends []*FriendBase `protobuf:"bytes,1,rep,name=friends,proto3" json:"friends"` //好友
|
||||
}
|
||||
|
||||
func (x *FriendAssistHeroListResp) Reset() {
|
||||
*x = FriendAssistHeroListResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_friend_friend_msg_proto_msgTypes[38]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FriendAssistHeroListResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FriendAssistHeroListResp) ProtoMessage() {}
|
||||
|
||||
func (x *FriendAssistHeroListResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_friend_friend_msg_proto_msgTypes[38]
|
||||
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 FriendAssistHeroListResp.ProtoReflect.Descriptor instead.
|
||||
func (*FriendAssistHeroListResp) Descriptor() ([]byte, []int) {
|
||||
return file_friend_friend_msg_proto_rawDescGZIP(), []int{38}
|
||||
}
|
||||
|
||||
func (x *FriendAssistHeroListResp) GetFriends() []*FriendBase {
|
||||
func (x *FriendAssistHeroListPush) GetFriends() []*FriendBase {
|
||||
if x != nil {
|
||||
return x.Friends
|
||||
}
|
||||
@ -2091,14 +2053,12 @@ var file_friend_friend_msg_proto_rawDesc = []byte{
|
||||
0x22, 0x31, 0x0a, 0x13, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x47, 0x65, 0x74, 0x72, 0x65, 0x77,
|
||||
0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x73, 0x73,
|
||||
0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x41,
|
||||
0x0a, 0x18, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65,
|
||||
0x72, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x07, 0x66, 0x72,
|
||||
0x69, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x72,
|
||||
0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64,
|
||||
0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x76, 0x65, 0x64, 0x22, 0x41, 0x0a, 0x18, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x73, 0x73,
|
||||
0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12,
|
||||
0x25, 0x0a, 0x07, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0b, 0x2e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x07, 0x66,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -2113,7 +2073,7 @@ func file_friend_friend_msg_proto_rawDescGZIP() []byte {
|
||||
return file_friend_friend_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 39)
|
||||
var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 38)
|
||||
var file_friend_friend_msg_proto_goTypes = []interface{}{
|
||||
(*FriendBase)(nil), // 0: FriendBase
|
||||
(*FriendListReq)(nil), // 1: FriendListReq
|
||||
@ -2152,9 +2112,8 @@ var file_friend_friend_msg_proto_goTypes = []interface{}{
|
||||
(*FriendAssistlistResp)(nil), // 34: FriendAssistlistResp
|
||||
(*FriendGetrewardReq)(nil), // 35: FriendGetrewardReq
|
||||
(*FriendGetrewardResp)(nil), // 36: FriendGetrewardResp
|
||||
(*FriendAssistHeroListReq)(nil), // 37: FriendAssistHeroListReq
|
||||
(*FriendAssistHeroListResp)(nil), // 38: FriendAssistHeroListResp
|
||||
(*ZhuZhanRecord)(nil), // 39: ZhuZhanRecord
|
||||
(*FriendAssistHeroListPush)(nil), // 37: FriendAssistHeroListPush
|
||||
(*ZhuZhanRecord)(nil), // 38: ZhuZhanRecord
|
||||
}
|
||||
var file_friend_friend_msg_proto_depIdxs = []int32{
|
||||
0, // 0: FriendListResp.list:type_name -> FriendBase
|
||||
@ -2164,8 +2123,8 @@ var file_friend_friend_msg_proto_depIdxs = []int32{
|
||||
0, // 4: FriendBlackListResp.friends:type_name -> FriendBase
|
||||
0, // 5: FriendZanlistResp.list:type_name -> FriendBase
|
||||
0, // 6: FriendAssistlistResp.list:type_name -> FriendBase
|
||||
39, // 7: FriendAssistlistResp.record:type_name -> ZhuZhanRecord
|
||||
0, // 8: FriendAssistHeroListResp.friends:type_name -> FriendBase
|
||||
38, // 7: FriendAssistlistResp.record:type_name -> ZhuZhanRecord
|
||||
0, // 8: FriendAssistHeroListPush.friends:type_name -> FriendBase
|
||||
9, // [9:9] is the sub-list for method output_type
|
||||
9, // [9:9] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
@ -2625,19 +2584,7 @@ func file_friend_friend_msg_proto_init() {
|
||||
}
|
||||
}
|
||||
file_friend_friend_msg_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FriendAssistHeroListReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_friend_friend_msg_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FriendAssistHeroListResp); i {
|
||||
switch v := v.(*FriendAssistHeroListPush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -2655,7 +2602,7 @@ func file_friend_friend_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_friend_friend_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 39,
|
||||
NumMessages: 38,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user