diff --git a/modules/friend/api_cross_accept.go b/modules/friend/api_cross_accept.go index 5628a0393..4a30b59aa 100644 --- a/modules/friend/api_cross_accept.go +++ b/modules/friend/api_cross_accept.go @@ -28,6 +28,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq) now := configure.Now().Unix() if now-qr.Timestamp > 10 { //大于10s 切磋超时 code = pb.ErrorCode_FriendQiecuoTimeout + this.moduleFriend.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()}) return } } else { @@ -56,6 +57,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq) pb.PvpType_friends, ) if c != pb.ErrorCode_Success { + this.moduleFriend.Debug("createPvp code:", log.Field{Key: "code", Value: c}) return } diff --git a/modules/friend/api_cross_stop.go b/modules/friend/api_cross_stop.go new file mode 100644 index 000000000..6a5190074 --- /dev/null +++ b/modules/friend/api_cross_stop.go @@ -0,0 +1,31 @@ +package friend + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +// 切磋终止 +func (this *apiComp) StopCheck(session comm.IUserSession, req *pb.FriendStopReq) (code pb.ErrorCode) { + return +} + +func (this *apiComp) Stop(session comm.IUserSession, req *pb.FriendStopReq) (code pb.ErrorCode) { + if code = this.StopCheck(session, req); code != pb.ErrorCode_Success { + return + } + + //清楚切磋请求记录 + this.moduleFriend.ModelFriendQiecuo.DelByUId(req.Uid) + + resp := &pb.FriendStopResp{ + IsSucc: true, + } + if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeQiecuo, resp); err != nil { + code = pb.ErrorCode_SystemError + return + } + this.moduleFriend.SendMsgToUser(string(this.moduleFriend.GetType()), "qiecuonotify", + &pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 3}, req.Uid) + return +} diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index db189faee..739190080 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -2309,19 +2309,114 @@ func (x *FriendAcceptResp) GetIsSucc() bool { return false } +//拒绝切磋 +type FriendStopReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //切磋发起者 +} + +func (x *FriendStopReq) Reset() { + *x = FriendStopReq{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendStopReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendStopReq) ProtoMessage() {} + +func (x *FriendStopReq) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[46] + 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 FriendStopReq.ProtoReflect.Descriptor instead. +func (*FriendStopReq) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{46} +} + +func (x *FriendStopReq) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +type FriendStopResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsSucc bool `protobuf:"varint,1,opt,name=isSucc,proto3" json:"isSucc"` +} + +func (x *FriendStopResp) Reset() { + *x = FriendStopResp{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendStopResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendStopResp) ProtoMessage() {} + +func (x *FriendStopResp) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[47] + 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 FriendStopResp.ProtoReflect.Descriptor instead. +func (*FriendStopResp) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{47} +} + +func (x *FriendStopResp) GetIsSucc() bool { + if x != nil { + return x.IsSucc + } + return false +} + type FriendQiecuonotifyPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //发起者(切磋) - NotifyType int32 `protobuf:"varint,2,opt,name=notifyType,proto3" json:"notifyType"` //1发起通知 2接受通知 + NotifyType int32 `protobuf:"varint,2,opt,name=notifyType,proto3" json:"notifyType"` //1发起通知 2接受通知 3拒绝通知 } func (x *FriendQiecuonotifyPush) Reset() { *x = FriendQiecuonotifyPush{} if protoimpl.UnsafeEnabled { - mi := &file_friend_friend_msg_proto_msgTypes[46] + mi := &file_friend_friend_msg_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2334,7 +2429,7 @@ func (x *FriendQiecuonotifyPush) String() string { func (*FriendQiecuonotifyPush) ProtoMessage() {} func (x *FriendQiecuonotifyPush) ProtoReflect() protoreflect.Message { - mi := &file_friend_friend_msg_proto_msgTypes[46] + mi := &file_friend_friend_msg_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2347,7 +2442,7 @@ func (x *FriendQiecuonotifyPush) ProtoReflect() protoreflect.Message { // Deprecated: Use FriendQiecuonotifyPush.ProtoReflect.Descriptor instead. func (*FriendQiecuonotifyPush) Descriptor() ([]byte, []int) { - return file_friend_friend_msg_proto_rawDescGZIP(), []int{46} + return file_friend_friend_msg_proto_rawDescGZIP(), []int{48} } func (x *FriendQiecuonotifyPush) GetUid() string { @@ -2535,13 +2630,18 @@ var file_friend_friend_msg_proto_rawDesc = []byte{ 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 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, 0x4a, - 0x0a, 0x16, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x6e, 0x6f, - 0x74, 0x69, 0x66, 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x21, + 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, + 0x64, 0x22, 0x28, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x6f, 0x70, 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, 0x4a, 0x0a, 0x16, 0x46, + 0x72, 0x69, 0x65, 0x6e, 0x64, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2556,7 +2656,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, 47) +var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 49) var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendBase)(nil), // 0: FriendBase (*FriendListReq)(nil), // 1: FriendListReq @@ -2604,8 +2704,10 @@ var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendQiecuoResp)(nil), // 43: FriendQiecuoResp (*FriendAcceptReq)(nil), // 44: FriendAcceptReq (*FriendAcceptResp)(nil), // 45: FriendAcceptResp - (*FriendQiecuonotifyPush)(nil), // 46: FriendQiecuonotifyPush - (*AssistRecord)(nil), // 47: AssistRecord + (*FriendStopReq)(nil), // 46: FriendStopReq + (*FriendStopResp)(nil), // 47: FriendStopResp + (*FriendQiecuonotifyPush)(nil), // 48: FriendQiecuonotifyPush + (*AssistRecord)(nil), // 49: AssistRecord } var file_friend_friend_msg_proto_depIdxs = []int32{ 0, // 0: FriendListResp.list:type_name -> FriendBase @@ -2615,7 +2717,7 @@ 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 - 47, // 7: FriendAssistlistResp.record:type_name -> AssistRecord + 49, // 7: FriendAssistlistResp.record:type_name -> AssistRecord 0, // 8: FriendAssistHeroUpdatePush.friend:type_name -> FriendBase 0, // 9: FriendAssistHeroListResp.friends:type_name -> FriendBase 10, // [10:10] is the sub-list for method output_type @@ -3185,6 +3287,30 @@ func file_friend_friend_msg_proto_init() { } } file_friend_friend_msg_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendStopReq); 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[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendStopResp); 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[48].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FriendQiecuonotifyPush); i { case 0: return &v.state @@ -3203,7 +3329,7 @@ func file_friend_friend_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_friend_friend_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 47, + NumMessages: 49, NumExtensions: 0, NumServices: 0, },