Files
waf-platform/EdgeAdmin/internal/web/actions/default/plans/init.go

53 lines
1.5 KiB
Go

// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build plus
package plans
import (
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
"github.com/TeaOSLab/EdgeAdmin/internal/plus"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ns/users"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/plans/plan"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/plans/userPlans"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(plus.NewHelper(plus.ComponentCodePlan)).
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodePlan)).
Data("teaMenu", "plans").
// 套餐列表
Prefix("/plans").
Data("teaSubMenu", "plans").
Get("", new(IndexAction)).
GetPost("/create", new(CreateAction)).
Post("/sort", new(SortAction)).
// 套餐详情
Prefix("/plans/plan").
Get("", new(plan.IndexAction)).
GetPost("/update", new(plan.UpdateAction)).
Post("/delete", new(plan.DeleteAction)).
// 用户套餐
Prefix("/plans/userPlans").
Data("teaSubMenu", "userPlans").
Get("", new(userPlans.IndexAction)).
GetPost("/createPopup", new(userPlans.CreatePopupAction)).
Post("/delete", new(userPlans.DeleteAction)).
GetPost("/renewPopup", new(userPlans.RenewPopupAction)).
Post("/userAccount", new(userPlans.UserAccountAction)).
// 用户选项
Prefix("/plans/users").
Post("/options", new(users.OptionsAction)).
//
EndAll()
})
}