From 5e7ba8288fd7970132fafe48c54a6e405dab7320 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 09:40:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=93=E6=AD=A6?= =?UTF-8?q?=E5=8D=87=E6=98=9F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_starup.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/exclusive/api_starup.go b/modules/exclusive/api_starup.go index b8695f956..e33b6c47f 100644 --- a/modules/exclusive/api_starup.go +++ b/modules/exclusive/api_starup.go @@ -1,6 +1,7 @@ package exclusive import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" ) @@ -21,7 +22,7 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe err error ) - if list, err = this.module.model.getExclusivesByIds(session.GetUserId(), req.Eatid); err != nil { + if list, err = this.module.model.getExclusivesByIds(session.GetUserId(), append(req.Eatid, req.Oid)); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, Message: err.Error(), @@ -36,6 +37,13 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe stars += v.Star } } + if info != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: fmt.Sprintf("no found info id:%s", req.Oid), + } + return + } info.Star += stars if err = this.module.model.updateExclusive(session.GetUserId(), info); err != nil { errdata = &pb.ErrorData{ From 62afe85de815e35923729c35238f4e3ec2d68986 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 09:55:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=93=E6=AD=A6?= =?UTF-8?q?=E9=94=81=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_lock.go | 37 +++++++ modules/exclusive/model.go | 1 + pb/exclusive_db.pb.go | 23 ++-- pb/exclusive_msg.pb.go | 195 +++++++++++++++++++++++++++++----- 4 files changed, 225 insertions(+), 31 deletions(-) create mode 100644 modules/exclusive/api_lock.go diff --git a/modules/exclusive/api_lock.go b/modules/exclusive/api_lock.go new file mode 100644 index 000000000..8a6ad9c2f --- /dev/null +++ b/modules/exclusive/api_lock.go @@ -0,0 +1,37 @@ +package exclusive + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +//参数校验 +func (this *apiComp) LockCheck(session comm.IUserSession, req *pb.ExclusiveLockReq) (errdata *pb.ErrorData) { + + return +} + +///获取用户装备列表 +func (this *apiComp) Lock(session comm.IUserSession, req *pb.ExclusiveLockReq) (errdata *pb.ErrorData) { + var ( + info *pb.DB_Exclusive + err error + ) + if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + info.Islock = req.Islock + if err = this.module.model.updateExclusive(session.GetUserId(), info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + session.SendMsg(string(this.module.GetType()), "lock", &pb.ExclusiveLockResp{Oid: req.Oid, Islock: req.Islock}) + return +} diff --git a/modules/exclusive/model.go b/modules/exclusive/model.go index 1a614d3d6..00764e544 100644 --- a/modules/exclusive/model.go +++ b/modules/exclusive/model.go @@ -217,6 +217,7 @@ func (this *exclusiveModel) updateExclusive(uid string, list []*pb.DB_Exclusive) "property": v.Property, "commonskill": v.Commonskill, "exclusiveskill": v.Exclusiveskill, + "islock": v.Islock, } } diff --git a/pb/exclusive_db.pb.go b/pb/exclusive_db.pb.go index f3b058b6b..1ce95934a 100644 --- a/pb/exclusive_db.pb.go +++ b/pb/exclusive_db.pb.go @@ -37,6 +37,7 @@ type DB_Exclusive struct { Property map[int32]int32 `protobuf:"bytes,9,rep,name=property,proto3" json:"property" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关 Commonskill int32 `protobuf:"varint,10,opt,name=commonskill,proto3" json:"commonskill"` //通用技能 Exclusiveskill int32 `protobuf:"varint,11,opt,name=exclusiveskill,proto3" json:"exclusiveskill"` // 专属技能 + Islock bool `protobuf:"varint,12,opt,name=islock,proto3" json:"islock"` //锁定状态 } func (x *DB_Exclusive) Reset() { @@ -148,11 +149,18 @@ func (x *DB_Exclusive) GetExclusiveskill() int32 { return 0 } +func (x *DB_Exclusive) GetIslock() bool { + if x != nil { + return x.Islock + } + return false +} + var File_exclusive_exclusive_db_proto protoreflect.FileDescriptor var file_exclusive_exclusive_db_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x2f, 0x65, 0x78, 0x63, 0x6c, - 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe0, + 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x49, @@ -171,12 +179,13 @@ var file_exclusive_exclusive_db_proto_rawDesc = []byte{ 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, - 0x6b, 0x69, 0x6c, 0x6c, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x1a, 0x3b, 0x0a, 0x0d, + 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/exclusive_msg.pb.go b/pb/exclusive_msg.pb.go index 090bfe00a..e49dc4ef2 100644 --- a/pb/exclusive_msg.pb.go +++ b/pb/exclusive_msg.pb.go @@ -605,6 +605,7 @@ func (x *ExclusiveWearResp) GetExclusives() *DB_Exclusive { return nil } +//出售 type ExclusiveSellReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -699,6 +700,118 @@ func (x *ExclusiveSellResp) GetReward() []*UserAtno { return nil } +//锁定 +type ExclusiveLockReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"` + Islock bool `protobuf:"varint,2,opt,name=islock,proto3" json:"islock"` +} + +func (x *ExclusiveLockReq) Reset() { + *x = ExclusiveLockReq{} + if protoimpl.UnsafeEnabled { + mi := &file_exclusive_exclusive_msg_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExclusiveLockReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExclusiveLockReq) ProtoMessage() {} + +func (x *ExclusiveLockReq) ProtoReflect() protoreflect.Message { + mi := &file_exclusive_exclusive_msg_proto_msgTypes[14] + 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 ExclusiveLockReq.ProtoReflect.Descriptor instead. +func (*ExclusiveLockReq) Descriptor() ([]byte, []int) { + return file_exclusive_exclusive_msg_proto_rawDescGZIP(), []int{14} +} + +func (x *ExclusiveLockReq) GetOid() string { + if x != nil { + return x.Oid + } + return "" +} + +func (x *ExclusiveLockReq) GetIslock() bool { + if x != nil { + return x.Islock + } + return false +} + +//锁定回应 +type ExclusiveLockResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"` + Islock bool `protobuf:"varint,2,opt,name=islock,proto3" json:"islock"` +} + +func (x *ExclusiveLockResp) Reset() { + *x = ExclusiveLockResp{} + if protoimpl.UnsafeEnabled { + mi := &file_exclusive_exclusive_msg_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExclusiveLockResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExclusiveLockResp) ProtoMessage() {} + +func (x *ExclusiveLockResp) ProtoReflect() protoreflect.Message { + mi := &file_exclusive_exclusive_msg_proto_msgTypes[15] + 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 ExclusiveLockResp.ProtoReflect.Descriptor instead. +func (*ExclusiveLockResp) Descriptor() ([]byte, []int) { + return file_exclusive_exclusive_msg_proto_rawDescGZIP(), []int{15} +} + +func (x *ExclusiveLockResp) GetOid() string { + if x != nil { + return x.Oid + } + return "" +} + +func (x *ExclusiveLockResp) GetIslock() bool { + if x != nil { + return x.Islock + } + return false +} + //推送装备背包变化 type ExclusiveChangePush struct { state protoimpl.MessageState @@ -711,7 +824,7 @@ type ExclusiveChangePush struct { func (x *ExclusiveChangePush) Reset() { *x = ExclusiveChangePush{} if protoimpl.UnsafeEnabled { - mi := &file_exclusive_exclusive_msg_proto_msgTypes[14] + mi := &file_exclusive_exclusive_msg_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -724,7 +837,7 @@ func (x *ExclusiveChangePush) String() string { func (*ExclusiveChangePush) ProtoMessage() {} func (x *ExclusiveChangePush) ProtoReflect() protoreflect.Message { - mi := &file_exclusive_exclusive_msg_proto_msgTypes[14] + mi := &file_exclusive_exclusive_msg_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -737,7 +850,7 @@ func (x *ExclusiveChangePush) ProtoReflect() protoreflect.Message { // Deprecated: Use ExclusiveChangePush.ProtoReflect.Descriptor instead. func (*ExclusiveChangePush) Descriptor() ([]byte, []int) { - return file_exclusive_exclusive_msg_proto_rawDescGZIP(), []int{14} + return file_exclusive_exclusive_msg_proto_rawDescGZIP(), []int{16} } func (x *ExclusiveChangePush) GetExclusives() []*DB_Exclusive { @@ -810,12 +923,20 @@ var file_exclusive_exclusive_msg_proto_rawDesc = []byte{ 0x22, 0x36, 0x0a, 0x11, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x53, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, - 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x22, 0x44, 0x0a, 0x13, 0x45, 0x78, 0x63, 0x6c, - 0x75, 0x73, 0x69, 0x76, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, - 0x2d, 0x0a, 0x0a, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x76, 0x65, 0x52, 0x0a, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x22, 0x3c, 0x0a, 0x10, 0x45, 0x78, 0x63, 0x6c, + 0x75, 0x73, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, + 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x69, 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3d, 0x0a, 0x11, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, + 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x69, 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, + 0x73, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x44, 0x0a, 0x13, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, + 0x76, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x2d, 0x0a, 0x0a, + 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x52, + 0x0a, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -830,7 +951,7 @@ func file_exclusive_exclusive_msg_proto_rawDescGZIP() []byte { return file_exclusive_exclusive_msg_proto_rawDescData } -var file_exclusive_exclusive_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_exclusive_exclusive_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_exclusive_exclusive_msg_proto_goTypes = []interface{}{ (*ExclusiveGetListReq)(nil), // 0: ExclusiveGetListReq (*ExclusiveGetListResp)(nil), // 1: ExclusiveGetListResp @@ -846,21 +967,23 @@ var file_exclusive_exclusive_msg_proto_goTypes = []interface{}{ (*ExclusiveWearResp)(nil), // 11: ExclusiveWearResp (*ExclusiveSellReq)(nil), // 12: ExclusiveSellReq (*ExclusiveSellResp)(nil), // 13: ExclusiveSellResp - (*ExclusiveChangePush)(nil), // 14: ExclusiveChangePush - nil, // 15: ExclusiveAddExpReq.ItemsEntry - (*DB_Exclusive)(nil), // 16: DB_Exclusive - (*UserAtno)(nil), // 17: UserAtno + (*ExclusiveLockReq)(nil), // 14: ExclusiveLockReq + (*ExclusiveLockResp)(nil), // 15: ExclusiveLockResp + (*ExclusiveChangePush)(nil), // 16: ExclusiveChangePush + nil, // 17: ExclusiveAddExpReq.ItemsEntry + (*DB_Exclusive)(nil), // 18: DB_Exclusive + (*UserAtno)(nil), // 19: UserAtno } var file_exclusive_exclusive_msg_proto_depIdxs = []int32{ - 16, // 0: ExclusiveGetListResp.Exclusives:type_name -> DB_Exclusive - 15, // 1: ExclusiveAddExpReq.items:type_name -> ExclusiveAddExpReq.ItemsEntry - 16, // 2: ExclusiveAddExpResp.Exclusives:type_name -> DB_Exclusive - 16, // 3: ExclusiveUpgradeResp.Exclusives:type_name -> DB_Exclusive - 16, // 4: ExclusiveStarUpResp.Exclusives:type_name -> DB_Exclusive - 16, // 5: ExclusiveRankUpResp.Exclusives:type_name -> DB_Exclusive - 16, // 6: ExclusiveWearResp.Exclusives:type_name -> DB_Exclusive - 17, // 7: ExclusiveSellResp.reward:type_name -> UserAtno - 16, // 8: ExclusiveChangePush.Exclusives:type_name -> DB_Exclusive + 18, // 0: ExclusiveGetListResp.Exclusives:type_name -> DB_Exclusive + 17, // 1: ExclusiveAddExpReq.items:type_name -> ExclusiveAddExpReq.ItemsEntry + 18, // 2: ExclusiveAddExpResp.Exclusives:type_name -> DB_Exclusive + 18, // 3: ExclusiveUpgradeResp.Exclusives:type_name -> DB_Exclusive + 18, // 4: ExclusiveStarUpResp.Exclusives:type_name -> DB_Exclusive + 18, // 5: ExclusiveRankUpResp.Exclusives:type_name -> DB_Exclusive + 18, // 6: ExclusiveWearResp.Exclusives:type_name -> DB_Exclusive + 19, // 7: ExclusiveSellResp.reward:type_name -> UserAtno + 18, // 8: ExclusiveChangePush.Exclusives:type_name -> DB_Exclusive 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 @@ -1045,6 +1168,30 @@ func file_exclusive_exclusive_msg_proto_init() { } } file_exclusive_exclusive_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExclusiveLockReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_exclusive_exclusive_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExclusiveLockResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_exclusive_exclusive_msg_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExclusiveChangePush); i { case 0: return &v.state @@ -1063,7 +1210,7 @@ func file_exclusive_exclusive_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_exclusive_exclusive_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 18, NumExtensions: 0, NumServices: 0, }, From c31dcd3a23f35b33257a4659b1bf49ce940d8435 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 10:02:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=93=E6=AD=A6?= =?UTF-8?q?=E8=84=B1=E8=A3=85=E5=A4=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_starup.go | 7 +++++++ modules/exclusive/api_wear.go | 34 +++++++++++++++++---------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/modules/exclusive/api_starup.go b/modules/exclusive/api_starup.go index e33b6c47f..c23943875 100644 --- a/modules/exclusive/api_starup.go +++ b/modules/exclusive/api_starup.go @@ -34,6 +34,13 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe if v.Id == req.Oid { info = v } else { + if v.Islock { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Message: fmt.Sprintf("Exclusives:%s is lock", v.Id), + } + return + } stars += v.Star } } diff --git a/modules/exclusive/api_wear.go b/modules/exclusive/api_wear.go index 2cad9c775..678599dbf 100644 --- a/modules/exclusive/api_wear.go +++ b/modules/exclusive/api_wear.go @@ -34,24 +34,26 @@ func (this *apiComp) Wear(session comm.IUserSession, req *pb.ExclusiveWearReq) ( info.Hero = "" change = append(change, info) } - if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Message: err.Error(), + if req.Oid != "" { + if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return } - return - } - info.Hero = hero.Id - change = append(change, info) - if err = this.module.model.updateExclusive(session.GetUserId(), change...); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Message: err.Error(), + info.Hero = hero.Id + change = append(change, info) + if err = this.module.model.updateExclusive(session.GetUserId(), change...); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { + return } - return - } - if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { - return } this.module.equipmentsChangePush(session, change) session.SendMsg(string(this.module.GetType()), "wear", &pb.ExclusiveWearResp{Exclusives: info}) From d84f7de6dbb9a1ccf0801bc754a872ca541c8d1b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 10:11:01 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=84=B1=E4=B8=93?= =?UTF-8?q?=E6=AD=A6=E6=97=B6=E8=8B=B1=E9=9B=84=E6=95=B0=E6=8D=AE=E6=8E=A8?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_wear.go | 4 ++++ modules/hero/model_hero.go | 42 ++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/modules/exclusive/api_wear.go b/modules/exclusive/api_wear.go index 678599dbf..07731bc0e 100644 --- a/modules/exclusive/api_wear.go +++ b/modules/exclusive/api_wear.go @@ -54,6 +54,10 @@ func (this *apiComp) Wear(session comm.IUserSession, req *pb.ExclusiveWearReq) ( if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { return } + } else { + if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, nil); errdata != nil { + return + } } this.module.equipmentsChangePush(session, change) session.SendMsg(string(this.module.GetType()), "wear", &pb.ExclusiveWearResp{Exclusives: info}) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 3a476ab92..9a735d4b5 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -471,25 +471,31 @@ func (this *ModelHero) setExclusiveProperty(hero *pb.DBHero, exw *pb.DB_Exclusiv addProperty := make(map[int32]int32) //副属性 equipSkill := make([]*pb.SkillData, 0) - hero.Exclusiveid = exw.Id + if exw != nil { + hero.Exclusiveid = exw.Id + for k, v := range exw.Property { + addProperty[k] = v //附加属性 + } + hero.ExclusiveProperty = addProperty + if exw.Commonskill != 0 { + equipSkill = append(equipSkill, &pb.SkillData{ + SkillID: exw.Commonskill, + SkillLv: 1, + }) + } + if exw.Exclusiveskill != 0 { + equipSkill = append(equipSkill, &pb.SkillData{ + SkillID: exw.Exclusiveskill, + SkillLv: 1, + }) + } + hero.ExclusiveSkill = equipSkill + } else { + hero.Exclusiveid = "" + hero.ExclusiveProperty = addProperty + hero.ExclusiveSkill = equipSkill + } - for k, v := range exw.Property { - addProperty[k] = v //附加属性 - } - hero.ExclusiveProperty = addProperty - if exw.Commonskill != 0 { - equipSkill = append(equipSkill, &pb.SkillData{ - SkillID: exw.Commonskill, - SkillLv: 1, - }) - } - if exw.Exclusiveskill != 0 { - equipSkill = append(equipSkill, &pb.SkillData{ - SkillID: exw.Exclusiveskill, - SkillLv: 1, - }) - } - hero.ExclusiveSkill = equipSkill this.calFigthValue(hero) if err := this.ChangeList(hero.Uid, hero.Id, map[string]interface{}{ "exclusiveid": hero.Exclusiveid,