39 lines
879 B
Go
39 lines
879 B
Go
|
// file name: bbs_domain_service.go
|
||
|
package domainservice
|
||
|
|
||
|
import (
|
||
|
"bbs-backend/api/request"
|
||
|
"bbs-backend/common/errcode"
|
||
|
"bbs-backend/dal/dao"
|
||
|
)
|
||
|
|
||
|
func GetBBSInfoDomainService() (map[string]string, error) {
|
||
|
forumInfo, err := dao.GetBBSInfo()
|
||
|
if err != nil {
|
||
|
return nil, errcode.ErrInternalServerError
|
||
|
}
|
||
|
return forumInfo, nil
|
||
|
}
|
||
|
|
||
|
func UpdateBBSInfoDomainService(req request.UpdateBBSInfoRequest) error {
|
||
|
if req.BBSName != "" {
|
||
|
err := dao.UpdateBBSInfo("forum_name", req.BBSName)
|
||
|
if err != nil {
|
||
|
return errcode.ErrInternalServerError
|
||
|
}
|
||
|
}
|
||
|
if req.BBSLogo != "" {
|
||
|
err := dao.UpdateBBSInfo("forum_logo", req.BBSLogo)
|
||
|
if err != nil {
|
||
|
return errcode.ErrInternalServerError
|
||
|
}
|
||
|
}
|
||
|
if req.BBSDescription != "" {
|
||
|
err := dao.UpdateBBSInfo("forum_description", req.BBSDescription)
|
||
|
if err != nil {
|
||
|
return errcode.ErrInternalServerError
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|