feat: add private and profile
This commit is contained in:
@@ -92,9 +92,12 @@ func main() {
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(jwt.Middleware)
|
||||
r.Get("/me", authH.Me)
|
||||
r.Post("/profile", authH.UpdateProfile)
|
||||
|
||||
// کیفپول و فروشگاه
|
||||
r.Get("/wallet", ecoH.Wallet)
|
||||
r.Get("/stats", ecoH.Stats)
|
||||
r.Get("/tables/info", ecoH.TablesInfo)
|
||||
r.Get("/shop", ecoH.Shop)
|
||||
r.Post("/shop/buy-card", ecoH.BuyCard)
|
||||
r.Post("/shop/select-card", ecoH.SelectCard)
|
||||
|
||||
@@ -47,6 +47,31 @@ func (g gameSettler) RecordGame(room, playersJSON string, winnerTeam int, kot bo
|
||||
}
|
||||
}
|
||||
|
||||
// RecordHand آمار یک هَندِ پایانیافته را برای کاربر ثبت میکند.
|
||||
func (g gameSettler) RecordHand(userID int64, won, kot, asHakem bool) {
|
||||
g.eco.RecordHand(context.Background(), userID, won, kot, asHakem)
|
||||
}
|
||||
|
||||
// RecordCut آمار بُرِش با حکم را برای کاربر ثبت میکند.
|
||||
func (g gameSettler) RecordCut(userID int64) {
|
||||
g.eco.RecordCut(context.Background(), userID)
|
||||
}
|
||||
|
||||
// RecordGameResult آمار پایان بازی (برد/باخت) را ثبت میکند.
|
||||
func (g gameSettler) RecordGameResult(userID int64, won bool) {
|
||||
g.eco.RecordGameResult(context.Background(), userID, won)
|
||||
}
|
||||
|
||||
// ChargePrivateTable یک میز خصوصیِ رایگان را برای کاربر مصرف میکند.
|
||||
func (g gameSettler) ChargePrivateTable(userID int64) error {
|
||||
return g.eco.ConsumePrivateTable(context.Background(), userID)
|
||||
}
|
||||
|
||||
// PrivateTableInfo باقیماندهی میزهای رایگان و نامحدود بودن را برمیگرداند.
|
||||
func (g gameSettler) PrivateTableInfo(userID int64) (int, bool) {
|
||||
return g.eco.PrivateTableInfo(context.Background(), userID)
|
||||
}
|
||||
|
||||
// TargetHands تعداد هَندِ لازم برای برد بازی در این tier (مثلاً مبتدی=۳).
|
||||
func (g gameSettler) TargetHands(tier string) int {
|
||||
t := g.eco.FindTier(tier)
|
||||
|
||||
Reference in New Issue
Block a user