|
|
@@ -8,8 +8,6 @@ import (
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/application"
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/domain"
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
|
|
|
- "git.sxidc.com/go-tools/utils/strutils"
|
|
|
- "git.sxidc.com/service-supports/fserr"
|
|
|
)
|
|
|
|
|
|
var versionService = &VersionService{}
|
|
|
@@ -32,26 +30,8 @@ func (svc *VersionService) prefixRoot(appInstance *application.App) {
|
|
|
Path: "/version",
|
|
|
SendResponseFunc: response.SendMapResponse,
|
|
|
ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
|
|
|
- localCacheVersion, err := i.LocalCache().Get("version")
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- redisCacheVersion, err := i.RedisCache().Get("version")
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- if localCacheVersion != redisCacheVersion {
|
|
|
- return nil, fserr.New("版本不一致")
|
|
|
- }
|
|
|
-
|
|
|
- if strutils.IsStringEmpty(localCacheVersion) {
|
|
|
- localCacheVersion = "cache-empty-v1.0.0"
|
|
|
- }
|
|
|
-
|
|
|
return map[string]any{
|
|
|
- "version": localCacheVersion,
|
|
|
+ "version": "v1.0.0",
|
|
|
}, nil
|
|
|
},
|
|
|
})
|