fix(siteinfo): remove theme config in interface

This commit is contained in:
LinkinStar 2022-12-19 17:54:51 +08:00
parent e6069d8475
commit 21e402cb8a
2 changed files with 2 additions and 16 deletions

View File

@ -36,7 +36,6 @@ func (r *SiteGeneralReq) FormatSiteUrl() {
// SiteInterfaceReq site interface request
type SiteInterfaceReq struct {
Theme string `validate:"required,gt=1,lte=128" form:"theme" json:"theme"`
Language string `validate:"required,gt=1,lte=128" form:"language" json:"language"`
TimeZone string `validate:"required,gt=1,lte=128" form:"time_zone" json:"time_zone"`
}

View File

@ -114,23 +114,10 @@ func (s *SiteInfoService) SaveSiteGeneral(ctx context.Context, req schema.SiteGe
func (s *SiteInfoService) SaveSiteInterface(ctx context.Context, req schema.SiteInterfaceReq) (err error) {
var (
siteType = "interface"
themeExist bool
content []byte
siteType = "interface"
content []byte
)
// check theme
for _, theme := range schema.GetThemeOptions {
if theme.Value == req.Theme {
themeExist = true
break
}
}
if !themeExist {
err = errors.BadRequest(reason.ThemeNotFound)
return
}
// check language
if !translator.CheckLanguageIsValid(req.Language) {
err = errors.BadRequest(reason.LangNotFound)