From ccc50ed6ee7e7418b484f8ef5c15d7055e33ccd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 14 Dec 2023 01:20:32 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/cert_controller.go | 25 +- app/http/controllers/setting_controller.go | 24 +- app/http/controllers/user_controller.go | 13 +- app/http/controllers/website_controller.go | 13 +- app/http/requests/setting/update.go | 2 +- app/http/responses/cert/cert_list.go | 8 - app/http/responses/cert/dns_list.go | 8 - app/http/responses/cert/user_list.go | 8 - app/http/responses/setting/list.go | 12 - app/http/responses/user/info.go | 8 - app/http/responses/website/list.go | 8 - docs/docs.go | 301 +++++---------------- docs/swagger.json | 301 +++++---------------- docs/swagger.yaml | 185 ++++--------- 14 files changed, 223 insertions(+), 693 deletions(-) delete mode 100644 app/http/responses/cert/cert_list.go delete mode 100644 app/http/responses/cert/dns_list.go delete mode 100644 app/http/responses/cert/user_list.go delete mode 100644 app/http/responses/setting/list.go delete mode 100644 app/http/responses/user/info.go delete mode 100644 app/http/responses/website/list.go diff --git a/app/http/controllers/cert_controller.go b/app/http/controllers/cert_controller.go index abaf4036..7945087e 100644 --- a/app/http/controllers/cert_controller.go +++ b/app/http/controllers/cert_controller.go @@ -6,7 +6,6 @@ import ( requests "panel/app/http/requests/cert" commonrequests "panel/app/http/requests/common" - responses "panel/app/http/responses/cert" "panel/app/internal" "panel/app/internal/services" "panel/app/models" @@ -123,7 +122,7 @@ func (r *CertController) Algorithms(ctx http.Context) http.Response { // @Produce json // @Security BearerToken // @Param data body commonrequests.Paginate true "request" -// @Success 200 {object} SuccessResponse{data=responses.CertList} +// @Success 200 {object} SuccessResponse // @Router /panel/cert/users [get] func (r *CertController) UserList(ctx http.Context) http.Response { var paginateRequest commonrequests.Paginate @@ -142,9 +141,9 @@ func (r *CertController) UserList(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, responses.UserList{ - Total: total, - Items: users, + return Success(ctx, http.Json{ + "total": total, + "items": users, }) } @@ -275,7 +274,7 @@ func (r *CertController) UserDestroy(ctx http.Context) http.Response { // @Produce json // @Security BearerToken // @Param data body commonrequests.Paginate true "request" -// @Success 200 {object} SuccessResponse{data=responses.DNSList} +// @Success 200 {object} SuccessResponse // @Router /panel/cert/dns [get] func (r *CertController) DNSList(ctx http.Context) http.Response { var paginateRequest commonrequests.Paginate @@ -294,9 +293,9 @@ func (r *CertController) DNSList(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, responses.DNSList{ - Total: total, - Items: dns, + return Success(ctx, http.Json{ + "total": total, + "items": dns, }) } @@ -427,7 +426,7 @@ func (r *CertController) DNSDestroy(ctx http.Context) http.Response { // @Produce json // @Security BearerToken // @Param data body commonrequests.Paginate true "request" -// @Success 200 {object} SuccessResponse{data=responses.CertList} +// @Success 200 {object} SuccessResponse // @Router /panel/cert/certs [get] func (r *CertController) CertList(ctx http.Context) http.Response { var paginateRequest commonrequests.Paginate @@ -446,9 +445,9 @@ func (r *CertController) CertList(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, responses.CertList{ - Total: total, - Items: certs, + return Success(ctx, http.Json{ + "total": total, + "items": certs, }) } diff --git a/app/http/controllers/setting_controller.go b/app/http/controllers/setting_controller.go index b2cca08e..341f5827 100644 --- a/app/http/controllers/setting_controller.go +++ b/app/http/controllers/setting_controller.go @@ -6,7 +6,6 @@ import ( "github.com/spf13/cast" requests "panel/app/http/requests/setting" - responses "panel/app/http/responses/setting" "panel/app/internal" "panel/app/internal/services" "panel/app/models" @@ -30,7 +29,7 @@ func NewSettingController() *SettingController { // @Tags 面板设置 // @Produce json // @Security BearerToken -// @Success 200 {object} SuccessResponse{data=responses.Settings} +// @Success 200 {object} SuccessResponse // @Router /panel/setting/list [get] func (r *SettingController) List(ctx http.Context) http.Response { var settings []models.Setting @@ -42,12 +41,6 @@ func (r *SettingController) List(ctx http.Context) http.Response { return ErrorSystem(ctx) } - var result responses.Settings - result.Name = r.setting.Get(models.SettingKeyName) - result.Entrance = facades.Config().GetString("http.entrance") - result.WebsitePath = r.setting.Get(models.SettingKeyWebsitePath) - result.BackupPath = r.setting.Get(models.SettingKeyBackupPath) - var user models.User err = facades.Auth().User(ctx, &user) if err != nil { @@ -56,10 +49,8 @@ func (r *SettingController) List(ctx http.Context) http.Response { }).Info("获取用户信息失败") return ErrorSystem(ctx) } - result.Username = user.Username - result.Email = user.Email - result.Port, err = tools.Exec(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) + port, err := tools.Exec(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) if err != nil { facades.Log().Request(ctx.Request()).Tags("面板", "面板设置").With(map[string]any{ "error": err.Error(), @@ -67,7 +58,16 @@ func (r *SettingController) List(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, result) + return Success(ctx, http.Json{ + "name": r.setting.Get(models.SettingKeyName), + "entrance": facades.Config().GetString("http.entrance"), + "website_path": r.setting.Get(models.SettingKeyWebsitePath), + "backup_path": r.setting.Get(models.SettingKeyBackupPath), + "user_name": user.Username, + "password": "", + "email": user.Email, + "port": port, + }) } // Update diff --git a/app/http/controllers/user_controller.go b/app/http/controllers/user_controller.go index e9c1599c..dd23961e 100644 --- a/app/http/controllers/user_controller.go +++ b/app/http/controllers/user_controller.go @@ -5,7 +5,6 @@ import ( "github.com/goravel/framework/facades" "panel/app/http/requests/user" - responses "panel/app/http/responses/user" "panel/app/models" ) @@ -81,7 +80,7 @@ func (r *UserController) Login(ctx http.Context) http.Response { // @Tags 用户鉴权 // @Produce json // @Security BearerToken -// @Success 200 {object} SuccessResponse{data=responses.Info} +// @Success 200 {object} SuccessResponse // @Router /panel/user/info [get] func (r *UserController) Info(ctx http.Context) http.Response { var user models.User @@ -93,10 +92,10 @@ func (r *UserController) Info(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, responses.Info{ - ID: user.ID, - Role: []string{"admin"}, - Username: user.Username, - Email: user.Email, + return Success(ctx, http.Json{ + "id": user.ID, + "role": []string{"admin"}, + "username": user.Username, + "email": user.Email, }) } diff --git a/app/http/controllers/website_controller.go b/app/http/controllers/website_controller.go index 6d672ac7..6f873d48 100644 --- a/app/http/controllers/website_controller.go +++ b/app/http/controllers/website_controller.go @@ -10,7 +10,6 @@ import ( commonrequests "panel/app/http/requests/common" requests "panel/app/http/requests/website" - responses "panel/app/http/responses/website" "panel/app/internal" "panel/app/internal/services" "panel/app/models" @@ -39,7 +38,7 @@ func NewWebsiteController() *WebsiteController { // @Produce json // @Security BearerToken // @Param data body commonrequests.Paginate true "request" -// @Success 200 {object} SuccessResponse{data=responses.List} +// @Success 200 {object} SuccessResponse // @Router /panel/websites [get] func (r *WebsiteController) List(ctx http.Context) http.Response { var paginateRequest commonrequests.Paginate @@ -56,9 +55,9 @@ func (r *WebsiteController) List(ctx http.Context) http.Response { return ErrorSystem(ctx) } - return Success(ctx, responses.List{ - Total: total, - Items: websites, + return Success(ctx, http.Json{ + "total": total, + "items": websites, }) } @@ -206,7 +205,7 @@ func (r *WebsiteController) SaveDefaultConfig(ctx http.Context) http.Response { // @Produce json // @Security BearerToken // @Param id path int true "网站 ID" -// @Success 200 {object} SuccessResponse{data=services.PanelWebsite} +// @Success 200 {object} SuccessResponse{data=internal.PanelWebsite} // @Router /panel/websites/{id}/config [get] func (r *WebsiteController) GetConfig(ctx http.Context) http.Response { var idRequest requests.ID @@ -329,7 +328,7 @@ func (r *WebsiteController) UpdateRemark(ctx http.Context) http.Response { // @Produce json // @Security BearerToken // @Param data body commonrequests.Paginate true "request" -// @Success 200 {object} SuccessResponse{data=[]services.BackupFile} +// @Success 200 {object} SuccessResponse{data=[]internal.BackupFile} // @Router /panel/website/backupList [get] func (r *WebsiteController) BackupList(ctx http.Context) http.Response { var paginateRequest commonrequests.Paginate diff --git a/app/http/requests/setting/update.go b/app/http/requests/setting/update.go index a15c823d..0a41ef6c 100644 --- a/app/http/requests/setting/update.go +++ b/app/http/requests/setting/update.go @@ -28,7 +28,7 @@ func (r *Update) Rules(ctx http.Context) map[string]string { "website_path": "required|string:2,255", "entrance": `required|regex:^/(\w+)?$|not_in:/api`, "username": "required|string:2,20", - "email": "required|email", + "email": "email", "password": "string:8,255", } } diff --git a/app/http/responses/cert/cert_list.go b/app/http/responses/cert/cert_list.go deleted file mode 100644 index 3bbbcc27..00000000 --- a/app/http/responses/cert/cert_list.go +++ /dev/null @@ -1,8 +0,0 @@ -package responses - -import "panel/app/models" - -type CertList struct { - Total int64 `json:"total"` - Items []models.Cert `json:"items"` -} diff --git a/app/http/responses/cert/dns_list.go b/app/http/responses/cert/dns_list.go deleted file mode 100644 index 9440b205..00000000 --- a/app/http/responses/cert/dns_list.go +++ /dev/null @@ -1,8 +0,0 @@ -package responses - -import "panel/app/models" - -type DNSList struct { - Total int64 `json:"total"` - Items []models.CertDNS `json:"items"` -} diff --git a/app/http/responses/cert/user_list.go b/app/http/responses/cert/user_list.go deleted file mode 100644 index 460d8cff..00000000 --- a/app/http/responses/cert/user_list.go +++ /dev/null @@ -1,8 +0,0 @@ -package responses - -import "panel/app/models" - -type UserList struct { - Total int64 `json:"total"` - Items []models.CertUser `json:"items"` -} diff --git a/app/http/responses/setting/list.go b/app/http/responses/setting/list.go deleted file mode 100644 index e7bdc37f..00000000 --- a/app/http/responses/setting/list.go +++ /dev/null @@ -1,12 +0,0 @@ -package responses - -type Settings struct { - Name string `json:"name"` - Username string `json:"username"` - Password string `json:"password"` - Email string `json:"email"` - Port string `json:"port"` - Entrance string `json:"entrance"` - WebsitePath string `json:"website_path"` - BackupPath string `json:"backup_path"` -} diff --git a/app/http/responses/user/info.go b/app/http/responses/user/info.go deleted file mode 100644 index 0e01efd9..00000000 --- a/app/http/responses/user/info.go +++ /dev/null @@ -1,8 +0,0 @@ -package responses - -type Info struct { - ID uint `json:"id"` - Role []string `json:"role"` - Username string `json:"username"` - Email string `json:"email"` -} diff --git a/app/http/responses/website/list.go b/app/http/responses/website/list.go deleted file mode 100644 index a91a8a89..00000000 --- a/app/http/responses/website/list.go +++ /dev/null @@ -1,8 +0,0 @@ -package responses - -import "panel/app/models" - -type List struct { - Total int64 `json:"total"` - Items []models.Website `json:"items"` -} diff --git a/docs/docs.go b/docs/docs.go index f027cc03..a6530f70 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -101,19 +101,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.CertList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -311,19 +299,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.DNSList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -678,19 +654,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.CertList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1452,19 +1416,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.Settings" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1528,19 +1480,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.Info" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1632,7 +1572,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/services.BackupFile" + "$ref": "#/definitions/internal.BackupFile" } } } @@ -1829,19 +1769,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.List" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1960,7 +1888,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/services.PanelWebsite" + "$ref": "#/definitions/internal.PanelWebsite" } } } @@ -2630,6 +2558,67 @@ const docTemplate = `{ } } }, + "internal.BackupFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "size": { + "type": "string" + } + } + }, + "internal.PanelWebsite": { + "type": "object", + "properties": { + "db": { + "type": "boolean" + }, + "db_name": { + "type": "string" + }, + "db_password": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "db_user": { + "type": "string" + }, + "domains": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "php": { + "type": "integer" + }, + "ports": { + "type": "array", + "items": { + "type": "integer" + } + }, + "remark": { + "type": "string" + }, + "ssl": { + "type": "boolean" + }, + "status": { + "type": "boolean" + } + } + }, "models.Cert": { "type": "object", "properties": { @@ -3230,158 +3219,6 @@ const docTemplate = `{ "type": "string" } } - }, - "responses.CertList": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Cert" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.DNSList": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.CertDNS" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.Info": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "role": { - "type": "array", - "items": { - "type": "string" - } - }, - "username": { - "type": "string" - } - } - }, - "responses.List": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Website" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.Settings": { - "type": "object", - "properties": { - "backup_path": { - "type": "string" - }, - "email": { - "type": "string" - }, - "entrance": { - "type": "string" - }, - "name": { - "type": "string" - }, - "password": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "website_path": { - "type": "string" - } - } - }, - "services.BackupFile": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "size": { - "type": "string" - } - } - }, - "services.PanelWebsite": { - "type": "object", - "properties": { - "db": { - "type": "boolean" - }, - "db_name": { - "type": "string" - }, - "db_password": { - "type": "string" - }, - "db_type": { - "type": "string" - }, - "db_user": { - "type": "string" - }, - "domains": { - "type": "array", - "items": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "php": { - "type": "integer" - }, - "ports": { - "type": "array", - "items": { - "type": "integer" - } - }, - "remark": { - "type": "string" - }, - "ssl": { - "type": "boolean" - }, - "status": { - "type": "boolean" - } - } } }, "securityDefinitions": { diff --git a/docs/swagger.json b/docs/swagger.json index c501d1d0..c62991c7 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -94,19 +94,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.CertList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -304,19 +292,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.DNSList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -671,19 +647,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.CertList" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1445,19 +1409,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.Settings" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1521,19 +1473,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.Info" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1625,7 +1565,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/services.BackupFile" + "$ref": "#/definitions/internal.BackupFile" } } } @@ -1822,19 +1762,7 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/controllers.SuccessResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/responses.List" - } - } - } - ] + "$ref": "#/definitions/controllers.SuccessResponse" } } } @@ -1953,7 +1881,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/services.PanelWebsite" + "$ref": "#/definitions/internal.PanelWebsite" } } } @@ -2623,6 +2551,67 @@ } } }, + "internal.BackupFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "size": { + "type": "string" + } + } + }, + "internal.PanelWebsite": { + "type": "object", + "properties": { + "db": { + "type": "boolean" + }, + "db_name": { + "type": "string" + }, + "db_password": { + "type": "string" + }, + "db_type": { + "type": "string" + }, + "db_user": { + "type": "string" + }, + "domains": { + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "php": { + "type": "integer" + }, + "ports": { + "type": "array", + "items": { + "type": "integer" + } + }, + "remark": { + "type": "string" + }, + "ssl": { + "type": "boolean" + }, + "status": { + "type": "boolean" + } + } + }, "models.Cert": { "type": "object", "properties": { @@ -3223,158 +3212,6 @@ "type": "string" } } - }, - "responses.CertList": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Cert" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.DNSList": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.CertDNS" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.Info": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "role": { - "type": "array", - "items": { - "type": "string" - } - }, - "username": { - "type": "string" - } - } - }, - "responses.List": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Website" - } - }, - "total": { - "type": "integer" - } - } - }, - "responses.Settings": { - "type": "object", - "properties": { - "backup_path": { - "type": "string" - }, - "email": { - "type": "string" - }, - "entrance": { - "type": "string" - }, - "name": { - "type": "string" - }, - "password": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "website_path": { - "type": "string" - } - } - }, - "services.BackupFile": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "size": { - "type": "string" - } - } - }, - "services.PanelWebsite": { - "type": "object", - "properties": { - "db": { - "type": "boolean" - }, - "db_name": { - "type": "string" - }, - "db_password": { - "type": "string" - }, - "db_type": { - "type": "string" - }, - "db_user": { - "type": "string" - }, - "domains": { - "type": "array", - "items": { - "type": "string" - } - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "php": { - "type": "integer" - }, - "ports": { - "type": "array", - "items": { - "type": "integer" - } - }, - "remark": { - "type": "string" - }, - "ssl": { - "type": "boolean" - }, - "status": { - "type": "boolean" - } - } } }, "securityDefinitions": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 019c8473..54ee0251 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -46,6 +46,46 @@ definitions: message: type: string type: object + internal.BackupFile: + properties: + name: + type: string + size: + type: string + type: object + internal.PanelWebsite: + properties: + db: + type: boolean + db_name: + type: string + db_password: + type: string + db_type: + type: string + db_user: + type: string + domains: + items: + type: string + type: array + name: + type: string + path: + type: string + php: + type: integer + ports: + items: + type: integer + type: array + remark: + type: string + ssl: + type: boolean + status: + type: boolean + type: object models.Cert: properties: auto_renew: @@ -441,105 +481,6 @@ definitions: kid: type: string type: object - responses.CertList: - properties: - items: - items: - $ref: '#/definitions/models.Cert' - type: array - total: - type: integer - type: object - responses.DNSList: - properties: - items: - items: - $ref: '#/definitions/models.CertDNS' - type: array - total: - type: integer - type: object - responses.Info: - properties: - email: - type: string - id: - type: integer - role: - items: - type: string - type: array - username: - type: string - type: object - responses.List: - properties: - items: - items: - $ref: '#/definitions/models.Website' - type: array - total: - type: integer - type: object - responses.Settings: - properties: - backup_path: - type: string - email: - type: string - entrance: - type: string - name: - type: string - password: - type: string - port: - type: string - username: - type: string - website_path: - type: string - type: object - services.BackupFile: - properties: - name: - type: string - size: - type: string - type: object - services.PanelWebsite: - properties: - db: - type: boolean - db_name: - type: string - db_password: - type: string - db_type: - type: string - db_user: - type: string - domains: - items: - type: string - type: array - name: - type: string - path: - type: string - php: - type: integer - ports: - items: - type: integer - type: array - remark: - type: string - ssl: - type: boolean - status: - type: boolean - type: object info: contact: email: i@haozi.net @@ -596,12 +537,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.CertList' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 获取证书列表 @@ -722,12 +658,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.DNSList' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 获取 DNS 接口列表 @@ -942,12 +873,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.CertList' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 获取用户列表 @@ -1416,12 +1342,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.Settings' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 设置列表 @@ -1460,12 +1381,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.Info' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 用户信息 @@ -1522,7 +1438,7 @@ paths: - properties: data: items: - $ref: '#/definitions/services.BackupFile' + $ref: '#/definitions/internal.BackupFile' type: array type: object security: @@ -1640,12 +1556,7 @@ paths: "200": description: OK schema: - allOf: - - $ref: '#/definitions/controllers.SuccessResponse' - - properties: - data: - $ref: '#/definitions/responses.List' - type: object + $ref: '#/definitions/controllers.SuccessResponse' security: - BearerToken: [] summary: 获取网站列表 @@ -1718,7 +1629,7 @@ paths: - $ref: '#/definitions/controllers.SuccessResponse' - properties: data: - $ref: '#/definitions/services.PanelWebsite' + $ref: '#/definitions/internal.PanelWebsite' type: object security: - BearerToken: []