forked from QuantumNous/new-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckin_setting.go
More file actions
37 lines (30 loc) · 1.02 KB
/
Copy pathcheckin_setting.go
File metadata and controls
37 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package operation_setting
import "github.com/QuantumNous/new-api/setting/config"
// CheckinSetting 签到功能配置
type CheckinSetting struct {
Enabled bool `json:"enabled"` // 是否启用签到功能
MinQuota int `json:"min_quota"` // 签到最小额度奖励
MaxQuota int `json:"max_quota"` // 签到最大额度奖励
}
// 默认配置
var checkinSetting = CheckinSetting{
Enabled: false, // 默认关闭
MinQuota: 1000, // 默认最小额度 1000 (约 0.002 USD)
MaxQuota: 10000, // 默认最大额度 10000 (约 0.02 USD)
}
func init() {
// 注册到全局配置管理器
config.GlobalConfig.Register("checkin_setting", &checkinSetting)
}
// GetCheckinSetting 获取签到配置
func GetCheckinSetting() *CheckinSetting {
return &checkinSetting
}
// IsCheckinEnabled 是否启用签到功能
func IsCheckinEnabled() bool {
return checkinSetting.Enabled
}
// GetCheckinQuotaRange 获取签到额度范围
func GetCheckinQuotaRange() (min, max int) {
return checkinSetting.MinQuota, checkinSetting.MaxQuota
}