Files
qitongxue-api/internal/model/entity/entity_user_quota_usage.go
2026-09-17 17:38:45 +08:00

20 lines
905 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package entity
import "github.com/gogf/gf/v2/os/gtime"
// UserQuotaUsage 用户在某工具上「当前周期」的免费/会员额度用量。
//
// 周期为滚动窗口:首次使用时把 PeriodStart 定为当时时间,
// PeriodEnd = PeriodStart + 周期天数now >= PeriodEnd 时归零并开启新周期。
// 之所以不用自然周/自然月,是为了让「后台改周期天数」立刻按新长度重算,不必等到下个自然周期。
type UserQuotaUsage struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
ToolKey string `json:"tool_key"`
PeriodStart *gtime.Time `json:"period_start"`
PeriodEnd *gtime.Time `json:"period_end"`
FreeUsed int `json:"free_used"` // 本周期已用免费额度
MemberUsed int `json:"member_used"` // 本周期已用会员额度
UpdatedAt *gtime.Time `json:"updated_at"`
}