package mail import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) func (this *Api_Comp) GetUserMailAttachmentReq_Check(session comm.IUserSession, req *pb.GetUserMailAttachmentReq) (result map[string]interface{}, code comm.ErrorCode) { return } // 领取附件 func (this *Api_Comp) GetUserMailAttachmentReq(session comm.IUserSession, agrs map[string]interface{}, req *pb.GetUserMailAttachmentReq) (code pb.ErrorCode) { var ( mail *pb.DB_MailData ) defer func() { session.SendMsg(string(this.module.GetType()), GetUserMailAttachmentResp, &pb.GetUserMailAttachmentResp{Mail: mail}) }() if session.GetUserId() == "" { code = pb.ErrorCode_NoLogin return } _bGet := this.module.db_comp.Mail_GetMailAttachmentState(req.ObjID) if !_bGet { code = pb.ErrorCode_StateInvalid return } _data, err := this.module.db_comp.Mail_GetMailAttachment(req.ObjID) if err != nil { if len(_data) > 0 { // todo 领取附件 _items := make(map[int32]int32, 0) for _, v := range _data { _items[int32(v.ItemId)] += int32(v.ItemCount) } bRet := this.pack.AddItemsToUserPack(mail.UserId, _items) if bRet != nil { // 修改状态 this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID) mail.Reward = true return } } code = pb.ErrorCode_SystemError } return }