提交道具背包优化
This commit is contained in:
parent
840bc4c986
commit
9e699cc116
@ -17,16 +17,16 @@ func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.ItemsGetlis
|
||||
///获取用户道具
|
||||
func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
items []*pb.DB_UserItemData
|
||||
nt int64
|
||||
tempgrids []*pb.DB_UserItemData
|
||||
grids []*pb.DB_UserItemData
|
||||
modifys []*pb.DB_UserItemData
|
||||
dels []*pb.DB_UserItemData
|
||||
err error
|
||||
items []*pb.DB_UserItemData
|
||||
nt int64
|
||||
// tempgrids []*pb.DB_UserItemData
|
||||
grids []*pb.DB_UserItemData
|
||||
modifys []*pb.DB_UserItemData
|
||||
dels []*pb.DB_UserItemData
|
||||
)
|
||||
defer func() {
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ItemsGetlistResp{Grids: grids})
|
||||
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ItemsGetlistResp{Grids: items})
|
||||
if code == pb.ErrorCode_Success {
|
||||
go func() { //异步处理修改数据
|
||||
if len(modifys) > 0 {
|
||||
@ -44,12 +44,12 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
} else {
|
||||
tempgrids = this.module.configure.GetPackItemByType(items, req.IType)
|
||||
modifys = make([]*pb.DB_UserItemData, 0, len(tempgrids))
|
||||
dels = make([]*pb.DB_UserItemData, 0, len(tempgrids))
|
||||
// tempgrids = this.module.configure.GetPackItemByType(items, req.IType)
|
||||
modifys = make([]*pb.DB_UserItemData, 0, len(items))
|
||||
dels = make([]*pb.DB_UserItemData, 0, len(items))
|
||||
grids = make([]*pb.DB_UserItemData, 0, len(items))
|
||||
nt = time.Now().Unix()
|
||||
for _, v := range tempgrids {
|
||||
for _, v := range items {
|
||||
if v.ETime > 0 && v.ETime < nt { //已经过期
|
||||
dels = append(dels, v)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user