19 lines
860 B
Go
19 lines
860 B
Go
package entity
|
||
|
||
import "github.com/gogf/gf/v2/os/gtime"
|
||
|
||
// UserToolQuota 用户在某工具上的付费额度余额(次数包买断制,按工具绑定)。
|
||
//
|
||
// 一个用户对一个工具只有一行(UNIQUE(user_id, tool_key)),重复购买同工具时
|
||
// 次数累加、有效期顺延(base = max(now, 当前到期时间),expire = base + valid_days)。
|
||
type UserToolQuota struct {
|
||
Id int64 `json:"id"`
|
||
UserId int64 `json:"user_id"`
|
||
ToolKey string `json:"tool_key"`
|
||
TimesLeft int `json:"times_left"` // 剩余次数
|
||
TotalBought int `json:"total_bought"` // 累计购买次数(用于对账与展示)
|
||
ExpireAt *gtime.Time `json:"expire_at"` // 到期时间,NULL 视为已过期
|
||
CreatedAt *gtime.Time `json:"created_at"`
|
||
UpdatedAt *gtime.Time `json:"updated_at"`
|
||
}
|