邮件附件类型定义ATN 类型 并调用通用加道具接口
This commit is contained in:
parent
2e7050e6ee
commit
952557ffaf
@ -3,6 +3,7 @@ package mail
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -36,23 +37,22 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma
|
||||
_data, err := this.module.modelMail.Mail_GetMailAttachment(req.ObjID)
|
||||
if err == nil {
|
||||
if len(_data) > 0 {
|
||||
// todo 领取附件
|
||||
_items := make(map[int32]int32, 0)
|
||||
res := make([]*cfg.Game_atn, 0)
|
||||
for _, v := range _data {
|
||||
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
||||
d := &cfg.Game_atn{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
}
|
||||
code = this.items.AddItems(&comm.ModuleCallSource{
|
||||
Module: string(this.module.GetType()),
|
||||
FuncName: "GetUserMailAttachment",
|
||||
Describe: "领取附件",
|
||||
}, mail.Uid, _items)
|
||||
res = append(res, d)
|
||||
}
|
||||
code = this.module.api.module.CheckConsumeRes(session.GetUserId(), res) // 领取附件
|
||||
if code == pb.ErrorCode_Success {
|
||||
// 修改状态
|
||||
this.module.modelMail.Mail_UpdateMailAttachmentState(req.ObjID)
|
||||
mail.Reward = true
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
code = pb.ErrorCode_SystemError
|
||||
|
@ -75,7 +75,7 @@ func (this *modelMail) Mail_ReadOneMail(objId string) (mail *pb.DBMailData, err
|
||||
}
|
||||
|
||||
// 查询附件信息
|
||||
func (this *modelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.MailAttachment, err error) {
|
||||
func (this *modelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.UserAssets, err error) {
|
||||
|
||||
obj := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId})
|
||||
var nd *pb.DBMailData
|
||||
|
124
pb/mail_db.pb.go
124
pb/mail_db.pb.go
@ -20,61 +20,6 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type MailAttachment struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ItemId uint32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId"` // 道具iD
|
||||
ItemCount uint32 `protobuf:"varint,2,opt,name=ItemCount,proto3" json:"ItemCount"` // 数量
|
||||
}
|
||||
|
||||
func (x *MailAttachment) Reset() {
|
||||
*x = MailAttachment{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_mail_mail_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MailAttachment) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MailAttachment) ProtoMessage() {}
|
||||
|
||||
func (x *MailAttachment) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_mail_mail_db_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 MailAttachment.ProtoReflect.Descriptor instead.
|
||||
func (*MailAttachment) Descriptor() ([]byte, []int) {
|
||||
return file_mail_mail_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *MailAttachment) GetItemId() uint32 {
|
||||
if x != nil {
|
||||
return x.ItemId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *MailAttachment) GetItemCount() uint32 {
|
||||
if x != nil {
|
||||
return x.ItemCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DBMailData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -88,13 +33,13 @@ type DBMailData struct {
|
||||
DueTime uint64 `protobuf:"varint,6,opt,name=DueTime,proto3" json:"DueTime"` // 过期时间
|
||||
Check bool `protobuf:"varint,7,opt,name=Check,proto3" json:"Check"` // 是否查看
|
||||
Reward bool `protobuf:"varint,8,opt,name=Reward,proto3" json:"Reward"` // 附件领取状态
|
||||
Items []*MailAttachment `protobuf:"bytes,9,rep,name=Items,proto3" json:"Items"` // 附件
|
||||
Items []*UserAssets `protobuf:"bytes,9,rep,name=Items,proto3" json:"Items"` // 附件
|
||||
}
|
||||
|
||||
func (x *DBMailData) Reset() {
|
||||
*x = DBMailData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_mail_mail_db_proto_msgTypes[1]
|
||||
mi := &file_mail_mail_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -107,7 +52,7 @@ func (x *DBMailData) String() string {
|
||||
func (*DBMailData) ProtoMessage() {}
|
||||
|
||||
func (x *DBMailData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_mail_mail_db_proto_msgTypes[1]
|
||||
mi := &file_mail_mail_db_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -120,7 +65,7 @@ func (x *DBMailData) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use DBMailData.ProtoReflect.Descriptor instead.
|
||||
func (*DBMailData) Descriptor() ([]byte, []int) {
|
||||
return file_mail_mail_db_proto_rawDescGZIP(), []int{1}
|
||||
return file_mail_mail_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *DBMailData) GetObjId() string {
|
||||
@ -179,7 +124,7 @@ func (x *DBMailData) GetReward() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *DBMailData) GetItems() []*MailAttachment {
|
||||
func (x *DBMailData) GetItems() []*UserAssets {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
@ -190,26 +135,22 @@ var File_mail_mail_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_mail_mail_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x6d, 0x61, 0x69, 0x6c, 0x2f, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61,
|
||||
0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c,
|
||||
0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf1, 0x01, 0x0a,
|
||||
0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x4f,
|
||||
0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a, 0x49,
|
||||
0x64, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
|
||||
0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65,
|
||||
0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x04, 0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x43,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x43, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x05, 0x49, 0x74, 0x65,
|
||||
0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41,
|
||||
0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0xed, 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x4f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43,
|
||||
0x6f, 0x6e, 0x74, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
|
||||
0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18,
|
||||
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x21, 0x0a,
|
||||
0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55,
|
||||
0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
@ -225,13 +166,13 @@ func file_mail_mail_db_proto_rawDescGZIP() []byte {
|
||||
return file_mail_mail_db_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_mail_mail_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_mail_mail_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_mail_mail_db_proto_goTypes = []interface{}{
|
||||
(*MailAttachment)(nil), // 0: MailAttachment
|
||||
(*DBMailData)(nil), // 1: DBMailData
|
||||
(*DBMailData)(nil), // 0: DBMailData
|
||||
(*UserAssets)(nil), // 1: UserAssets
|
||||
}
|
||||
var file_mail_mail_db_proto_depIdxs = []int32{
|
||||
0, // 0: DBMailData.Items:type_name -> MailAttachment
|
||||
1, // 0: DBMailData.Items:type_name -> UserAssets
|
||||
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
|
||||
@ -244,20 +185,9 @@ func file_mail_mail_db_proto_init() {
|
||||
if File_mail_mail_db_proto != nil {
|
||||
return
|
||||
}
|
||||
file_comm_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_mail_mail_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MailAttachment); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_mail_mail_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBMailData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -276,7 +206,7 @@ func file_mail_mail_db_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_mail_mail_db_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -1,15 +1,6 @@
|
||||
syntax = "proto3";
|
||||
option go_package = ".;pb";
|
||||
|
||||
// message Cache_mailData {
|
||||
// string UserID = 1;
|
||||
// repeated DB_MailData MailData = 2;
|
||||
// }
|
||||
|
||||
message MailAttachment { // 附件
|
||||
uint32 ItemId = 1; // 道具iD
|
||||
uint32 ItemCount = 2; // 数量
|
||||
}
|
||||
import "comm.proto";
|
||||
|
||||
message DBMailData {
|
||||
string ObjId = 1; // @go_tags(`bson:"_id"`) ID
|
||||
@ -20,5 +11,5 @@ message DBMailData {
|
||||
uint64 DueTime = 6; // 过期时间
|
||||
bool Check = 7; // 是否查看
|
||||
bool Reward = 8; // 附件领取状态
|
||||
repeated MailAttachment Items = 9; // 附件
|
||||
repeated UserAssets Items = 9; // 附件
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user