feat: add coin for private table
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user