1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-18 21:29:26 +08:00
1Panel/backend/app/service/website_ssl.go

63 lines
1.6 KiB
Go
Raw Normal View History

2022-11-11 17:41:39 +08:00
package service
import (
"github.com/1Panel-dev/1Panel/backend/app/dto"
)
type WebSiteSSLService struct {
}
func (w WebSiteSSLService) Page(search dto.PageInfo) (int64, []dto.WebsiteSSLDTO, error) {
total, sslList, err := websiteSSLRepo.Page(search.Page, search.PageSize, commonRepo.WithOrderBy("created_at desc"))
var sslDTOs []dto.WebsiteSSLDTO
for _, ssl := range sslList {
sslDTOs = append(sslDTOs, dto.WebsiteSSLDTO{
WebSiteSSL: ssl,
})
}
return total, sslDTOs, err
}
//func (w WebSiteSSLService) Create(create dto.WebsiteSSLCreate) (dto.WebsiteSSLCreate, error) {
//
// authorization, err := json.Marshal(create.Authorization)
// if err != nil {
// return dto.WebsiteSSLCreate{}, err
// }
//
// if err := websiteSSLRepo.Create(model.WebsiteDnsAccount{
// Name: create.Name,
// Type: create.Type,
// Authorization: string(authorization),
// }); err != nil {
// return dto.WebsiteSSLCreate{}, err
// }
//
// return create, nil
//}
//
//func (w WebSiteSSLService) Update(update dto.WebsiteDnsAccountUpdate) (dto.WebsiteDnsAccountUpdate, error) {
//
// authorization, err := json.Marshal(update.Authorization)
// if err != nil {
// return dto.WebsiteDnsAccountUpdate{}, err
// }
//
// if err := websiteSSLRepo.Save(model.WebsiteDnsAccount{
// BaseModel: model.BaseModel{
// ID: update.ID,
// },
// Name: update.Name,
// Type: update.Type,
// Authorization: string(authorization),
// }); err != nil {
// return dto.WebsiteDnsAccountUpdate{}, err
// }
//
// return update, nil
//}
func (w WebSiteSSLService) Delete(id uint) error {
return websiteSSLRepo.DeleteBy(commonRepo.WithByID(id))
}