Skip to content

Commit 0e3ccfd

Browse files
committed
license status
1 parent b6a630d commit 0e3ccfd

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

api/do.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ type IndexInfo struct {
7979
}
8080

8181
type LicenseInfo struct {
82-
Id string `json:"id"`
83-
Type string `json:"type"`
84-
Customer string `json:"customer"`
85-
Project string `json:"project"`
86-
CountryCode string `json:"countryCode"`
87-
InstallDate string `json:"installDate"`
88-
IssueDate string `json:"issueDate"`
82+
Id string `json:"id"`
83+
Type string `json:"type"`
84+
Customer string `json:"customer"`
85+
Project string `json:"project"`
86+
CountryCode string `json:"countryCode"`
87+
InstallDate string `json:"installDate"`
88+
IssueDate string `json:"issueDate"`
89+
LicenseStatus string `json:"licenseStatus,omitempty"`
8990
}
9091

9192
type TagInfo struct {

api/do_license.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ func GetLicenseInfo(ctx context.Context, conn Conn) (*LicenseInfo, error) {
1515
if err := row.Scan(&ret.Id, &ret.Type, &ret.Customer, &ret.Project, &ret.CountryCode, &ret.InstallDate, &ret.IssueDate); err != nil {
1616
return nil, err
1717
}
18+
// TODO: get license status
19+
ret.LicenseStatus = "Valid"
1820
return ret, nil
1921
}
2022

mods/server/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,8 @@ func (svr *httpd) handleCheck(ctx *gin.Context) {
760760
svr.licenseStatusLastTime = time.Now()
761761
svr.licenseStatus = "Unknown"
762762
if conn, err := svr.getUserConnection(ctx); err == nil {
763-
if _, err = api.GetLicenseInfo(ctx, conn); err == nil {
764-
svr.licenseStatus = "Valid"
763+
if nfo, err := api.GetLicenseInfo(ctx, conn); err == nil {
764+
svr.licenseStatus = nfo.LicenseStatus
765765
}
766766
conn.Close()
767767
}

0 commit comments

Comments
 (0)