45 lines
911 B
Go
45 lines
911 B
Go
package apps
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeUser/internal/web/actions/actionutils"
|
|
"github.com/iwind/TeaGo/actions"
|
|
)
|
|
|
|
type DomainsCreatePopupAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *DomainsCreatePopupAction) Init() {
|
|
this.Nav("", "", "")
|
|
}
|
|
|
|
func (this *DomainsCreatePopupAction) RunGet(params struct {
|
|
AppId int64
|
|
}) {
|
|
app, err := findAppMap(this.Parent(), params.AppId)
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
this.Data["app"] = app
|
|
this.Show()
|
|
}
|
|
|
|
func (this *DomainsCreatePopupAction) RunPost(params struct {
|
|
AppId int64
|
|
Domain string
|
|
|
|
Must *actions.Must
|
|
CSRF *actionutils.CSRF
|
|
}) {
|
|
params.Must.Field("appId", params.AppId).Gt(0, "璇烽€夋嫨搴旂敤")
|
|
params.Must.Field("domain", params.Domain).Require("请输入域名")
|
|
|
|
err := createDomain(this.Parent(), params.AppId, params.Domain)
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
this.Success()
|
|
}
|