Files
xiaolajiaoyyds 6f71df4849 Initial open-source release
多平台账号批量注册系统,支持 OpenAI / Grok / Kiro / Gemini 平台的全自动注册。

Features:
- 用户名/密码注册登录(首个用户自动管理员)
- JWT 认证 + bcrypt 密码加密
- 积分系统与多用户管理
- HuggingFace Space 弹性 Worker 节点管理
- Cloudflare Worker 负载均衡
- 实时日志推送(SSE/WebSocket)
- 管理后台(用户管理、系统设置、代理池、卡池)

Tech Stack: Go 1.25 / Gin / GORM / PostgreSQL / Vue 3 / Vite / TailwindCSS
2026-03-22 03:44:42 +08:00

30 lines
1.0 KiB
Go

package model
import "time"
// CreditTransaction 积分交易记录
type CreditTransaction struct {
ID uint `gorm:"primaryKey" json:"id"`
UserID uint `gorm:"not null;index" json:"user_id"`
Amount int `gorm:"not null" json:"amount"` // 正=充值,负=消费
Type string `gorm:"size:30;not null" json:"type"`
Description string `gorm:"size:500;default:''" json:"description"`
TaskID *uint `gorm:"index" json:"task_id"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
User User `gorm:"foreignKey:UserID" json:"-"`
}
// 交易类型常量
const (
TxTypeRecharge = "recharge"
TxTypeConsume = "consume"
TxTypeRefund = "refund"
TxTypeFreeTrial = "free_trial"
TxTypeFreeTrialConsume = "free_trial_consume"
TxTypeFreeTrialRefund = "free_trial_refund"
TxTypeRedeem = "redeem"
TxTypePurchase = "purchase" // New-API 余额购买 credits
TxTypeNewUserBonus = "new_user_bonus" // 新用户赠送积分
)