competitivewaterpool_handler.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package handler
  2. import (
  3. "context"
  4. "bet24.com/servers/micros/waterpool/handler/bacwaterpool"
  5. "bet24.com/servers/micros/waterpool/handler/competitivewaterpool"
  6. pb "bet24.com/servers/micros/waterpool/proto"
  7. )
  8. func (h *WaterPool) GetInventoryType(ctx context.Context, req *pb.Inventory_req, rsp *pb.Inventory_resp) error {
  9. rsp.InventoryType = competitivewaterpool.GetInventoryType(req.GameID, req.RoomName)
  10. return nil
  11. }
  12. func (h *WaterPool) ReduceInventoryValue(ctx context.Context, req *pb.Inventory_req, rsp *pb.Inventory_resp) error {
  13. competitivewaterpool.ReduceInventoryValue(req.GameID, req.RoomName, req.ReduceValue, req.RoomType)
  14. return nil
  15. }
  16. func (h *WaterPool) GetInventoryList(ctx context.Context, req *pb.Inventory_req, rsp *pb.Inventory_resp) error {
  17. rsp.InventoryList = competitivewaterpool.GetInventoryList(req.GameID)
  18. return nil
  19. }
  20. func (h *WaterPool) UpdateInventoryList(ctx context.Context, req *pb.Inventory_req, rsp *pb.Inventory_resp) error {
  21. if req.GameID != 0 {
  22. bacwaterpool.UpdatePool(req.GameID, req.InventoryValue, req.RoomName)
  23. }
  24. rsp.InventoryList = competitivewaterpool.UpdateInventoryList(req.GameID, req.RoomName, req.RoomType, req.InventoryValue,
  25. req.MinInventoryValue, req.MaxInventoryValue, req.MaxControlRate)
  26. return nil
  27. }
  28. func (h *WaterPool) GetInventoryValue(ctx context.Context, req *pb.Inventory_req, rsp *pb.Inventory_resp) error {
  29. if req.RoomType == pb.RoomType_Hundred {
  30. rsp.InventoryValue = bacwaterpool.GetWaterPoolValue(req.GameID, req.RoomName)
  31. } else {
  32. rsp.InventoryValue = competitivewaterpool.GetInventoryValue(req.GameID, req.RoomType, req.RoomName)
  33. }
  34. return nil
  35. }