feat: add coin for private table

This commit is contained in:
2026-07-04 12:45:07 +03:30
parent 413fca68cc
commit 63716576ca
6 changed files with 104 additions and 8 deletions
+18
View File
@@ -87,6 +87,24 @@ func (g gameSettler) ChargeTicket(userID int64) error {
return g.eco.Adjust(context.Background(), userID, economy.CurrencyTicket, -1, "reshuffle", "")
}
// ChargeCoins سکهٔ شرطِ میزِ خصوصی را کسر می‌کند (خطا اگر موجودی کافی نباشد).
func (g gameSettler) ChargeCoins(userID int64, amount int64, ref string) error {
if amount <= 0 {
return nil
}
return g.eco.Adjust(context.Background(), userID, economy.CurrencyCoin, -amount, "private_stake", ref)
}
// AwardCoins سهمِ برنده از potِ میزِ خصوصی را اضافه می‌کند.
func (g gameSettler) AwardCoins(userID int64, amount int64, ref string) {
if amount <= 0 {
return
}
if err := g.eco.Adjust(context.Background(), userID, economy.CurrencyCoin, amount, "private_pot", ref); err != nil {
slog.Error("award coins", "user", userID, "err", err)
}
}
// ChargePrivateTable یک میز خصوصیِ رایگان را برای کاربر مصرف می‌کند.
func (g gameSettler) ChargePrivateTable(userID int64) error {
return g.eco.ConsumePrivateTable(context.Background(), userID)