修改物品出售的消息推送处理
This commit is contained in:
parent
02752df2cf
commit
052f3479a6
@ -35,7 +35,7 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
|
|||||||
code = pb.ErrorCode_ConfigurationException
|
code = pb.ErrorCode_ConfigurationException
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Amount < item.Amount {
|
if req.Amount > item.Amount {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount)
|
this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount)
|
||||||
return
|
return
|
||||||
@ -49,17 +49,20 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
item.Amount = item.Amount - req.Amount
|
item.Amount = item.Amount - req.Amount
|
||||||
if item.Amount == 0 {
|
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||||
if err = this.module.modelItems.DelUserPack(session.GetUserId(), item.GridId); err != nil {
|
return
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err = this.module.modelItems.UpdateUserPack(session.GetUserId(), item); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// if item.Amount == 0 {
|
||||||
|
// if err = this.module.modelItems.DelUserPack(session.GetUserId(), item.GridId); err != nil {
|
||||||
|
// code = pb.ErrorCode_DBError
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if err = this.module.modelItems.UpdateUserPack(session.GetUserId(), item); err != nil {
|
||||||
|
// code = pb.ErrorCode_DBError
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{GridId: req.GridId, Amount: req.Amount, Issucc: true})
|
session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{GridId: req.GridId, Amount: req.Amount, Issucc: true})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user