feat: 初始化 ChatGPT Team 管理机器人
核心功能: - 实现基于 Telegram Inline Button 交互的后台面板与用户端 - 支持通过账密登录和 RT (Refresh Token) 方式添加 ChatGPT Team 账号 - 支持管理、拉取和删除待处理邀请,支持一键清空多余邀请 - 支持按剩余容量自动生成邀请兑换码,支持分页查看与一键清空未使用兑换码 - 随机邀请功能:成功拉人后自动核销兑换码 - 定时检测 Token 状态,实现自动续订/刷新并拦截封禁账号 (处理 401/402 错误) 系统与配置: - 使用 PostgreSQL 数据库管理账号、邀请和兑换记录 - 支持在端内动态添加、移除管理员 - 完善 Docker 部署配置与 .gitignore 规则
This commit is contained in:
65
internal/model/model.go
Normal file
65
internal/model/model.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// GptAccount represents a ChatGPT Team account stored in the database.
|
||||
type GptAccount struct {
|
||||
ID int64 `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Token string `json:"token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
UserCount int `json:"user_count"`
|
||||
InviteCount int `json:"invite_count"`
|
||||
ChatgptAccountID string `json:"chatgpt_account_id"`
|
||||
OaiDeviceID string `json:"oai_device_id"`
|
||||
ExpireAt string `json:"expire_at"`
|
||||
IsOpen bool `json:"is_open"`
|
||||
IsBanned bool `json:"is_banned"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// RedemptionCode represents a redemption code stored in the database.
|
||||
type RedemptionCode struct {
|
||||
ID int64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
IsRedeemed bool `json:"is_redeemed"`
|
||||
RedeemedAt *string `json:"redeemed_at"`
|
||||
RedeemedBy *string `json:"redeemed_by"`
|
||||
AccountEmail string `json:"account_email"`
|
||||
Channel string `json:"channel"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// TeamAccountInfo is the data returned from the ChatGPT accounts/check API.
|
||||
type TeamAccountInfo struct {
|
||||
AccountID string `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
PlanType string `json:"plan_type"`
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
HasActiveSubscription bool `json:"has_active_subscription"`
|
||||
}
|
||||
|
||||
// ChatGPTUser represents a team member returned from the users API.
|
||||
type ChatGPTUser struct {
|
||||
ID string `json:"id"`
|
||||
AccountUserID string `json:"account_user_id"`
|
||||
Email string `json:"email"`
|
||||
Role string `json:"role"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ChatGPTInvite represents a pending invite returned from the invites API.
|
||||
type ChatGPTInvite struct {
|
||||
ID string `json:"id"`
|
||||
EmailAddress string `json:"email_address"`
|
||||
Role string `json:"role"`
|
||||
}
|
||||
|
||||
// TelegramAdmin represents a Telegram admin user stored in the database.
|
||||
type TelegramAdmin struct {
|
||||
ID int64 `json:"id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
AddedBy int64 `json:"added_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user