wz-golang-server/server/modules/api/service/app_config_service.go

39 lines
994 B
Go

// Package service 业务逻辑层
package service
import (
"server/config"
apiDto "server/modules/api/dto"
)
type AppConfigService struct{}
func NewAppConfigService() *AppConfigService {
return &AppConfigService{}
}
// GetConfig 获取配置中心信息
func (s *AppConfigService) GetConfig() apiDto.AppConfigResponse {
cfg := config.AppConfig.AppConfig
return apiDto.AppConfigResponse{
App: apiDto.AppClientConfig{
MinVersion: cfg.App.MinVersion,
LatestVersion: cfg.App.LatestVersion,
ForceUpdate: cfg.App.ForceUpdate,
},
API: apiDto.AppEndpointConfig{
BaseURL: cfg.API.BaseURL,
Version: cfg.API.Version,
MinClientVersion: cfg.API.MinClientVersion,
},
WebView: apiDto.AppEndpointConfig{
BaseURL: cfg.WebView.BaseURL,
Version: cfg.WebView.Version,
MinClientVersion: cfg.WebView.MinClientVersion,
},
TTLSeconds: cfg.TTLSeconds,
Disabled: cfg.Disabled,
DisableReason: cfg.DisableReason,
}
}