@@ -17,6 +17,7 @@ type LicensePlan string
1717const (
1818 PlanFree LicensePlan = "free"
1919 PlanStarter LicensePlan = "starter"
20+ PlanEnjoy LicensePlan = "enjoy"
2021 PlanCreator LicensePlan = "creator"
2122 PlanPro LicensePlan = "pro"
2223 PlanEnterprise LicensePlan = "enterprise"
@@ -42,6 +43,17 @@ type License struct {
4243 MaxIPs int `json:"max_ips"` // 最大 IP 数,默认 3
4344 CurrentDevices int `json:"current_devices"` // 当前设备数
4445 CurrentIPs int `json:"current_ips"` // 当前 IP 数
46+
47+ // Sync 功能
48+ SyncEnabled bool `json:"sync_enabled"`
49+ SyncQuotaMB int `json:"sync_quota"`
50+
51+ // Publish 功能
52+ PublishEnabled bool `json:"publish_enabled"`
53+ MaxSites int `json:"max_sites"`
54+ MaxStorageMB int `json:"max_storage"`
55+ CustomDomain bool `json:"custom_domain"`
56+ CustomSubDomain bool `json:"custom_sub_domain"` // 二级域名
4557}
4658
4759// MarshalEditor 实现 editor.Editable 接口
@@ -60,11 +72,37 @@ func (l *License) MarshalEditor() ([]byte, error) {
6072 }, map [string ]string {
6173 "free" : "Free" ,
6274 "starter" : "Starter" ,
75+ "enjoy" : "Enjoy" ,
6376 "creator" : "Creator" ,
6477 "pro" : "Pro" ,
6578 "enterprise" : "Enterprise" ,
6679 }),
6780 },
81+ editor.Field {
82+ View : editor .Checkbox ("Activated" , l , map [string ]string {
83+ "label" : "Activated" ,
84+ }, map [string ]string {
85+ "true" : "Yes" ,
86+ }),
87+ },
88+ editor.Field {
89+ View : editor .Input ("IssueDate" , l , map [string ]string {
90+ "label" : "Issue Date" ,
91+ "type" : "number" ,
92+ }),
93+ },
94+ editor.Field {
95+ View : editor .Input ("ExpiryDate" , l , map [string ]string {
96+ "label" : "Expiry Date" ,
97+ "type" : "number" ,
98+ }),
99+ },
100+ editor.Field {
101+ View : editor .Input ("ActivatedAt" , l , map [string ]string {
102+ "label" : "Activated At" ,
103+ "type" : "number" ,
104+ }),
105+ },
68106 editor.Field {
69107 View : editor .Input ("MaxDevices" , l , map [string ]string {
70108 "label" : "Max Devices" ,
@@ -78,8 +116,47 @@ func (l *License) MarshalEditor() ([]byte, error) {
78116 }),
79117 },
80118 editor.Field {
81- View : editor .Checkbox ("Activated" , l , map [string ]string {
82- "label" : "Activated" ,
119+ View : editor .Checkbox ("SyncEnabled" , l , map [string ]string {
120+ "label" : "Sync Enabled" ,
121+ }, map [string ]string {
122+ "true" : "Yes" ,
123+ }),
124+ },
125+ editor.Field {
126+ View : editor .Input ("SyncQuotaMB" , l , map [string ]string {
127+ "label" : "Sync Quota MB" ,
128+ "type" : "number" ,
129+ }),
130+ },
131+ editor.Field {
132+ View : editor .Checkbox ("PublishEnabled" , l , map [string ]string {
133+ "label" : "Publish Enabled" ,
134+ }, map [string ]string {
135+ "true" : "Yes" ,
136+ }),
137+ },
138+ editor.Field {
139+ View : editor .Input ("MaxSites" , l , map [string ]string {
140+ "label" : "Max Sites" ,
141+ "type" : "number" ,
142+ }),
143+ },
144+ editor.Field {
145+ View : editor .Input ("MaxStorageMB" , l , map [string ]string {
146+ "label" : "Max Storage MB" ,
147+ "type" : "number" ,
148+ }),
149+ },
150+ editor.Field {
151+ View : editor .Checkbox ("CustomSubDomain" , l , map [string ]string {
152+ "label" : "Custom Sub Domain" ,
153+ }, map [string ]string {
154+ "true" : "Yes" ,
155+ }),
156+ },
157+ editor.Field {
158+ View : editor .Checkbox ("CustomDomain" , l , map [string ]string {
159+ "label" : "Custom Domain" ,
83160 }, map [string ]string {
84161 "true" : "Yes" ,
85162 }),
@@ -224,10 +301,11 @@ type LicenseFeatures struct {
224301 SyncQuotaMB int `json:"sync_quota"`
225302
226303 // Publish 功能
227- PublishEnabled bool `json:"publish_enabled"`
228- MaxSites int `json:"max_sites"`
229- MaxStorageMB int `json:"max_storage"`
230- CustomDomain bool `json:"custom_domain"`
304+ PublishEnabled bool `json:"publish_enabled"`
305+ MaxSites int `json:"max_sites"`
306+ MaxStorageMB int `json:"max_storage"`
307+ CustomDomain bool `json:"custom_domain"`
308+ CustomSubDomain bool `json:"custom_sub_domain"` // 二级域名
231309
232310 // 有效期(天数)
233311 ValidityDays int `json:"validity_days"`
@@ -238,63 +316,86 @@ func GetPlanFeatures(plan LicensePlan) *LicenseFeatures {
238316 switch plan {
239317 case PlanFree :
240318 return & LicenseFeatures {
241- MaxDevices : 3 ,
242- MaxIPs : 3 ,
243- SyncEnabled : true ,
244- SyncQuotaMB : 500 ,
245- PublishEnabled : true ,
246- MaxSites : 3 ,
247- MaxStorageMB : 500 ,
248- CustomDomain : false ,
249- ValidityDays : 30 , // Free Plan: 30 天有效期
319+ MaxDevices : 3 ,
320+ MaxIPs : 3 ,
321+ SyncEnabled : true ,
322+ SyncQuotaMB : 500 ,
323+ PublishEnabled : true ,
324+ MaxSites : 3 ,
325+ MaxStorageMB : 10240 , // 10G
326+ CustomSubDomain : true ,
327+ CustomDomain : true ,
328+ ValidityDays : 3 , // ✅ 3 天
250329 }
330+
251331 case PlanStarter :
252332 return & LicenseFeatures {
253- MaxDevices : 3 ,
254- MaxIPs : 3 ,
255- SyncEnabled : true ,
256- SyncQuotaMB : 500 ,
257- PublishEnabled : true ,
258- MaxSites : 3 ,
259- MaxStorageMB : 1024 ,
260- CustomDomain : false ,
261- ValidityDays : 365 , // Starter Plan: 365 天有效期
333+ MaxDevices : 3 ,
334+ MaxIPs : 3 ,
335+ SyncEnabled : true ,
336+ SyncQuotaMB : 500 ,
337+ PublishEnabled : false , // ❌ 不支持发布
338+ MaxSites : 0 ,
339+ MaxStorageMB : 1024 , // 1G
340+ CustomSubDomain : false ,
341+ CustomDomain : false ,
342+ ValidityDays : 365 ,
343+ }
344+
345+ case PlanEnjoy : // ✅ 畅享版
346+ return & LicenseFeatures {
347+ MaxDevices : 5 ,
348+ MaxIPs : 5 ,
349+ SyncEnabled : true ,
350+ SyncQuotaMB : 2048 ,
351+ PublishEnabled : false ,
352+ MaxSites : 0 ,
353+ MaxStorageMB : 10240 , // 10G
354+ CustomSubDomain : false ,
355+ CustomDomain : false ,
356+ ValidityDays : 365 ,
262357 }
358+
263359 case PlanCreator :
264360 return & LicenseFeatures {
265- MaxDevices : 5 ,
266- MaxIPs : 5 ,
267- SyncEnabled : true ,
268- SyncQuotaMB : 2048 ,
269- PublishEnabled : true ,
270- MaxSites : 10 ,
271- MaxStorageMB : 5120 ,
272- CustomDomain : true ,
273- ValidityDays : 365 , // Creator Plan: 365 天有效期
361+ MaxDevices : 5 ,
362+ MaxIPs : 5 ,
363+ SyncEnabled : true ,
364+ SyncQuotaMB : 2048 ,
365+ PublishEnabled : true ,
366+ MaxSites : 10 ,
367+ MaxStorageMB : 10240 , // 10G
368+ CustomSubDomain : true , // ✅ 二级域名
369+ CustomDomain : false ,
370+ ValidityDays : 365 ,
274371 }
372+
275373 case PlanPro :
276374 return & LicenseFeatures {
277- MaxDevices : 10 ,
278- MaxIPs : 10 ,
279- SyncEnabled : true ,
280- SyncQuotaMB : 10240 ,
281- PublishEnabled : true ,
282- MaxSites : 50 ,
283- MaxStorageMB : 20480 ,
284- CustomDomain : true ,
285- ValidityDays : 365 , // Pro Plan: 365 天有效期
375+ MaxDevices : 10 ,
376+ MaxIPs : 10 ,
377+ SyncEnabled : true ,
378+ SyncQuotaMB : 10240 ,
379+ PublishEnabled : true ,
380+ MaxSites : 50 ,
381+ MaxStorageMB : 10240 , // 10G
382+ CustomSubDomain : true ,
383+ CustomDomain : true , // ✅ 独立域名
384+ ValidityDays : 365 ,
286385 }
386+
287387 case PlanEnterprise :
288388 return & LicenseFeatures {
289- MaxDevices : - 1 , // 无限制
290- MaxIPs : - 1 , // 无限制
291- SyncEnabled : true ,
292- SyncQuotaMB : 51200 ,
293- PublishEnabled : true ,
294- MaxSites : - 1 , // 无限制
295- MaxStorageMB : 102400 ,
296- CustomDomain : true ,
297- ValidityDays : 365 , // Enterprise Plan: 365 天有效期
389+ MaxDevices : 100 ,
390+ MaxIPs : 100 ,
391+ SyncEnabled : true ,
392+ SyncQuotaMB : 51200 ,
393+ PublishEnabled : true ,
394+ MaxSites : 100 ,
395+ MaxStorageMB : 102400 , // 100G
396+ CustomSubDomain : true ,
397+ CustomDomain : true ,
398+ ValidityDays : 365 * 100 , // ✅ 100 年
298399 }
299400 default :
300401 return & LicenseFeatures {
0 commit comments