Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
79d8cf4e31
@ -39,6 +39,8 @@ type (
|
||||
CreateHeroes(uid string, heroCfgId ...string) error
|
||||
//创建指定数量
|
||||
CreateRepeatHero(uid string, heroCfgId string, num int32) (*pb.DBHero, error)
|
||||
// 批量创建英雄
|
||||
CreateRepeatHeros(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
||||
// 获取英雄
|
||||
// heroId 英雄ID
|
||||
GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
||||
|
@ -157,3 +157,17 @@ func (this *Hero) EventUserOffline(session comm.IUserSession) {
|
||||
err := this.modelHero.RemoveUserHeroInfo(session)
|
||||
this.Debugf("EventUserOffline:%s err:%v", session, err)
|
||||
}
|
||||
|
||||
// 批量创建多个英雄
|
||||
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode) {
|
||||
|
||||
for heroCfgId, num := range items {
|
||||
_, err := this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_HeroCreate
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma
|
||||
// 修改状态
|
||||
this.module.modelMail.MailUpdateMailAttachmentState(req.ObjID)
|
||||
mail.Reward = true
|
||||
return
|
||||
//return
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,34 +77,25 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
|
||||
code = pb.ErrorCode_MailErr
|
||||
return
|
||||
}
|
||||
fj := make([]*pb.UserAssets, 0)
|
||||
res := make([]*cfg.Game_atn, 0)
|
||||
for _, v := range mails {
|
||||
|
||||
for _, v1 := range v.Items {
|
||||
d := &cfg.Game_atn{
|
||||
A: v1.A,
|
||||
T: v1.T,
|
||||
N: v1.N,
|
||||
}
|
||||
fj = append(fj, v1)
|
||||
res = append(res, d)
|
||||
}
|
||||
code = this.module.api.module.DispenseRes(session, res, true) // 领取附件
|
||||
if code == pb.ErrorCode_Success {
|
||||
// 修改状态
|
||||
this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId)
|
||||
v.Reward = true
|
||||
return
|
||||
}
|
||||
}
|
||||
fj := make([]*pb.UserAssets, 0)
|
||||
for _, v := range res {
|
||||
atn1 := &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
}
|
||||
fj = append(fj, atn1)
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "getusermailattachment", &pb.MailGetAllMailAttachmentResp{Res: fj})
|
||||
return
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -25,7 +24,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
|
||||
code = this.ReadMailCheck(session, req) // check
|
||||
if code != pb.ErrorCode_Success {
|
||||
log.Debugf("read mail failed%d", code)
|
||||
this.module.Debugf("read mail failed%d", code)
|
||||
return
|
||||
}
|
||||
mail, err = this.module.modelMail.MailReadOneMail(req.ObjID)
|
||||
@ -33,7 +32,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
log.Debugf("read mail %v", mail)
|
||||
this.module.Debugf("read mail %v", mail)
|
||||
mail.Check = true
|
||||
session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail})
|
||||
return
|
||||
|
@ -122,7 +122,7 @@ func (this *modelMail) MailDelUserMail(objId string) bool {
|
||||
|
||||
func (this *modelMail) MailQueryUserMailByReard(uId string) (mail []*pb.DBMailData, err error) {
|
||||
|
||||
if _data, err := this.DB.Find(DB_MailTable, bson.M{"uid": uId, "Reward": false}); err == nil {
|
||||
if _data, err := this.DB.Find(DB_MailTable, bson.M{"uid": uId, "reward": false}); err == nil {
|
||||
for _data.Next(context.TODO()) {
|
||||
temp := &pb.DBMailData{}
|
||||
if err = _data.Decode(temp); err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user