This commit is contained in:
liwei1dao 2023-02-13 14:18:45 +08:00
commit 6e42fb6a7f
3 changed files with 175 additions and 16 deletions

View File

@ -28,6 +28,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
now := configure.Now().Unix() now := configure.Now().Unix()
if now-qr.Timestamp > 10 { //大于10s 切磋超时 if now-qr.Timestamp > 10 { //大于10s 切磋超时
code = pb.ErrorCode_FriendQiecuoTimeout code = pb.ErrorCode_FriendQiecuoTimeout
this.moduleFriend.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()})
return return
} }
} else { } else {
@ -56,6 +57,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
pb.PvpType_friends, pb.PvpType_friends,
) )
if c != pb.ErrorCode_Success { if c != pb.ErrorCode_Success {
this.moduleFriend.Debug("createPvp code:", log.Field{Key: "code", Value: c})
return return
} }

View File

@ -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
}

View File

@ -2309,19 +2309,114 @@ func (x *FriendAcceptResp) GetIsSucc() bool {
return false 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 { type FriendQiecuonotifyPush struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //发起者(切磋) 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() { func (x *FriendQiecuonotifyPush) Reset() {
*x = FriendQiecuonotifyPush{} *x = FriendQiecuonotifyPush{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -2334,7 +2429,7 @@ func (x *FriendQiecuonotifyPush) String() string {
func (*FriendQiecuonotifyPush) ProtoMessage() {} func (*FriendQiecuonotifyPush) ProtoMessage() {}
func (x *FriendQiecuonotifyPush) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -2347,7 +2442,7 @@ func (x *FriendQiecuonotifyPush) ProtoReflect() protoreflect.Message {
// Deprecated: Use FriendQiecuonotifyPush.ProtoReflect.Descriptor instead. // Deprecated: Use FriendQiecuonotifyPush.ProtoReflect.Descriptor instead.
func (*FriendQiecuonotifyPush) Descriptor() ([]byte, []int) { 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 { 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, 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, 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, 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, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x21,
0x0a, 0x16, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x6e, 0x6f, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x12,
0x74, 0x69, 0x66, 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x22, 0x28, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x6f, 0x70, 0x52,
0x74, 0x69, 0x66, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20,
0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x22, 0x4a, 0x0a, 0x16, 0x46,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -2556,7 +2656,7 @@ func file_friend_friend_msg_proto_rawDescGZIP() []byte {
return file_friend_friend_msg_proto_rawDescData 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{}{ var file_friend_friend_msg_proto_goTypes = []interface{}{
(*FriendBase)(nil), // 0: FriendBase (*FriendBase)(nil), // 0: FriendBase
(*FriendListReq)(nil), // 1: FriendListReq (*FriendListReq)(nil), // 1: FriendListReq
@ -2604,8 +2704,10 @@ var file_friend_friend_msg_proto_goTypes = []interface{}{
(*FriendQiecuoResp)(nil), // 43: FriendQiecuoResp (*FriendQiecuoResp)(nil), // 43: FriendQiecuoResp
(*FriendAcceptReq)(nil), // 44: FriendAcceptReq (*FriendAcceptReq)(nil), // 44: FriendAcceptReq
(*FriendAcceptResp)(nil), // 45: FriendAcceptResp (*FriendAcceptResp)(nil), // 45: FriendAcceptResp
(*FriendQiecuonotifyPush)(nil), // 46: FriendQiecuonotifyPush (*FriendStopReq)(nil), // 46: FriendStopReq
(*AssistRecord)(nil), // 47: AssistRecord (*FriendStopResp)(nil), // 47: FriendStopResp
(*FriendQiecuonotifyPush)(nil), // 48: FriendQiecuonotifyPush
(*AssistRecord)(nil), // 49: AssistRecord
} }
var file_friend_friend_msg_proto_depIdxs = []int32{ var file_friend_friend_msg_proto_depIdxs = []int32{
0, // 0: FriendListResp.list:type_name -> FriendBase 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, // 4: FriendBlackListResp.friends:type_name -> FriendBase
0, // 5: FriendZanlistResp.list:type_name -> FriendBase 0, // 5: FriendZanlistResp.list:type_name -> FriendBase
0, // 6: FriendAssistlistResp.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, // 8: FriendAssistHeroUpdatePush.friend:type_name -> FriendBase
0, // 9: FriendAssistHeroListResp.friends:type_name -> FriendBase 0, // 9: FriendAssistHeroListResp.friends:type_name -> FriendBase
10, // [10:10] is the sub-list for method output_type 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{} { 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 { switch v := v.(*FriendQiecuonotifyPush); i {
case 0: case 0:
return &v.state return &v.state
@ -3203,7 +3329,7 @@ func file_friend_friend_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_friend_friend_msg_proto_rawDesc, RawDescriptor: file_friend_friend_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 47, NumMessages: 49,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },