|
|
|
|
@ -113,31 +113,35 @@ func PlaceBet(c *gin.Context) { |
|
|
|
|
|
|
|
|
|
provider := call.GetConfigGameProvider(common.ProviderJiLi2) |
|
|
|
|
now := time.Now().Unix() |
|
|
|
|
betReq := &base.BetReq{ |
|
|
|
|
UID: uid, |
|
|
|
|
CurrencyType: common.CurrencyINR, |
|
|
|
|
BetAmount: int64(req.Bet * common.DecimalDigits), |
|
|
|
|
TurnOver: int64(req.Bet * common.DecimalDigits), |
|
|
|
|
SettleAmount: int64(req.Award * common.DecimalDigits), |
|
|
|
|
SessionType: common.SessionTypeSettle, |
|
|
|
|
GameID: GetGameID(common.ProviderJiLi2, req.GameID), |
|
|
|
|
GameName: req.GameID, |
|
|
|
|
Provider: provider, |
|
|
|
|
BetID: req.BetID, |
|
|
|
|
SessionID: req.SessionID, |
|
|
|
|
Time: now, |
|
|
|
|
} |
|
|
|
|
betResp := base.SessionBet(betReq) |
|
|
|
|
if betResp.Code != base.CodeOk { |
|
|
|
|
resp.Code = ErrCodeInternalError |
|
|
|
|
if betResp.Code == base.CodeAccepted { |
|
|
|
|
if req.Bet != 0 || req.Award != 0 { |
|
|
|
|
betReq := &base.BetReq{ |
|
|
|
|
UID: uid, |
|
|
|
|
CurrencyType: common.CurrencyINR, |
|
|
|
|
BetAmount: int64(req.Bet * common.DecimalDigits), |
|
|
|
|
TurnOver: int64(req.Bet * common.DecimalDigits), |
|
|
|
|
SettleAmount: int64(req.Award * common.DecimalDigits), |
|
|
|
|
SessionType: common.SessionTypeSettle, |
|
|
|
|
GameID: GetGameID(common.ProviderPG2, req.GameID), |
|
|
|
|
GameName: req.GameID, |
|
|
|
|
Provider: provider, |
|
|
|
|
BetID: req.BetID, |
|
|
|
|
SessionID: req.SessionID, |
|
|
|
|
Time: now, |
|
|
|
|
} |
|
|
|
|
betResp := base.SessionBet(betReq) |
|
|
|
|
if betResp.Code != base.CodeOk { |
|
|
|
|
resp.Code = ErrCodeInternalError |
|
|
|
|
} else if betResp.Code == base.CodeNotEnoughAmount { |
|
|
|
|
resp.Code = ErrCodeInsufficientBal |
|
|
|
|
if betResp.Code == base.CodeAccepted { |
|
|
|
|
resp.Code = ErrCodeInternalError |
|
|
|
|
} else if betResp.Code == base.CodeNotEnoughAmount { |
|
|
|
|
resp.Code = ErrCodeInsufficientBal |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2) |
|
|
|
|
} else { |
|
|
|
|
resp.Data.Balance = util.Decimal(float64(call.GetUserCurrency(uid, common.CurrencyINR))/common.DecimalDigits, 2) |
|
|
|
|
} |
|
|
|
|
resp.Data.Balance = util.Decimal(float64(betResp.Balance)/common.DecimalDigits, 2) |
|
|
|
|
|
|
|
|
|
a.Data = resp |
|
|
|
|
} |
|
|
|
|
|