fix: add aheadCnt in sysinfo (#1632)

* feat: add sync module to bi-sync mysql

* feat: fix the delay problem

* feat: fix go mod

* feat: fix the varchar(100) parse error

* fix: fix go.mod space inconsistency

* fix: fix go.mod space inconsistency

* fix: use sql builder instead of concatenation

* fix: remove serverId

* fix: fix file is not `gofumpt`-ed (gofumpt) error

* feat: add mysql bi-sync

* feat: fix some data inconsistency problems

* feat: add function atuo get server uuid

* fix: encapsulate the struct to optimize the code

* fix: fix incorrect Casdoor version in system info page

* fix: fix incorrect root path

* Update sysytem_test.go

* feat: add aheadCnt means that the commit is ahead of version several times

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
This commit is contained in:
longxu0509
2023-03-09 16:07:13 +08:00
committed by GitHub
parent 3f623570fd
commit 2de3f6772d
3 changed files with 30 additions and 18 deletions

View File

@ -26,8 +26,9 @@ type SystemInfo struct {
}
type GitRepoInfo struct {
Commit string `json:"commit"`
Version string `json:"version"`
AheadCnt int `json:"ahead_cnt"`
Commit string `json:"commit"`
Version string `json:"version"`
}
// GetSystemInfo
@ -76,15 +77,16 @@ func (c *ApiController) GetSystemInfo() {
// @Success 200 {string} local latest version hash of casdoor
// @router /get-release [get]
func (c *ApiController) GitRepoVersion() {
commit, version, err := util.GetGitRepoVersion()
aheadCnt, commit, version, err := util.GetGitRepoVersion()
if err != nil {
c.ResponseError(err.Error())
return
}
c.Data["json"] = GitRepoInfo{
Commit: commit,
Version: version,
AheadCnt: aheadCnt,
Commit: commit,
Version: version,
}
c.ServeJSON()
}