feat: add site info write common service

This commit is contained in:
LinkinStar 2022-11-14 15:21:17 +08:00
parent cca5bcb59b
commit 00336de025
1 changed files with 14 additions and 0 deletions

View File

@ -62,3 +62,17 @@ func (s *SiteInfoCommonService) GetSiteBranding(ctx context.Context) (resp *sche
_ = json.Unmarshal([]byte(siteInfo.Content), resp) _ = json.Unmarshal([]byte(siteInfo.Content), resp)
return resp, nil return resp, nil
} }
// GetSiteWrite get site info write
func (s *SiteInfoCommonService) GetSiteWrite(ctx context.Context) (resp *schema.SiteWriteResp, err error) {
siteInfo, exist, err := s.siteInfoRepo.GetByType(ctx, constant.SiteTypeWrite)
if err != nil {
return nil, err
}
if !exist {
return nil, errors.BadRequest(reason.SiteInfoNotFound)
}
resp = &schema.SiteWriteResp{}
_ = json.Unmarshal([]byte(siteInfo.Content), resp)
return resp, nil
}