chore: initial commit of ai site platform

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-07-31 10:31:17 +08:00
commit 4ca82fb58a
203 changed files with 45745 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
package config
import "github.com/zeromicro/go-zero/rest"
type Config struct {
rest.RestConf
DataSource string `json:",optional"`
DryRun bool `json:",optional"`
DevAuth bool `json:",default=true"`
Auth AuthConf `json:",optional"`
SMS SMSConf `json:",optional"`
License LicenseConf `json:",optional"`
Agent AgentConf `json:",optional"`
PublicBaseURL string `json:",optional"`
RateLimitPerMin int `json:",default=180"`
Storage StorageConf `json:",optional"`
DBSync DBSyncConf `json:",optional"`
}
type AuthConf struct {
AccessSecret string `json:",optional"`
AccessExpire int64 `json:",default=86400"` // JWT 会话秒数;登录态时效,与授权到期无关
IssueSecret string `json:",optional"`
// PhoneLoginOnly仅允许手机号登录。默认 false。
// 若 License.Enabled有部署期限控制运行时会忽略本开关允许用户名登录。
PhoneLoginOnly bool `json:",optional"`
// DisableUsernameLoginIfPhoneBound已绑手机禁止用户名登录账号级策略仍可单独禁用
DisableUsernameLoginIfPhoneBound bool `json:",optional"`
// RequirePhoneBound无手机号不可登录。有 License 期限时通常不必开启。
RequirePhoneBound bool `json:",optional"`
}
// LicenseConf 客户机授权:每次续费/延期生成独立签名文件;运行时取目录中最新有效租约。
type LicenseConf struct {
Enabled bool `json:",optional"`
Customer string `json:",optional"`
LeaseDir string `json:",optional"` // 默认 ./data/license/leases租约文件目录
StateDir string `json:",optional"` // 默认 ./data/license/state消费账本与 leases 分离,防只删租约复用)
LeasePath string `json:",optional"` // 兼容旧字段
ControlSecret string `json:",optional"`
SignSecret string `json:",optional"`
SeedNotAfter string `json:",optional"`
GraceDays int `json:",optional"`
Message string `json:",optional"`
NotAfter string `json:",optional"`
// RedeemURL 可选:你们的核销服务根地址。配置后导入延期包必须联网核销 id防删库清盘后复用旧包
// POST {RedeemURL}/v1/license/redeem Body: {"id","customer","action":"redeem"}
RedeemURL string `json:",optional"`
}
// SMSConf 短信验证码。Provider=dev 时不真实发信,验证码写日志并可在接口返回 debug_code。
type SMSConf struct {
Provider string `json:",default=dev"` // dev | off
CodeTTLSeconds int `json:",default=300"`
ResendSeconds int `json:",default=60"`
DevFixedCode string `json:",optional"` // 开发可固定如 123456
}
type AgentConf struct {
CapsuleSecret string `json:",optional"`
RegisterSecret string `json:",optional"` // 宿主自注册防刷;空则回退 IssueSecret/AccessSecret
}
type StorageConf struct {
Driver string `json:",default=local"`
LocalRoot string `json:",default=./data/uploads"`
PublicBase string `json:",optional"` // 默认 PublicBaseURL + /api/v1/storage
}
type DBSyncConf struct {
Enabled bool `json:",default=true"`
DataDir string `json:",default=./data/dbsync"` // 通道/冲突队列 JSON
}