feat: Add SysInfoVer endpoint and AppService for version retrieval

This commit is contained in:
lejianwen
2025-04-07 16:38:21 +08:00
parent e7f28cca36
commit ab231b3fed
6 changed files with 71 additions and 7 deletions

28
service/app.go Normal file
View File

@@ -0,0 +1,28 @@
package service
import (
"os"
"sync"
)
type AppService struct {
}
var version = ""
var once = &sync.Once{}
func (a *AppService) GetAppVersion() string {
if version != "" {
return version
}
once.Do(func() {
v, err := os.ReadFile("resources/version")
if err != nil {
return
}
version = string(v)
})
return version
}